MacroMonkey.com - Home

Automation - Macro - Bot - Scripting system.



GUI Library:

MM GUI system has base support, for basic windows dialogs, plus a complete windowing system to give your scripts a GUI interface(s).


Base dialogs:

The hWndParent arguments are optional parent window handles; defaults to console window.


Displays a standard windows message box, and returns the user input results.

See: http://msdn.microsoft.com/en-us/library/ms645505%28VS.85%29.aspx

result = gui.MessageBox(szTitle, szText, Flags, [hWndParent])


Result constants:

gui.IDABORT, gui.IDCANCEL, gui.IDCONTINUE, gui.IDIGNORE, gui.IDNO, gui.IDOK, gui.IDRETRY, gui.IDTRYAGAIN, gui.IDYES


Supported message box option flags:

gui.MB_ABORTRETRYIGNORE, gui.MB_CANCELTRYCONTINUE, gui.MB_OK, gui.MB_OKCANCEL, gui.MB_RETRYCANCEL, gui.MB_YESNO, gui.MB_YESNOCANCEL, gui.MB_ICONEXCLAMATION, gui.MB_ICONWARNING, gui.MB_ICONINFORMATION, gui.MB_ICONASTERISK, gui.MB_ICONQUESTION, gui.MB_ICONSTOP, gui.MB_ICONERROR

gui.MB_ICONHAND, gui.MB_DEFBUTTON1, gui.MB_DEFBUTTON2, gui.MB_DEFBUTTON3, gui.MB_DEFBUTTON4, gui.MB_RIGHT


See MSDN document “MessageBox Function” for definitions of the flags, return codes, etc.


Example:

gui.MessageBox("Test", "This is a message box!", bit.OR(gui.MB_YESNOCANCEL, gui.MB_ICONHAND))



Dialog to select a file for opening.

szFileName, szFullPath = gui.GetOpenFileDialog([szTitle], [szStartDir], [szFliter], [szDefExt], [hWndParent])


Example:

-- Do a open file dialog like the default MM start up one

local szFilter = "MacroMonkey & Lua Script Files (*.mms;*.lua)\0*.mms;*.lua\0MacroMonkey Script Files (*.mms)\0*.mms;\0Lua Script Files (*.lua)\0*.lua\0All Files (*.*)\0*.*\0\0\0\0"

local szName, szPath = gui.GetOpenFileDialog("Open Script File", nil, szFilter, "mms")

print(szName, szPath)


Dialog to select a file for saving.

szFileName, szFullPath = gui.GetSaveFileDialog([szTitle], [szStartDir], [szFliter], [szDefExt], [hWndParent])


Get folder path dialog.

szPath = gui.GetFolderDialog([szCaption], [szStartDir], [hWndParent])


Choose color dialog.

r,g,b = gui.ChooseColorDialog([hWndParent])



Utility:

Take a screen shot of window identified by HWND (default desktop). Returns true on success.

bResult = gui.ScreenShot(szFileName, [HWND])



GUI System:

The GUI system consists of one or more base windows and controls/widgets.

All GUI events are asynchronously queued internally to be polled into a table by gui.PollEvents() (see below).

Must keep a reference of created GUI objects for them to persist. GUI objects will automatically close (and disappear) if they loose scope, on the next garbage collection cycle.

Windows themes are disabled for some widgets to keep a more consistent look and control over themed, and not themed.


Create Base Window object:

winobj = gui.Window([szTitle], [x,y], [width,height], [style], [styleEx], [hWndParent], [BckgrndColor])

szTitle: Optional window title. Default none.

x, y: Optional window position. Default let the OS decide.

width, height: Optional window size. Default let the OS decide.

style: Optional style flags. Default gui.Window.STYLE_DEF (see below).

styleEx: Optional extended style flags. Default gui.Window.STYLEX_DEF (see below).

hWndParent: Optional parent window.

BckgrndColor: Optional background color. Default, default OS color.


By default base windows will not immediately be visible unless created with the gui.Window.WS_VISIBLE style flag.

This way, a complex window(s) can be assembled then made visible when done.

To manually make a window visible after creation one can call its member SetState() with the gui.Window.SHOW flag (see below); or alternterativly win.SetState(winobj:GetHandle(), win.SW_SHOW).


Example:

-- Create a main GUI window of size 800x600, visible, with black background, etc.

MainWin = gui.Window("My main GUI window", 0,0, 800,600, bit.OR(gui.Window.STYLE_DEF, gui.Window.WS_VISIBLE), nil, nil, color.RGB(0, 0, 0))


GUI window and widget base methods:

The base and tab page window (see below), and most widgets will have this base methods.

