wxWindows Library Reference

None-type functions

Function Parameter Type Remark
wxcast(w) user Casts a widget, e.g., a frame, to the base window type for calling window functions.
wxmsg(msg) string Displays a message.
wxframe([arg]) string

Returns the application's main frame window as user object, which may call frame functions and may be casted to the base window type to call window functions. If the optional arg is the name of a function, the function will get three inputs with the first being the even name, which may be "size" for sizing event, "timer" for timer event, and "paint" for paint event. The last two inputs will be window's client width and height respectively for sizing event; they will be activation status and milliseconds for timer event; and they will be handler to the window and null for paint event.

wxtimer(ms) integer

Starts (ms>0) or stops (ms<=0) the timer of the main frame window.

wxbusy(flag) true/false Turns on/off the busy state of the mouse cursor.

Frame/Dialog functions

Function Parameter Type Remark
:show(flag) true/false Shows the dialog window in modal (flag=true) or modalless mode (flag=false).
:title(s) string Sets the window's title.
:icon(fname) string Uses the image in the file as the windows's icon. Supported image formats include ".ico", ".gif", ".xpm", and ".xbm".
:fullscreen(flag) true/false Enables/disables the fullscreen mode of the window.
:menubar([s1, s2...]) strings Creates a menubar in the window, adds menus to the menu bar, and adds items to menus. A new menu bar is always created the first time to call or for a call with no argument. The first string will be the main menu name and the rests will be menu items. If the first character of a item ">", a sub-menu will be created with the next item as the sub-menu name and the following items will be added to the sub-menu; if the first character of a item is "<", the following items will be added to the main menu; and if the first character of a item is "_", a separator bar will be added to the menu or sub-menu.
:toolbar(img, tip[, img, tip...]) strings Creates a toolbar in the window, adds image buttons and tips button-tips to the toolbar bar. If the image file name is "|", a separator bar will be added to the toolbar. Supported image formats include ".bmp", ".gif", ".xpm", and ".xbm".
:statusbar(n) integer, string Creates a statusbar in the window.
:statusbar(n, s) integer, string Shows the string in the nth field of the statusbar. The first field is 0.

Widget functions

Function Parameter Type Remark
:button(caption) string Creates a button control and returns the object.
:checkbox(caption, checked) string, true/false Creates a checkbox control and returns the object.
:close()   Usually called to close the main frame window.
:combobox(opt1, opt2[, ...]) strings Creates a combobox control and returns the object.
:dialog([style]) true/false, string Creates a dialog box and returns it as user object, which can call frame functions and may be casted to the base window type for calling window functions. The style string can be parts of the full style string "caption|resize|close|minimize|maximize|thick|no3d" corresponding to styles of wxCAPTION | wxRESIZE_BORDER | wxCLOSE_BOX | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSTAY_ON_TOP | wxNO_3D.
:colordialog()   Shows a color dialogbox and return user selected color as an array with [0]=red, [1]=green, and [2]=blue.
:color(bg, r, g, b) true/false, integer, integer, integer Sest the background (bg=true) or foreground color of the window.
:fontdialog()   Shows a font dialogbox and return user selected font data in an array.
:font(arr) array Set window font using font data in the array.
:filedialog([save]) true/false Shows an open/save file dialogbox and return user selected files. If the dialogbox is for saving file (save=true), only one file name returns as string; otherwise, file names are returned in an array.
:dirdialog()   Shows a directory dialogbox and returns user selected directory name.
:id()   Returns the widget ID as integer.
:hwnd()   Returns the window's handle as user object, which may be cast to HWND by other applicaitons for paiting.
:notebook(style) string Creates a notebook control and returns the object handle.
:panel()   Creates a panel and returns the object.
:push(func, event, id) user, string, string, integer/array Pushes an event handler on to the window's even handler stack. The named function will be called when an event occurs. Refer to the event table for what events will be handled by the handler for the given widget ID or IDs.
:radiobox(caption, style, opt1, opt2[, ...]) strings Creates a radiobox control and returns the object. If the style="rows", option radio buttons will be arranged in rows; otherwise in columns.
:size()   Returns the size of the client area of a widget as an array with width in [0] and height in [1].
:size(w, h) integers Set the size of the client area of a widget.
:sizer(flag) string Creats a horizontal (flag="h") or vertical (flag="v") box sizer in the widget.
:sizer(flag, title) strings Creats a horizontal (flag="h") or vertical (flag="v") static box sizer in the widget.
:sizer(rows, rowgap, cols, colgap) integers Creats flex grid sizer in the widget.
:slider(style, value, min, max) string, integers Creates a slider control and returns the object. If style="vert", the slider layout is vertical; otherwise horizontal.
:splitter()   Creates a slitter control and returns the object, which can call splitter functions.
:statictext(text[, align]) string, integer Creates a static text (like a label) and returns the object. If align>0, the text will be right aligned; and if align=0, center aligned.
:style(style) string Sets the window style. The style string can be parts of the full style string "simple|double|sunken|raised|static|none|vscroll|hscroll|clip" corresponding to styles of wxSIMPLE_BORDER | DOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxSTATIC_BORDER | wxNO_BORDER | wxVSCROLL | wxHSCROLL | wxCLIP_CHILDREN.
:textbox(text[, style]); strings Creates a textbox control and returns the object. The style string can be parts of the full style string "multiline|password|readonly|left|center|right" corresponding to styles of wxTE_MULTILINE | wxTE_PASSWORD | wxTE_READONLY | wxTE_LEFT | wxTE_CENTRE | wxTE_RIGHT.
:tree([func]); string Creates a tree control and returns the object. The a callback function name is provided, the function will be called with the item text when the item is double clicked.

