Skip to content

GUI


Members

BackgroundCtrls

desc: An array of controls that should be lowered below all newly added controls and which have the style WS_CLIPSIBLINGS applied. To register a background control see GridGUI.GUI.RegisterBackground.

type: array

default: []

meta: [object]

link: link

DPIScale

desc: Whether or not to correct for non standard dpi.

type: bool

default: true

link: link

DropTarges

desc: An object of hwnds mapping to callbacks that will be call on WM_DROPFILES if the event was on a control with the corresponding hwnd. To register a callback see GridGUI.GUI.RegisterDropTarget.

type: object

default: {}

meta: [object]

ForegroundCtrls

desc: An array of controls that should be raised above all newly added controls and which are redrawn after other controls have been drawn. To register a foreground control see GridGUI.GUI.RegisterForeground.

type: array

default: []

meta: [object]

GuiActivate

desc: The callback that will be called on WM_ACTIVATE.

type: Func|BoundFunc|false

default: false

meta: [object]

link: link

GuiClose

desc: The callback that will be called on WM_SYSCOMMAND if wParam equals SC_CLOSE.

type: Func|BoundFunc|false

default: false

meta: [object]

link: link

GuiContextMenu

desc: The callback that will be called on WM_CONTEXTMENU.

type: Func|BoundFunc|false

default: false

meta: [object]

link: link

GuiMoved

desc: The callback that will be called on WM_MOVE.

type: Func|BoundFunc|false

default: false

meta: [object]

link: link

GuiMovedDelay

desc: The delay to wait before the user defined callback GridGUI.GUI.GuiMoved will be called. A delay of 0 will make the callback be called directly in the OnMessage callback function and a delay above 0 will be triggered using a timer.

type: number

default: 50

GuiSize

desc: The callback that will be called on WM_SIZE.

type: Func|BoundFunc|false

default: false

meta: [object]

link: link

GuiSizeDelay

desc: The delay to wait before the user defined callback GridGUI.GUI.GuiSize will be called. A delay of 0 will make the callback be called directly in the OnMessage callback function and a delay above 0 will be triggered using a timer.

type: number

default: 50

OnPaintDelay

desc: The delay to wait before the callback that redraws the controls in GridGUI.GUI.ForegroundCtrls will be called. A delay of 0 will make the callback be called directly in the OnMessage callback function and a delay above 0 will be triggered using a timer.

type: number

default: 10

pos

desc: The position of this GUI.

type: GridGUI.Position

default: GridGUI.Position(0, 0)

meta: [object]

Methods

__CheckOptions

__CheckOptions(options)

Parses option strings for values that are used by the class and updated the instance based on the values.

parameters

name: options

desc: An ahk GUI option string.

type: string

link: link

return value

desc: The options argument minus anything that class handles, currently only gLabels are removed.

type: string

__DPIScale

__DPIScale(pos, enlarge := true)

Scale a position by the dpi ratio, that is A_ScreenDPI / 96.

parameters

name: pos

desc: The GridGUI.Position instance to scale.

type: GridGUI.Position

name: enlarge

desc: Whether to increase or decrease the size of pos.

type: bool

default: true

return value

desc: The scaled position.

type: GridGUI.Position

__GuiActivate

__GuiActivate(wParam, lParam, msg, hwnd)

The internal callback on WM_ACTIVATE that calls the user defined GridGUI.GUI.GuiActivate if it evaluates to true. The callback is called with the low-order word of wParam.

parameters

name: wParam

desc: Low-order word is the active state of the changed window, the high-order word is whether the window was minimised. If the low-order word is 1 the window was activated, if it is 2 the window was activated by a mouse click and if it is 0 the window is deactivated.

type: number

link: link

name: lParam

desc: The hwnd of the window where the active state of the window changed.

type: number

link: link

name: msg

desc: WM_ACTIVATE (0x0006).

type: number

name: hwnd

desc: The hwnd of the window or control that recieved the message.

type: hwnd

__GuiContextMenu

__GuiContextMenu(wParam, lParam, msg, hwnd)

The internal callback on WM_CONTEXTMENU that calls the user defined GridGUI.GUI.GuiContextMenu if it evaluates to true. The callback is called with the clicked coordinate as a GridGUI.Position and with the hwnd of the windows that was right-clicked.

parameters

name: wParam

desc: The hwnd of the windows that was right-clicked.

type: hwnd

link: link

name: lParam

desc: The clicked coordinate. The low-order word is the x coordinate. The high-order word is the y coordinate.

type: number

link: link

name: msg

desc: WM_CONTEXTMENU (0x007B).

type: number

name: hwnd

desc: The hwnd of the window or control that recieved the message.

type: hwnd

__GuiDropFiles

__GuiDropFiles(hDrop, lParam, msg, hwnd)

The internal callback on WM_DROPFILES that calls the user defined GridGUI.GUI.DropTarges if the callback associated array has the hwnd argument as one of its key. The callback is called with an array of the dropped files.

parameters

name: hDrop

desc: A handle to an internal structure describing the dropped files.

type: number

link: link

name: lParam

desc: Always zero.