The exception will be the GetTitle/GetText type if the window has no text associated with it.


hWnd = :GetHandle()Get window’s handle.
hWndParent = :GetParent()Get window parent handle if it has one.
szTitle = :GetText()Get window text string.
szTitle = :GetTitle()Get window title string (functionally same as GetText()).
:SetText(szTitle)Set window text string.
:SetTitle(szTitle)Set window title string (functionally same as SetText()).
x,y = :GetPos()Get window position. Relative to parent if it has one.
:SetPos(x, y)Set window position. Relative to parent if it has one.
w,h = :GetSize()Get window dimensions.
w,h = :GetClientSize()Get window client dimensions.
:SetSize(w,h)Set window dimensions.
left,top,right,bottom = :GetRect()Get window rectangle. Relative to parent if it has one.
left,top,right,bottom = :GetClientRect()Get window client rectangle. Relative to parent if it has one.
:Close()Close window; even if gui.Window.NOUSERCLOSE was set (see below).
stateFlags = :GetState()Get window state flags (see below).
:SetState(stateFlags)Set window state flags (see below).


Example:

-- Make window visible

winobj:SetState(gui.Window.SHOW)



Constants:

Windows “is” status flags returned by the :GetState() method:

Many of this flags apply to widgets as well.


gui.Window.IS_VALID    Window exists.

gui.Window.IS_ENABLED    Window is enabled.

gui.Window.IS_HIDDEN    Window is hidden.

gui.Window.IS_MINIMIZED    Window is minimized.

gui.Window.IS_MAXIMIZED    Window is maximized.

gui.Window.IS_INFOCUS    Window is the one in focus.


Windows set status flags, set by the :SetState() method:

gui.Window.ENABLE    Enable window.

gui.Window.DISABLE    Disable window.

gui.Window.HIDE    Hide window.

gui.Window.SHOW    Make window visible.

gui.Window.FOCUS    Force window into focus.

gui.Window.MINIMIZE    Minimize window.

gui.Window.MAXIMIZE    Maximize window.


The gui.EVENT_SIZE size “Code” values (see gui.EVENT_SIZE below):

gui.Window.SIZE_RESTORED    Window was restored, and, or, was resized.

gui.Window.SIZE_MINIMIZED    Window was minimized.

gui.Window.SIZE_MAXIMIZED    Window was maximized.


Window styles:

Some of these styles can be applied to widgets as well.

Please see for description of the styles:

http://msdn.microsoft.com/en-us/library/ms632600%28VS.85%29.aspx

gui.Window.STYLE_DEF Default (WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_MINIMIZEBOX).


gui.Window.WS_OVERLAPPED

gui.Window.WS_POPUP

gui.Window.WS_CHILD

gui.Window.WS_MINIMIZE

gui.Window.WS_VISIBLE

gui.Window.WS_DISABLED

gui.Window.WS_CLIPSIBLINGS

gui.Window.WS_CLIPCHILDREN

gui.Window.WS_MAXIMIZE

gui.Window.WS_CAPTION

gui.Window.WS_BORDER

gui.Window.WS_DLGFRAME

gui.Window.WS_VSCROLL

gui.Window.WS_HSCROLL

gui.Window.WS_SYSMENU

gui.Window.WS_THICKFRAME

gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_MINIMIZEBOX

gui.Window.WS_MAXIMIZEBOX

gui.Window.WS_TILED

gui.Window.WS_ICONIC

gui.Window.WS_SIZEBOX

gui.Window.WS_TILEDWINDOW

gui.Window.WS_OVERLAPPEDWINDOW

gui.Window.WS_POPUPWINDOW

gui.Window.WS_CHILDWINDOW


gui.Window.NOUSERCLOSE Disable a base window from being closed manually.



Window extended styles:

Some of these styles can be applied to widgets as well.

Please see for description of the styles under dwExStyle:

http://msdn.microsoft.com/en-us/library/ms632680%28VS.85%29.aspx

gui.Window.STYLEX_DEF Default, WS_EX_STATICEDGE.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_NOPARENTNOTIFY

gui.Window.WS_EX_TOPMOST

gui.Window.WS_EX_ACCEPTFILES

gui.Window.WS_EX_TRANSPARENT

gui.Window.WS_EX_MDICHILD

gui.Window.WS_EX_TOOLWINDOW

gui.Window.WS_EX_WINDOWEDGE

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_CONTEXTHELP

gui.Window.WS_EX_RIGHT

gui.Window.WS_EX_LEFT

gui.Window.WS_EX_RTLREADING

gui.Window.WS_EX_LTRREADING

gui.Window.WS_EX_LEFTSCROLLBAR