Splitter functions

Function Parameter Type Remark
:split([pos, flag]) integer, string Sets the splitter control with given split position vertically (flag="v") or horizontally (flag="h").
:replace(k, w) integer, user Replace the first (k=1) or second (k=2) panel with the new window control.
:min(size) integer Sets the minimal panel size.

Notebook functions

Function Parameter Type Remark
:add(name, hwnd) string, user Adds a page with the name that contains the control.

Sizer functions

Function Parameter Type Remark
:add(hwnd[, flag, prop]) user, string, integer Adds a window control to the sizer. The optional flag string (in the form of "...|...") may be "top", "left", "right", "bottom", "all", "expand", "shaped", "minsize", "aligncenter", "alignvertical", "alignhorizontal", "alignleft", "alignright", "aligntop", and "alignbottom"; and the optional prop sets the proportion of space that control possesses in the sizer (box sizer only).
:rowsize(irow, prop) integer, integer Sets the propertion of the row of grid sizer.
:colsize(icol, prop) integer, integer Sets the propertion of the column of grid sizer.

Event Table

event name events Remark
size wxEVT_SIZE The callback function will get 1 integer parameter.
menu wxEVT_COMMAND_MENU_SELECTED The callback function will get 1 integer parameter of the selected menu ID.
tool wxEVT_COMMAND_TOOL_CLICKED The callback function will get 1 integer parameter of the selected tool button ID.
control wxEVT_COMMAND_BUTTON_CLICKED, wxEVT_COMMAND_CHECKBOX_CLICKED, wxEVT_COMMAND_CHOICE_SELECTED, wxEVT_COMMAND_COMBOBOX_SELECTED, wxEVT_COMMAND_LISTBOX_SELECTED, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxEVT_COMMAND_SCROLLBAR_UPDATED, wxEVT_COMMAND_SLIDER_UPDATED, The callback function will get 1 integer parameter of the click widget ID or selected item ID.
key wxEVT_CHAR , wxEVT_KEY_DOWN, wxEVT_KEY_UP The callback function will get 5 integer parameters. The first represent event type: 0 to 2 corresponding to the events on the left; the second is wxWindows key code; the rests indicate key down of control, alt, and shift, respectively.
mouse wxEVT_LEFT_DOWN, wxEVT_LEFT_UP, wxEVT_LEFT_DCLICK, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DCLICK, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_UP, wxEVT_RIGHT_DCLICK, wxEVT_MOTION The callback function will get 6 integer parameters. The first represent event type: 1 to 10 corresponding to the events on the left; the next two are x-y position of mouse; and the rests indicate key down of control, alt, and shift, respectively.