type: number

link: link

name: msg

desc: WM_DROPFILES (0x0233).

type: number

name: hwnd

desc: The hwnd of the window or control that recieved the message.

type: hwnd

__GuiInit

__GuiInit()

Initialises all the members of the GUI class.

__GuiMoved

__GuiMoved(wParam, lParam, msg, hwnd)

The internal callback on WM_MOVE that calls GridGUI.GUI._GuiMoved with the new location as a GridGUI.Position.

parameters

name: wParam

desc: Unused.

type: number

link: link

name: lParam

desc: The coordinate of the top left corner of the window. The low-order word is the x coordinate and the high-order word is the y coordinate.

type: number

link: link

name: msg

desc: WM_MOVE (0x0003).

type: number

name: hwnd

desc: The hwnd of the window or control that recieved the message.

type: hwnd

__GuiSize

__GuiSize(wParam, lParam, msg, hwnd)

The internal callback on WM_SIZE that calls GridGUI.GUI._GuiSize with the new area as a GridGUI.Position where x and y are both zero and with the wParam argument.

parameters

name: wParam

desc: The type of resizing that have occurred. 0 is normal resizing, 1 means that the window was minimised and 2 means that it was maximised.

type: number

link: link

name: lParam

desc: The new area of the window. The low-order word is the width and the high-order word is the height.

type: number

link: link

name: msg

desc: WM_SIZE (0x0005).

type: number

name: hwnd

desc: The hwnd of the window or control that recieved the message.

type: hwnd

__LowerBackgoundCtrls

__LowerBackgoundCtrls()

Lowers the z-order of all registered controls in GridGUI.GUI.BackgroundCtrls. To register controls as background controls see GridGUI.GUI.RegisterBackground.

__New

__New(title := "", options := "", hwnd := "")

Constructor.

parameters

name: title

desc: The title of the newly created GUI.

type: string

default: ""

name: options

desc: The gui option string that the GUI will be created with.

type: string

default: ""

link: link

name: hwnd

desc: If specified then no new GUI will be created and no OnMessage callbacks will be set up. Instead the GridGUI.GUI instance will work like a wrapper for the GUI that can be used to interact with it.

type: string

default: ""

return value

desc: A new GridGUI.GUI instance.

type: GridGUI.GUI

__OnAdd

__OnAdd()

Updates the z-order of registered controls. Called when a control is added to the GUI.

__OnPaint

__OnPaint(wParam, lParam, msg, hwnd)

The internal callback on WM_PAINT that calls GridGUI.GUI.__ReDrawForgoundCtrls to fix issues with overlapping controls for controls registered in GridGUI.GUI.ForegroundCtrls.

parameters

name: wParam

desc: Unused.

type: number

link: link

name: lParam

desc: Unused.

type: number

link: link

name: msg

desc: WM_PAINT (0x000F).

type: number

name: hwnd

desc: The hwnd of the window or control that recieved the message.

type: hwnd

__RaiseForgoundCtrls

__RaiseForgoundCtrls()

Raises the z-order of all registered controls in GridGUI.GUI.ForegroundCtrls. To register controls as background controls see GridGUI.GUI.RegisterForeground.

__ReDrawForgoundCtrls

__ReDrawForgoundCtrls()

Redraws the controls registered with GridGUI.GUI.RegisterForeground. Called on WM_PAINT.

__SysCommand

__SysCommand(wParam, lParam, msg, hwnd)

The internal callback on WM_SYSCOMMAND that calls the user defined GridGUI.GUI.GuiClose callback on SC_CLOSE if the callback variable evaluates to true.

parameters

name: wParam

desc: The type of system command requested, see link for a list of values.

type: number

link: link

name: lParam

desc: The coordinate of the mouse, if this message was triggered by a menu selection, otherwise the argument is unused. The low-order word is the x coordinate and the high-order word is the y coordinate.

type: number

link: link

name: msg

desc: WM_SYSCOMMAND (0x0112).

type: number

name: hwnd

desc: The hwnd of the window or control that recieved the message.

type: hwnd

_GuiMoved

_GuiMoved(pos)

An internal callback used to update the x and y coordinate of GridGUI.GUI.pos and to call the user defined GridGUI.GUI.GuiMoved callback

parameters

name: pos

desc: The new coordinate of the top left corner of the GUI. The width and height are both zero.

type: GridGUI.Position

_GuiSize

_GuiSize(pos, resizeEvent)

An internal callback used to update the width and height of GridGUI.GUI.pos and to call the user defined GridGUI.GUI.GuiSize callback

parameters

name: pos

desc: The new area of the GUI. The x and y coordinate are both zero.

type: GridGUI.Position

name: resizeEvent

desc: A number indicating whether the GUI was maximised, minimised or neither that is passed on to the user defined GridGUI.GUI.GuiSize callback. See the link for what the numbers mean.

type: number

link: link

Add

Add(controlType, options := "", text := "")

Adds most standard ahk controls to the GUI.

parameters

name: controlType