gui.Window.WS_EX_RIGHTSCROLLBAR

gui.Window.WS_EX_CONTROLPARENT

gui.Window.WS_EX_STATICEDGE

gui.Window.WS_EX_APPWINDOW

gui.Window.WS_EX_OVERLAPPEDWINDOW

gui.Window.WS_EX_PALETTEWINDOW

gui.Window.WS_EX_LAYERED

gui.Window.WS_EX_NOINHERITLAYOUT

gui.Window.WS_EX_LAYOUTRTL

gui.Window.WS_EX_COMPOSITED

gui.Window.WS_EX_NOACTIVATE


Events: gui.EVENT_SIZE, gui.EVENT_MOVE, gui.EVENT_FOCUS, gui.EVENT_CLOSED (see below).



Widgets:

Widgets are child controls/windows off a parent base, or tab page window (see tab widget below).

If the parent window has a background color most of the widgets will inherit it (if can be colored).


Menu widget:

menuobj = obj.Menu((MenuBar or Menu), szLabel, [BackgroundColor])

MenuBar or Menu: Parent menu bar OR optionally another menu widget (to form a hierarchy).

szLabel: Text label.

BackgroundColor: Optional background color.


Adds a “popup menu” to a menu bar, or as a branch to another menu.


Methods:

hWnd = :GetParent()    Get parent, be it menu or menu bar.


Add new item to menu.

ItemID = :AddItem(szLabel, [Enabled], [CheckBox], [CheckState])

szLabel: Text label.

Enabled: Optionally enable or disable item (default true for enable). If disabled, text gray and doesn’t issue an event.

CheckBox: Optionally add a check box to the item; bool true to add it.

CheckState: If optional check box enabled, sets the initial check state; bool true/false.

Returns a new item ID code on success.


ItemID = :AddSeparator()    Adds a separator line item to the menu.

:SetItemState(ItemId, Flags)    Set item state flags by ID (see flags below).

Flags:

gui.Menu.ENABLE    Enable item.

gui.Menu.DISABLE    Disable item.

gui.Menu.CHECK    Set checked state.

gui.Menu.UNCHECK    Set unchecked state.


flags = :GetItemState(ItemId)    Get item state flags (see flags below).

Flags:

gui.Menu.ENABLED    Item is enabled.

gui.Menu.DISABLED    Item is disabled.

gui.Menu.CHECKED    Item is checked.

gui.Menu.UNCHECKED    Item is unchecked.


:RemoveItem(ItemID)    Remove item (label or separator) from menu by ID.

:Close() Close menu (killing all sub menus in the process)


Events: gui.EVENT_SELECT (see below).



Tab Control widget:

tabobj = gui.TabControl(window, x,y, width,height, [style], [styleEx])

window: Parent window. Must be a base window or tab page (see below) object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF (see below).

styleEx: Optional extended style flags. Default STYLEX_DEF (see below).


Base methods:

GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetClientSize, GetRect, GetClientRect, Close, GetState, SetState.


Methods:

Add a tab page object to the tab control (see PageWindow below).

pagewinobj, index = tabobj:Add(szLabel, [BkgndColor])

szLabel: The label/title for the page.

BkgndColor: Page window background color.

Returns page window object, and relative page index.


tabobj:Remove(index) Remove a tab page by index.

szLabel = tabobj:Get(index) Get the label/title for a tab page by index.

count = tabobj:PageCount() Returns a count of tab pages in control.

tabobj:SetPage(index) Set visible tab page by index.

index = tabobj:GetPage() Get visible tab page index.


Styles:

gui.TabControl.STYLE_DEF Default, WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb760549%28VS.85%29.aspx

gui.TabControl.TCS_BOTTOM

gui.TabControl.TCS_BUTTONS

gui.TabControl.TCS_FLATBUTTONS

gui.TabControl.TCS_FIXEDWIDTH

gui.TabControl.TCS_FOCUSNEVER

gui.TabControl.TCS_FOCUSONBUTTONDOWN

gui.TabControl.TCS_FORCELABELLEFT

gui.TabControl.TCS_VERTICAL

gui.TabControl.TCS_MULTILINE


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE

gui.Window.WS_BORDER


Extended styles:

gui.TabControl.STYLEX_DEF Default, Nothing.


See: http://msdn.microsoft.com/en-us/library/bb760546%28VS.85%29.aspx

gui.TabControl.TCS_EX_FLATSEPARATORS


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: gui.EVENT_SELECT (see below).



Page Window object:

Tab page window returned by tab control Add() above.

Much like the base window type; to be used as a parent window for widgets (including other tab controls), with the exception it can’t be resized or moved independently.


