GridGUIClass
Members
grid
gridlines
desc: The container for the horizontal and vertical grid line controls shown when GridGUI.GridGUIClass.showGrid
is true.
type: array
default: [[], []]
meta: [object]
link: link
margins
desc: The additional space that is added around controls that are added to the grid.
type: object
default: {x: 5, y: 5}
meta: [object]
showGrid
desc: Used to remember what parameter the GridGUI.GridGUIClass
instance was created with and to decide whether or not to move the debug grid when drawn.
type: bool
meta: [const]
Methods
__DrawGrid
__DrawGrid(area)
Moves the debug grid line controls to the appropriate locations.
parameters
__Init
__Init(showGrid)
Initialises the class members.
parameters
name: showGrid
desc: Whether or not to show a grid for the control that where placed on the gui before it was shown the first time.
type: bool
__New
__New(title := "", options := "", showGrid := false, justify := false)
Constructor.
parameters
name: title
desc: The title that the new gui window will have
type: string
default: ""
name: options
desc: The ahk gui options that the window will be created with
type: string
default: ""
link: link
name: showGrid
desc: Whether or not to show a grid for the control that where placed on the gui before it was shown the first time.
type: bool
default: false
name: justify
desc: The position of the controls with in the grid, can be any combination of C
(Center), N
(North), S
(South), W
(West) and E
(East).
type: string|false
default: false
return value
desc: Returns a new instance of GridGUI.GridGUIClass
type: GridGUI.GridGUIClass
__TranslateGridPos
__TranslateGridPos(x, y)
Transforms the cordinate syntax used when adding controls to a grid area
parameters
name: x
desc: The Columns that the cell spans over. When more than one column is wanted separate the start and end columns with a hyphen, e.g. "2-5".
type: string|number
name: y
desc: The Rows that the cell spans over. When more than one row is wanted separate the start and end rows with a hyphen, e.g. "2-5".
type: string|number
return value
desc: Returns the translated position as a point with a width and a height.
type: GridGUI.Position
_GuiMoved
_GuiMoved(pos)
A callback called when the gui was moved that calls the GridGUI.GUI._GuiMoved
and shows a debug tooltip with the position if GridGUI.GridGUIClass.showGrid
is true.
parameters
name: pos
desc: The new position, only containing coordinate of the top right corner.
type: GridGUI.Position
_GuiSize
_GuiSize(pos)
A callback called when the gui was resized, that calls the GridGUI.GridGUIClass.Draw
method, GridGUI.GUI._GuiSize
and draws the debug grid if GridGUI.GridGUIClass.showGrid
is true.
parameters
name: pos
desc: The new area, only containing width and height of the gui, that is x and y is both zero.
type: GridGUI.Position
Add
Add(x, y, type, options := "", text := "", exW := 0, exH := 0, fillW := false, fillH := false, justify := "C")
Adds a new cell with any of the standard controls to the grid and gui.
parameters
name: x
desc: The Columns that the cell spans over. When more than one column is wanted separate the start and end columns with a hyphen, e.g. "2-5".
type: string|number
name: y
desc: The Rows that the cell spans over. When more than one row is wanted separate the start and end rows with a hyphen, e.g. "2-5".
type: string|number
name: type
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: ""
name: exW
desc: How much of the excess width the cell should take up relative to the other width expanding cells. Can be an object with keys the same names as the optional arguments that this method takes.
type: number
default: 0
name: exH
desc: How much of the excess height the cell should take up relative to the other height expanding cells.
type: number
default: 0
name: fillW
desc: Whether or not the control should fill the width of the cell.
type: bool
default: false
name: fillH
desc: Whether or not the control should fill the height of the cell.
type: bool
default: false
name: justify
desc: The position of the control with in the cell, can be any combination of C
(Center), N
(North), S
(South), W
(West) and E
(East).
type: string
default: "C"
return value
desc: Returns the added control
type: GridGUI.ArbitraryControl
AddControl
AddControl(x, y, ctrl, exW := 0, exH := 0, fillW := false, fillH := false, justify := "C")
Adds a new cell to the grid and sets the cells control to the supplied control class instance.
parameters
name: x
desc: The Columns that the cell spans over. When more than one column is wanted separate the start and end columns with a hyphen, e.g. "2-5".
type: string|number
name: y
desc: The Rows that the cell spans over. When more than one row is wanted separate the start and end rows with a hyphen, e.g. "2-5".
type: string|number
name: exW
desc: How much of the excess width the cell should take up relative to the other width expanding cells. Can be an object with keys the same names as the optional arguments that this method takes.
type: number
default: 0
name: exH
desc: How much of the excess height the cell should take up relative to the other height expanding cells.
type: number
default: 0
name: fillW
desc: Whether or not the control should fill the width of the cell.
type: bool
default: false
name: fillH
desc: Whether or not the control should fill the height of the cell.
type: bool
default: false
name: justify
desc: The position of the control with in the cell, can be any combination of C
(Center), N
(North), S
(South), W
(West) and E
(East).
type: string
default: "C"
return value
desc: Returns the control that the method was called with.
type: GridGUI.GuiControlClass
AutoSize
AutoSize()
Calculates the minimum size required to show all the controls in the grid and sets the GridGUI.GUI.pos
to the calculated width and height, as well as updates the controls in the grid to their positions. Can be used to reduce the number of controls that a noticeable misplaced when the gui is drawn the first time if called before calling GridGUI.GridGUIClass.Show
.
Draw
Draw(pos)
Calculates the new positions of the controls in the grid based on the settings of their GridGUI.Cell
and moved them to their new positions.
parameters
name: pos
desc: The area the controls will be put into and sized to fit if GridGUI.Cell.exW
, GridGUI.Cell.exH
, GridGUI.Cell.fillW
or GridGUI.Cell.fillH
of the cell that the control occupies are set.
type: GridGUI.Position
GetCellGroup
GetCellGroup(Ctrl)
Retrieve a GridGUI.Cell
by its associated control.
parameters
return value
desc: Returns the found GridGUI.Cell
type: GridGUI.Cell
GetCellGroupsAt
GetCellGroupsAt(GridPos)
Retrieve the array of GridGUI.Cell
s that are in a grid position.
parameters
name: GridPos
desc: The grid position where the GridGUI.Cell
s are retrieved from.
type: GridGUI.Position
return value
desc: returns the array of GridGUI.Cell
s at GridPos
type: object
GetNewestCellGroup
GetNewestCellGroup()
Retrieves the most recently added GridGUI.Cell
.
return value
desc: Retruns the most recent GridGUI.Cell
.
type: GridGUI.Cell
Margin
Margin(x := "", y := "")
Sets the GridGUI.GridGUIClass.margins
to the supplied x and y margins and updates all GridGUI.Cell
s in GridGUI.GridGUIClass.grid
to use the new border sizes.
parameters
name: x
desc: The new horizontal margin to use, that is the spacing to the right and left of cells. If set to "" the current value will be left unchanged.
type: number|string
default: ""
name: y
desc: The new vertical margin to use, that is the spacing above and below cells. If set to "" the current value will be left unchanged.
type: number|string
default: ""
ReDraw
ReDraw()
Resets cached calculations and calls GridGUI.GridGUIClass.Draw
with the current positions and size.
RemoveCell
RemoveCell(Cell)
Removes a GridGUI.Cell
and the associated control from the grid and gui.
parameters
RemoveCellByCtrl
RemoveCellByCtrl(Ctrl)
Removes a GridGUI.Cell
with a specific control from the grid.
parameters
RemoveCellByPos
RemoveCellByPos(GridPos, index := 1)
Removes a GridGUI.Cell
in the array of GridGUI.Cell
s at a specific position in the grid, by the array index.
parameters
name: GridPos
desc: The grid position where the GridGUI.Cell
s are retrieved from.
type: GridGUI.Position
name: index
desc: The index to be removed.
type: number
default: 1
Show
Show(options := AutoSize)
Shows that gui by calling GridGUI.GUI.Show
with the given options.
parameters
name: options
desc: The options that is used when calling Gui, Show
.
type: string
default: AutoSize
link: link