desc: The type of the control. Can be Text, Edit, UpDown, Picture, Button, Checkbox, DropDownList, ComboBox, ListBox, Link, Hotkey, DateTime, MonthCal, Slider, Progress, GroupBox and ActiveX. For Radio, ListView, TreeView, Tab3 and StatusBar see AdditionalControls

type: string

name: options

desc: The options that the GuiControl will be created with. Does not accept vVars. Can be an object with keys the same names as the optional arguments that this method takes.

type: string

default: ""

link: link

name: text

desc: The text that the control will be created with.

type: string

default: ""

return value

desc: The added control instance.

type: GridGUI.ArbitraryControl

Color

Color(WindowColor := "", ControlColor := "")

A thin method wrapper for Gui, Color.

parameters

name: WindowColor

desc: The colour of the background of the GUI. See link for the supported format.

type: string

default: ""

link: link

name: ControlColor

desc: The colour of the background of controls that are added to the GUI in the future. See link for the supported format.

type: string

default: ""

link: link

link: link

ControlGetFocus

ControlGetFocus()

Retrives the hwnd of the control with input focus.

return value

desc: The hwnd of the focused control.

type: hwnd

Default

Default()

A thin method wrapper for Gui, Default.

link: link

Destroy

Destroy()

A thin method wrapper for Gui, Destroy.

link: link

Flash

Flash(Off := false)

A thin method wrapper for Gui, Flash, except that it used a bool instead of a string to indicate that the colour should be restored.

parameters

name: Off

desc: If false the GUI flashes. If true the colour of the GUI is restored.

type: bool

default: false

link: link

Font

Font(Options, FontName)

A thin method wrapper for Gui, Font

parameters

name: Options

desc: Styling option string, see link for detail of what options are available.

type: string

link: link

name: FontName

desc: The name of the font to apply.

type: string

link: link

link: link

Hide

Hide()

A thin method wrapper for Gui, Hide

link: link

ListView

ListView(hwnd)

Changes the default ListView to the specified hwnd. See the link for what changing the default ListView does.

parameters

name: hwnd

desc: The hwnd of the ListView to set as the default.

type: hwnd

return value

desc: The hwnd of the ListView that was previously the default.

type: hwnd

link: link

Margin

Margin(x := "", y := "")

A thin method wrapper for Gui, Margin

parameters

name: x

desc: The horizontal margin of controls that are added to the GUI.

type: string

default: ""

name: y

desc: The vertical margin of controls that are added to the GUI.

type: string

default: ""

link: link

Maximize

Maximize()

A thin method wrapper for Gui, Maximize

link: link

Menu(MenuName := "")

A thin method wrapper for Gui, Menu

parameters

name: MenuName

desc: The name of the menu to attach to the GUI menu bar. Menues are made using the Menu command, see link for details.

type: string

default: ""

link: link

link: link

Minimize

Minimize()

A thin method wrapper for Gui, Minimize

link: link

MinSize

MinSize(x := "", y := "")

Sets the minsize of the GUI, that is the size that the GUI can't be reduced beyond by drag resizing.

parameters

name: x

desc: The minimal width of the GUI. If "" the min width is left unchanged.

type: string

default: ""

name: y

desc: The minimal height of the GUI. If "" the min height is left unchanged.

type: string

default: ""

Options

Options(options)

Applies styles and options to the GUI.

parameters

name: options

desc: The ahk GUI style and option string to apply to the GUI. See link for supported styles and options.

type: string

link: link

link: link

RegisterBackground

RegisterBackground(ctrl)

Registers a control as a background control, that is their z-order is lowered below any current and future controls.

parameters

name: ctrl

desc: The GridGUI.GuiControlClass instance that will be registered.

type: GridGUI.GuiControlClass

RegisterDropTarget

RegisterDropTarget(ctrl, Callback)

Registers a control as a file drag and drop target. Any registered control will have its callback called whenever files are dropped on the control.

parameters

name: ctrl

desc: The GridGUI.ControlClass instance that will be registered.

type: GridGUI.ControlClass

name: Callback

desc: The callback to call when files are dropped on the control.

type: Func|BoundFunc

RegisterForeground

RegisterForeground(ctrl)

Registers a control to be redrawn after all other controls as well as their z-order is raised above any current and future controls.

parameters

name: ctrl

desc: The GridGUI.GuiControlClass instance that will be registered.

type: GridGUI.GuiControlClass

Restore

Restore()

A thin method wrapper for Gui, Restore

link: link

Show

Show(options := AutoSize)

A thin method wrapper for Gui, Show

parameters

name: options

desc: The options string describing how to show the GUI. See link for available options.

type: string

default: AutoSize

link: link

link: link

Submit

Submit(NoHide := false)

A thin method wrapper for Gui, Submit

parameters

name: NoHide

desc: Whether or not to hide the GUI after submitting it.

type: bool

default: false

link: link

TreeView

TreeView(hwnd)

Changes the default TreeView to the specified hwnd. See the link for what changing the default TreeView does.

parameters

name: hwnd

desc: The hwnd of the TreeView to set as the default.

type: hwnd

return value

desc: The hwnd of the TreeView that was previously the default.

type: hwnd

link: link

Back to top