Base methods:

GetHandle, GetPos, GetSize, GetRect.



Static Text widget:

stxtobj = gui.StaticText(window, szText, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor], [bAutoSize])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color. Default, inherit parent.

bAutoSize: Automatically size window to fit text. Default true.

Note: Before getting the widgets size (via GetSize or GetClientSize) there should be 1ms delay or two to allow the OS to update first; else the returned size might not be correct yet.


Base methods:

GetHandle, GetParent, GetText, SetText, GetPos, SetPos, GetSize, SetSize, GetClientSize, GetRect, GetClientRect, Close, GetState, SetState.


Styles:

gui.StaticText.STYLE_DEF Default, WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb760773%28VS.85%29.aspx

gui.StaticText.SS_LEFTNOWORDWRAP

gui.StaticText.SS_LEFT

gui.StaticText.SS_CENTER

gui.StaticText.SS_RIGHT

gui.StaticText.SS_SIMPLE

gui.StaticText.SS_ENDELLIPSIS

gui.StaticText.SS_WORDELLIPSIS

gui.StaticText.SS_ETCHEDFRAME

gui.StaticText.SS_SUNKEN

gui.StaticText.SS_ETCHEDHORZ

gui.StaticText.SS_ETCHEDVERT

gui.StaticText.SS_BLACKFRAME

gui.StaticText.SS_BLACKRECT

gui.StaticText.SS_GRAYFRAME

gui.StaticText.SS_GRAYRECT

gui.StaticText.SS_WHITEFRAME

gui.StaticText.SS_WHITERECT


gui.Window.WS_VISIBLE


Extended styles:

gui.StaticText.STYLEX_DEF Default, WS_EX_DLGMODALFRAME.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: None.



Group Box widget:

gbxobj = gui.GroupBox(window, szTitle, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color. Default, inherit parent.


Base methods: GetHandle, GetParent, GetText, SetText, GetTitle, SetTitle, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Styles:

gui.GroupBox.STYLE_DEF Default, WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb775951%28VS.85%29.aspx

gui.GroupBox.BS_TOP

gui.GroupBox.BS_BOTTOM

gui.GroupBox.BS_CENTER

gui.GroupBox.BS_LEFT

gui.GroupBox.BS_RIGHT

gui.GroupBox.BS_FLAT

gui.GroupBox.BS_MULTILINE


gui.Window.WS_VISIBLE


Extended styles:

gui.GroupBox.STYLEX_DEF Default, Nothing.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: None.



Push Button widget:

btnobj = gui.PushButton(window, szTitle, x,y, width,height, [style], [styleEx])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.


Base methods: GetHandle, GetParent, GetText, SetText, GetTitle, SetTitle, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Styles:

gui.PushButton.STYLE_DEF Default, WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb775951%28VS.85%29.aspx

gui.PushButton.BS_TOP

gui.PushButton.BS_BOTTOM

gui.PushButton.BS_CENTER

gui.PushButton.BS_LEFT

gui.PushButton.BS_RIGHT

gui.PushButton.BS_FLAT

gui.PushButton.BS_MULTILINE


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE


Extended styles:

gui.PushButton.STYLEX_DEF Default, Nothing.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: gui.EVENT_CLICK (see below)



Check Box widget:

chkboxobj = gui.CheckBox(window, szTitle, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color. Default, inherit parent.


Base methods: GetHandle, GetParent, GetText, SetText, GetTitle, SetTitle, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

chkstate = :GetCheckState()    Get check state (see check state codes below).

:SetCheckState(checkstate)    Set check state by code (see check state codes below).


Styles:

gui.CheckBox.STYLE_DEF    Default, BS_AUTOCHECKBOX, WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb775951%28VS.85%29.aspx

gui.CheckBox.BS_AUTOCHECKBOX

gui.CheckBox.BS_AUTO3STATE

gui.CheckBox.BS_TOP

gui.CheckBox.BS_BOTTOM

gui.CheckBox.BS_CENTER

gui.CheckBox.BS_LEFT

gui.CheckBox.BS_RIGHT

gui.CheckBox.BS_FLAT

gui.CheckBox.BS_MULTILINE

gui.CheckBox.BS_RIGHTBUTTON

gui.CheckBox.BS_PUSHLIKE


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE


Extended styles:

gui.CheckBox.STYLEX_DEF Default, Nothing.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Check states:

See: http://msdn.microsoft.com/en-us/bb775986%28VS.85%29.aspx

gui.CheckBox.BST_CHECKED

gui.CheckBox.BST_UNCHECKED

gui.CheckBox.BST_INDETERMINATE


Events: gui.EVENT_CLICK (see below)



Radio Button widget:

radbtnobj = gui.RadioButton(window, szTitle, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color. Default, inherit parent.


Base methods: GetHandle, GetParent, GetText, SetText, GetTitle, SetTitle, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

chkstate = :GetCheckState()    Get check state (see check state codes below).

:SetCheckState(checkstate)    Set check state by code (see check state codes below).


Styles:

gui.RadioButton.STYLE_DEF Default, WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb775951%28VS.85%29.aspx

gui.RadioButton.BS_TOP

gui.RadioButton.BS_BOTTOM

gui.RadioButton.BS_CENTER

gui.RadioButton.BS_LEFT

gui.RadioButton.BS_RIGHT

gui.RadioButton.BS_FLAT

gui.RadioButton.BS_MULTILINE

gui.RadioButton.BS_RIGHTBUTTON

gui.RadioButton.BS_PUSHLIKE


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE


Extended styles:

gui.RadioButton.STYLEX_DEF Default, Nothing.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Check states:

See: http://msdn.microsoft.com/en-us/bb775986%28VS.85%29.aspx

gui.RadioButton.BST_CHECKED

gui.RadioButton.BST_UNCHECKED

gui.RadioButton.BST_INDETERMINATE


Events: gui.EVENT_CLICK (see below)



Combo Box widget:

cmboxobj = gui.ComboBox(window, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

:Add(szString, [Index])    Add new string entry at the end of the list. Optional index for insert.

:Remove(Index)     Remove string entry by index.

szText = :Get(Index)     Get string entry by index.

table = :GetList()     Get entry list.

count = :Count()     Get entry count.

index = :GetSelection()    Get current selection, or nil if none.

:SetSelection(Index)    Set current selection by index, 0 for none/reset.


Styles:

See: http://msdn.microsoft.com/en-us/library/bb775796%28VS.85%29.aspx

gui.ComboBox.STYLE_DEF Default (WS_VISIBLE, CBS_DROPDOWNLIST).


gui.ComboBox.CBS_SORT

gui.ComboBox.CBS_AUTOHSCROLL

gui.ComboBox.CBS_DISABLENOSCROLL

gui.ComboBox.CBS_UPPERCASE

gui.ComboBox.CBS_LOWERCASE

gui.ComboBox.CBS_NOINTEGRALHEIGHT

gui.ComboBox.CBS_SIMPLE

gui.ComboBox.CBS_DROPDOWNLIST


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE


Extended styles:

gui.ComboBox.STYLEX_DEF Default, Nothing.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: gui.EVENT_SELECT (see below)



List Box widget:

lstbxobj = gui.ListBox(window, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

:Add(szString, [Index])     Add new string entry at the end of the list. Optional index for insert.

:Remove(Index)     Remove string entry by index.

szText = :Get(Index)     Get string entry by index.

table = :GetList()     Get entry list.

count = :Count()     Get entry count.

table = :GetSelection()     Get current selection index list table, or nil if none.

:SetSelection(Index..)     Set current selection by index(es), 0 for none/reset.


Styles:

gui.ListBox.STYLE_DEF Default (WS_VISIBLE, LBS_STANDARD).


See: http://msdn.microsoft.com/en-us/library/bb775149%28VS.85%29.aspx

gui.ListBox.LBS_DISABLENOSCROLL

gui.ListBox.LBS_EXTENDEDSEL

gui.ListBox.LBS_MULTIPLESEL

gui.ListBox.LBS_NOSEL

gui.ListBox.LBS_SORT

gui.ListBox.LBS_STANDARD

gui.ListBox.LBS_NOINTEGRALHEIGHT

gui.ListBox.LBS_USETABSTOPS


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE

gui.Window.WS_BORDER


Extended styles:

gui.ListBox.STYLEX_DEF Default WS_EX_STATICEDGE.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: gui.EVENT_SELECT (see below)



List View widget:

lstvwobj = gui.ListView(window, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

column = :AddColumn(szLabel, [width])    Add a column with string label; optional pixel width, else automatic

width by default. Returns new column index on success.

:SetColumnWidth(column, [width])    Set a column pixel width, or none to switch to automatic.

row, column = :AddItem(column, szLabel)    Add item (string entry) to a column.

:SetItem(column, row, szLabel)    Set an item by column and row.

szLabel = :Get(column, row)     Get an item by column and row.

:SetCheckState(row, bState)     bool set check state for row.

bState = :GetCheckState(row)     bool get check state for row.

table = :GetSelected()     Get table of selected row(s) or nil if none.

count = :GetRowCount()    Get count of rows in control.

:DeleteAllItems()    Delete all items (doesn’t effect columns).


Styles:

gui.ListView.STYLE_DEF    Default WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb774739%28VS.85%29.aspx

gui.ListView.LVS_NOCOLUMNHEADER

gui.ListView.LVS_SHOWSELALWAYS

gui.ListView.LVS_SINGLESEL

gui.ListView.LVS_SORTASCENDING

gui.ListView.LVS_SORTDESCENDING

gui.ListView.LVS_NOSCROLL


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE

gui.Window.WS_BORDER

gui.Window.WS_HSCROLL

gui.Window.WS_VSCROLL


Extended styles:

gui.ListBox.STYLEX_DEF Default (LVS_EX_GRIDLINES, LVS_EX_FULLROWSELECT).


See: http://msdn.microsoft.com/en-us/library/bb774732%28VS.85%29.aspx

gui.ListBox.LVS_EX_CHECKBOXES

gui.ListBox.LVS_EX_FLATSB

gui.ListBox.LVS_EX_FULLROWSELECT

gui.ListBox.LVS_EX_GRIDLINES

gui.ListBox.LVS_EX_TRACKSELECT

gui.ListBox.LVS_EX_TWOCLICKACTIVATE

gui.ListBox.LVS_EX_UNDERLINECOLD

gui.ListBox.LVS_EX_UNDERLINEHOT


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: gui.EVENT_SELECT (see below)



Edit Box widget:

editboxobj = gui.EditBox(window, szText, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

szText: Initial text.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect, GetText, SetText.


Methods:

:AddText(szText)     Append box text.

:SetReadOnly([bEnable])     Set to read only true (default), or false. Text can be read, but not edited by user.

bReadonly = :GetReadOnly()    Returns true if set for read only.

:SetTextLimit(CharLimit)    Sets text character limit. User is blocked from entering more characters then this limit.

linecount = : GetLineCount()    Return count of text lines.

charcount = :GetCharCount()    Return count of total text characters.


Styles:

gui.EditBox.STYLE_DEF Default (WS_VISIBLE, WS_BORDER, ES_AUTOVSCROLL, ES_WANTRETURN, ES_MULTILINE).

gui.EditBox.STYLE_SPINNER    Default style typically used with spinner widget (see below); (WS_VISIBLE, WS_BORDER, ES_NUMBER).


See: http://msdn.microsoft.com/en-us/library/bb775464%28VS.85%29.aspx

gui.EditBox.ES_MULTILINE

gui.EditBox.ES_WANTRETURN

gui.EditBox.ES_LEFT

gui.EditBox.ES_CENTER

gui.EditBox.ES_RIGHT

gui.EditBox.ES_LOWERCASE

gui.EditBox.ES_UPPERCASE

gui.EditBox.ES_AUTOHSCROLL

gui.EditBox.ES_AUTOVSCROLL

gui.EditBox.ES_NUMBER

gui.EditBox.ES_NOHIDESEL

gui.EditBox.ES_READONLY

gui.EditBox.ES_PASSWORD

gui.EditBox.ES_OEMCONVERT


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE

gui.Window.WS_BORDER

gui.Window.WS_HSCROLL

gui.Window.WS_VSCROLL


Extended styles:

gui.EditBox.STYLEX_DEF    Default WS_EX_STATICEDGE.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: gui.EVENT_CHANGE (see below)



Number Spinner Edit box add-on widget:

spinnerobj = gui.Spinner(EditBoxObj, x,y, width,height, MinRange, MaxRange, StartValue, [Radix], [style], [styleEx])

EditBoxObj: Edit box parent widget.

x, y: Position.

width, height: Size.

MinRange: Optional signed value lower limit.

MaxRange: Optional signed value upper limit.

StartValue: Optional starting value.

Radix: Optional number radix. This parameter can be 10 for decimal or 16 for hexadecimal.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

number = :GetSpinnerPos()    Get spinner position.


Styles:

gui.Spinner.STYLE_DEF Default style.


See: http://msdn.microsoft.com/en-us/library/bb759885%28VS.85%29.aspx

gui.Spinner.UDS_ALIGNLEFT

gui.Spinner.UDS_ALIGNRIGHT

gui.Spinner.UDS_ARROWKEYS

gui.Spinner.UDS_HORZ

gui.Spinner.UDS_HOTTRACK

gui.Spinner.UDS_NOTHOUSANDS

gui.Spinner.UDS_SETBUDDYINT


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE

gui.Window.WS_BORDER


Extended styles:

gui.Spinner.STYLEX_DEF Default style.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: Through edit widget only, via gui.EVENT_CHANGE (see below)



Static Image widget:

stcimgobj = gui.StaticImage(window, x,y, width,height, [Filename], [style], [styleEx])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

Filename: Optional image file name. Currently only BMP format supported.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

bResult = :Load(Filename)    Load an image into the control. Currently only BMP format supported.


Styles:

gui.StaticImage.STYLE_DEF Default (WS_VISIBLE, SS_GRAYFRAME, SS_REALSIZECONTROL).


gui.StaticImage.SS_REALSIZECONTROL

gui.StaticImage.SS_CENTERIMAGE

gui.StaticImage.SS_SUNKEN


Extended styles:

gui.StaticImage.STYLEX_DEF Default, None.


Events: None.



Progress Bar widget:

prgbarobj = gui.ProgressBar(window, x,y, width,height, [style], [styleEx], [ForegroundColor], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

ForegroundColor: Optional text foreground color.

BackgroundColor: Optional background color.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

:SetBarPos(percentage)    Set bar position percentage (fractional, 0 to 100).

percentage = :GetBarPos()    Get bar position percent (0 to 100).

:SetColor(f, [b])    Set foreground and optionally background color.


Styles:

gui.ProgressBar.STYLE_DEF    Default (WS_VISIBLE, WS_BORDER).


See: http://msdn.microsoft.com/en-us/library/bb760820%28VS.85%29.aspx

gui.ProgressBar.PBS_SMOOTH

gui.ProgressBar.PBS_VERTICAL


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE

gui.Window.WS_BORDER


Extended styles:

gui.ProgressBar.STYLEX_DEF    Default, none.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: None.



Status Bar widget:

stsbarobj = gui.StatusBar(window, [PartsTable], [style], [styleEx], [BackgroundColor])

window: Parent window; must be a base window.

PartsTable: Table that defines the pixel width parts/sections that make up the status bar. Default, one part.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

BackgroundColor: Optional background color.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

:SetText(szText, [part])     Get set text for part by index, default part/section one.

szText = :GetText([part])    Get part text by part index, default part one.

count = :PartsCount()     Get count of parts in the bar.


Styles:

gui.StatusBar.STYLE_DEF    Default style, WS_VISIBLE.


See: http://msdn.microsoft.com/en-us/library/bb760730%28VS.85%29.aspx

gui.StatusBar.SBARS_SIZEGRIP    Add a size grip to the bar (for resizing window).


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE

gui.Window.WS_BORDER


Extended styles:

gui.StatusBar.STYLEX_DEF    Default, WS_EX_DLGMODALFRAME.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: None.



Track Bar widget:

trckbarobj = gui.Trackbar(window, x,y, width,height, [MinRange], [MaxRange], [TickFreq], [SliderSize], [style], [styleEx], [BackgroundColor])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

MinRange: Optional minimum logical position for the slider. Default 0.

MaxRange: Optional maximum logical position for the slider. Default 9.

TickFreq: Optional interval frequency for tick marks graphics.

SliderSize: Optional length of the slider.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

BackgroundColor: Optional background color, default parent window’s background.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

position = :GetSliderPos()    Get slider position.

:SetSliderPos(position)     Set slider position.

:SetMoveIncrements(arrowkeys, pagekeys)    Set arrow and page key increments (default is one for both). Must be with

in the range of MinRange and MaxRange.

minrange, maxrange = : GetRange()    Get min and max logical position for the slider.

:EnableTrackMode([bEnable])     Enable or disable tack mode bool true or false. Default true.

If enabled, a EVENT_CHANGE (see below) event is sent on any change in

position. Else if disabled (creation default) the event is only issued on slider on

release.

Styles:

gui.Trackbar.STYLE_DEF    Default style, (WS_VISIBLE, TBS_AUTOTICKS, WS_BORDER).


See: http://msdn.microsoft.com/en-us/library/bb760147%28VS.85%29.aspx

gui.Trackbar.TBS_NOTICKS

gui.Trackbar.TBS_AUTOTICKS

gui.Trackbar.TBS_HORZ

gui.Trackbar.TBS_VERT

gui.Trackbar.TBS_TOP

gui.Trackbar.TBS_BOTTOM

gui.Trackbar.TBS_LEFT

gui.Trackbar.TBS_RIGHT

gui.Trackbar.TBS_BOTH

gui.Trackbar.TBS_NOTICKS


gui.Window.WS_GROUP

gui.Window.WS_TABSTOP

gui.Window.WS_VISIBLE


Extended styles:

gui.Trackbar.STYLEX_DEF    Default, none.


gui.Window.WS_EX_DLGMODALFRAME

gui.Window.WS_EX_CLIENTEDGE

gui.Window.WS_EX_STATICEDGE


Events: gui.EVENT_CHANGE (see below).



Hypertext link widget:

syslnkobj = gui.SysLink(window, szCaption, [szLinkText], x,y, width,height, [style], [styleEx], [BackgroundColor], [TextColor], [VisitedColor], [HighlightColor])

window: Parent window. Must be a base window or tab page object.

szCaption: Caption text.

szLinkText: Optional link text. If nil then same as caption text.

x, y: Position.

width, height: Size.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.

BackgroundColor: Optional background color.

TextColor: Optional normal text color.

VisitedColor: Optional link visited text color.

HighlightColor: Optional text highlight/active color.


When link is clicked, it is activated via OS calls.

Caution: This is a potentially a dangerous widget. A user could construct a link to go to a malicious web site, or do a malicious OS action. Use caution with untrusted scripts that use this GUI widget, and be sure the tooltip text (the actual link text) matches what the caption says, etc.


Base methods: GetHandle, GetParent, GetText, SetText, GetTitle, SetTitle, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

:SetLinkText(szLinkText)    Set link text string. The SetText/SetTitle method sets the caption text.


Styles:

gui.SysLink.STYLE_DEF Default style.


Extended styles:

gui.SysLink.STYLEX_DEF Default extended style.


Events: None.



:IP Address entry Box:

ipadrsbxobj = gui.IPAddressBox(window, x,y, width,height, [szAddress], [style], [styleEx])

window: Parent window. Must be a base window or tab page object.

x, y: Position.

width, height: Size.

szAddress: Optional initial IP address string.

style: Optional style flags. Default STYLE_DEF.

styleEx: Optional extended style flags. Default STYLEX_DEF.


Base methods: GetHandle, GetParent, GetPos, SetPos, GetSize, SetSize, GetRect, GetState, SetState, Close, GetClientSize, GetClientRect.


Methods:

:SetAddress(szAddress)     Set IP address by string.

szAddress = :GetAddress()    Get IP address string.


Styles:

gui.IPAddressBox.STYLE_DEF Default style.


Extended styles:

gui.IPAddressBox.STYLEX_DEF Default extended style.


Events: gui.EVENT_CHANGE (see below).



Menu Bar widget:

menubarobj = gui.MenuBar(window, [BackgroundColor])

window: Parent window. Must be a base window.

BackgroundColor: Optional background color.


The menu bar is the plain parent object for a menu widget hierarchy (see following widget).


Methods:

:GetParent()    Get parent window handle.

:Close()    Close menu bar, along with all sub-menu widgets (see following widget).


Events: None.



GUI Events:

Events notify that something has changed in a window or widget.

Used to convey user input actions, etc.


Poll all queued window object events:

table = gui.PollEvents()


Warning: The internal GUI queue has only space for 500 events. After that it will wrap around (bypassing close events first). The events should be polled at least once every few seconds at a minimum to avoid overflow. Ideally they should be polled at around 0.100 seconds for a sharp, responsive GUI.


Base event entry:

.Event = Event code (see below)

.Timestamp = Timestamp when the event happened.

.Object = Window object.


Events:

gui.EVENT_SIZE    A base window size changed, restored, minimized, or maximized notification.

.Code = Size type code (see codes above. I.E. gui.Window.SIZE_RESTORED).

.Width = New width of window.

.Height = New height of window.


gui.EVENT_MOVE    A base window position moved notification.

.x,.y = New window position


gui.EVENT_FOCUS    A base window has gone in or out of focus.

.InFocus = bool, true if now in focus.


gui.EVENT_CLOSED    A base window close notification.

If the base window has the gui.Window.NOUSERCLOSE style set, this notification indicates the attempted close of the window.


gui.EVENT_CHANGE    Change notification.

Widgets that send this event:

EditBox: On text change.

Trackbar: On position change.

IPAddressBox: On address/entry change.


gui.EVENT_CLICK    Click/press notification.

PushButton: Click/pressed.

RadioButton: Click/pressed.


CheckBox: State changed (from click).

.CheckState = Check code (see above).


ListView: Check state changed from click).

.Checked = bool, true or false.

.Selection = Row selection index


TreeView:

.Checked = bool, true or false.

.ItemID = Tree item ID.


gui.EVENT_SELECT    Selection notification.

ComboBox: Combo line selected.

.Selection = Selection index.


ListBox: List line selected.

.Selection = Selection index.


Menu: Menu item selected.

.ItemID = Menu item ID.

.Checked = bool, true or false, if check enabled.

.ParentObject = Parent window object.


TabControl: Tab page select.

.Page = Page index.


TreeView: Item select.

.ItemID = Tree item ID.


ListView: Item select.

.Selection = Row selection index.