The complete page() and window definition syntax is:
ExitCode = m.page(Controls[,Preview])
The function returns an ExitCode of:
drWizardContinue
drWizardNext,
drWizardPrevious,
drWizardClosed or
drWizardError
to reflect the user button press that closed the window. It's a native Lua number.
If Preview is present and TRUE, the page is just shown and callbacks are not executed. This is intended to allow the layout to be tested. When previewing, all hidden controls are shown and a message is shown in the console when a callback would have been made. NIL is returned for any extra results the callbacks would've returned.
The Controls table is used to construct the window and must contain keys as follows (the ()’d text is the data type of the key value):
id(str) |
= |
the id to use in the GXW (so its size and position can be saved/restored), if not given the window title is used. |
|||||||||||||||||||||
title(str) |
= |
the title to use on the window (if not declared a default title of ‘Wizard’ is used) |
|||||||||||||||||||||
name(str) |
= |
sub-title to use on the implied tab '0' (if not declared a default sub-title of ‘Make Selections’ is used), a tab ‘0’ is implied for controls declared outside of a tab structure (see below for a description of tabs) |
|||||||||||||||||||||
hint(str) |
= |
the help to show for the window (if not declared no help button is shown for the window) |
|||||||||||||||||||||
timer(int) |
= |
if >0 create a timer event at this centi-seconds interval. |
|||||||||||||||||||||
showtabs(bool) |
= |
if true the tabs are exposed on a multi-tab window, default is to not show them |
|||||||||||||||||||||
previous(bool) |
= |
if true show a ‘Back’ button (unless noback is asserted, this is implied if more than 1 tab is defined and no button is placed in the 'back' position). |
|||||||||||||||||||||
next(bool) |
= |
if true show a ‘Next’ button (unless nonext is asserted, this is implied if more than 1 tab is defined and no button is placed in the 'next' position). |
|||||||||||||||||||||
finish(bool) |
= |
if true show a finish button (unless nonext is asserted, this is implied if only 0 or 1 tabs are defined and no button is placed in the 'next' position). This is the same as a button control with an implied 'finish' callback and a 'text' property of 'Finish' and a position of 'next'. The implied 'finish' callback closes the window with drWizardNext. |
|||||||||||||||||||||
promptruler(str) |
= |
the default ruler to use for prompts, if not present uses: '-34p.[E].34d.[H]?' (see Ruler format for a description of rulers) |
|||||||||||||||||||||
buttonruler(str) |
= |
the default ruler to use for buttons, if not present uses: 'L10=R!' |
|||||||||||||||||||||
stringruler(str) |
= |
the default ruler to use for strings, if not present uses: 'L$' |
|||||||||||||||||||||
textruler(str) |
= |
the default ruler to use for text controls, if not present uses: '-L10$74=R' |
|||||||||||||||||||||
groupruler(str) |
= |
the default ruler to use for groups, if not present uses: '34=10..L34=R4?' |
|||||||||||||||||||||
nohint1(bool) |
= |
if true do not draw hint line 1 or the hints bounding box (any strings placed in position drPage_HintLine1 are also ignored) |
|||||||||||||||||||||
nohint2(bool) |
= |
if true do not draw hint line 2 or the hints bounding box (any strings placed in position drPage_HintLine2 are also ignored) |
|||||||||||||||||||||
nohints(bool) |
= |
if true it's a shortcut for nohint1=true, nohint2=true |
|||||||||||||||||||||
nonext(bool) |
= |
if true do not draw a 'next' or 'finish' button (any buttons placed in position drPage_Next are also ignored) |
|||||||||||||||||||||
noback(bool) |
= |
if true do not draw a 'back' button (any buttons placed in position drPage_Back are also ignored) |
|||||||||||||||||||||
noclose(bool) |
= |
if true do not draw the default 'close' button (you can still place your own button in position drPage_Close) |
|||||||||||||||||||||
noconfirm(bool) |
= |
if true do not ask to confirm when closing the window, just do it (beware: unsaved changes could be lost) |
|||||||||||||||||||||
bare(bool) |
= |
if true it's a shortcut for nohints=true, nonext=true, noback=true, noclose=true, noconfirm=true |
|||||||||||||||||||||
callback(func) |
= |
if declared call this Lua function to process window events or child events not explicitly handled by the child |
|||||||||||||||||||||
vcr(table) |
= |
if declared and is a table, draws the standard 'vcr' form buttons (Back, Next, New, Reset, Del, Save, Close), keys in the table are the names of the buttons (in lower case) and their value is the callback function to call when that button is pressed, the presence of this table implies noback, nonext, nohints and noclose, if a key is not present the button performs its default behaviour when pressed, the default behaviour is:
|
|||||||||||||||||||||
prompts(table) |
= |
table of controls (the key name of ‘prompts’ is retained for legacy compatibility), each control can contain keys as defined in Per Control keys: below. |
id(str) |
= |
the id (prepended by the window id) to use in the ASF (so it can have security associated with it), if not declared an id of the form ‘C#nnn’ is used, where ‘nnn’ is the control number in the window. Ids are useful to refer to controls from the prop() function (see later). |
|||||||||||||||||||||||||||||||||||||||||||||
hide(bool) |
= |
true if the control is hidden, it exists but is not visible |
|||||||||||||||||||||||||||||||||||||||||||||
readonly(bool) |
= |
true if the control is read-only, on a prompt this prevents its value from being changed, on groups, buttons, strings and tabs it disables them (disabled controls are visible but cannot be selected) |
|||||||||||||||||||||||||||||||||||||||||||||
password(bool) |
= |
if true on a 'prompt' control, the value is displayed as asterisk (*) characters so user entry cannot be overseen |
|||||||||||||||||||||||||||||||||||||||||||||
nulls(bool) |
= |
if true on a ‘prompt’ control, the value is allowed to be blank |
|||||||||||||||||||||||||||||||||||||||||||||
default(bool) |
= |
if true on a ‘button’ control, the button is the default button, pressing the shift-Enter key presses the default button, behaviour is undefined if more than one default button is specified |
|||||||||||||||||||||||||||||||||||||||||||||
nochevron(bool) |
= |
if true on a 'prompt' control, a chevron (») is not prepended when the control has been touched, if true on a save button, chevrons (»...«) are not placed around the button text when any control on the window has been touched |
|||||||||||||||||||||||||||||||||||||||||||||
type(int) |
= |
the type of the control, one of:
|
|||||||||||||||||||||||||||||||||||||||||||||
position(int) |
= |
where the control is to be placed, one of (see window layout):
|
|||||||||||||||||||||||||||||||||||||||||||||
ask(bool) |
= |
if present and true same as type = drPage_Prompt (the type key must be nil) (for legacy 'page' compatibility) |
|||||||||||||||||||||||||||||||||||||||||||||
show(bool) |
= |
if present and true same as type = drPage_Prompt + readonly=true (the type key must be nil) (for legacy 'page' compatibility) |
|||||||||||||||||||||||||||||||||||||||||||||
option(bool) |
= |
if present and true same as type = drPage_Prompt + nulls=true (the type key must be nil) (for legacy 'page' compatibility) |
|||||||||||||||||||||||||||||||||||||||||||||
text(str) |
= |
the visible text for the control (including any hot key designation preceded by an ampersand, e.g. ‘&Save’ makes the ‘S’ a hot-key, pressing the Alt key and the hot-key together will select the control). For a prompt, if text is not declared the default is 'Select a <typename>' where <typename> is the name of the LType for the prompt. For a group, if text is not declared the group is drawn without a box. |
|||||||||||||||||||||||||||||||||||||||||||||
hint(str) |
= |
the What’s This? help for the control. For a prompt, the first line becomes its tool-tip, pressing the [?] button shows the help. The [?] is not dawn if there is no help. |
|||||||||||||||||||||||||||||||||||||||||||||
name(str) |
= |
the sub-title to use on a tab or list (if not declared, no sub-title is shown) |
|||||||||||||||||||||||||||||||||||||||||||||
callback(func) |
= |
if declared call this Lua function to process the controls events, otherwise use the callback associated with its parent (see below) |
|||||||||||||||||||||||||||||||||||||||||||||
value(LType) |
= |
for a prompt, it's the LType object to be shown/edited, the presence of this key when type is not declared implies a drPage_Prompt control NB: While the window is open, this value must NOT be changed by directly assigning to it, it should only be changed by using the assign operation. Failure to observe this rule will result in memory corruption and undefined behaviour (which will be bad). |
|||||||||||||||||||||||||||||||||||||||||||||
alias(str) |
= |
for a prompt, it refers to the id of another prompt whose value is to be used here, it must be declared before the alias, if the id is not unique in the window, which one is referenced is not defined, this provides an alternative prompt to view/edit the same value |
|||||||||||||||||||||||||||||||||||||||||||||
context(LType) |
= |
for a prompt, it's the context to pass to the LType editor. Not all LType editors expect a context, for those that don't this property is ignored. For those that do, this property if present must be of the LType expected or an equivalent LType. A context is used by an LType editor to give it a hint when there are choices, for example with the ClassMat LType the hint specifies the material class to select from when an example material is not given. |
|||||||||||||||||||||||||||||||||||||||||||||
ruler(str) |
= |
for a group, prompt, button or string, this defines how to render the control elements (see below) |
|||||||||||||||||||||||||||||||||||||||||||||
tab(table) |
= |
for a tab, it's a table of controls to place in the tab, controls outside of any tab are placed in the implied tab '0', tabs cannot be nested, i.e. a tab cannot be placed inside another tab, the presence of this key when type is not declared implies a drPage_Tab control |
|||||||||||||||||||||||||||||||||||||||||||||
file(file) |
= |
on a list, the file the list is looking at (it must be open), it may be a physical file or a virtual file |
|||||||||||||||||||||||||||||||||||||||||||||
keys(table) |
= |
on a list, a table of keys the file is being browsed on, when more than 1 key is declared, a key change tab sheet is shown, if only 1 key is declared, no key change sheet is shown, if not declared the RecNoKey is implied (i.e. key number 1), on a virtual file only 1 key is allowed and key must be a field number in the file that has unique values or 0 for physical order, each entry must be a table with the following keys:
|
|||||||||||||||||||||||||||||||||||||||||||||
paged(bool) |
= |
on a list, true if the list is page loaded, otherwise it's fully loaded (default is paged) |
|||||||||||||||||||||||||||||||||||||||||||||
vsize(int) |
= |
on a list, the minimum number of rows to show, if not declared 16 is used (which is enough to fill the default tab height), the minimum is 4 |
|||||||||||||||||||||||||||||||||||||||||||||
bsize(int) |
= |
on a list, the size of the button area to reserve to its right in Dialog Units (a Dialog Unit, or DU, is approximately a quarter of a character width), the default is the default button width (40 DU) when there are buttons or 0 when not |
|||||||||||||||||||||||||||||||||||||||||||||
buttons(table) |
= |
on a list, a table of list buttons, each entry must be a button control, these are drawn vertically to the right of the main list browse area, buttons may also be grouped using a group control |
|||||||||||||||||||||||||||||||||||||||||||||
columns(bool) |
= |
on a list, if true individual columns in a row are selectable in the list, otherwise only the whole row is selectable |
|||||||||||||||||||||||||||||||||||||||||||||
group(table) |
= |
on a group, a table of prompt, button and string controls in the group, the presence of this key when type is not declared implies a drPage_Group control |
|||||||||||||||||||||||||||||||||||||||||||||
role(int) |
= |
as a list button on a list with multi-select enabled, this sets the function of the button in a multi-select context, up to 4 such buttons can be defined, omitted buttons just remove that action, the role of each must be one of:
|
|||||||||||||||||||||||||||||||||||||||||||||
selected(RecNoQ) |
= |
on a list with multi-select enabled, use this RecNoQ instead of creating one to hold the selections (use NewQ to create it, the type must be compatible with the file being browsed), ignored if multi-select not enabled, default is to auto create a RecNoQ but it will be destroyed when the window closes, so set your own if you need it beyond that scope |
|||||||||||||||||||||||||||||||||||||||||||||
list(table) |
= |
on a list, a list of fields to be shown in the list, the presence of this key when type is not declared implies a drPage_List control, each field is a table with the following keys:
|
If none of type, ask, show, option is given but value is given, then type = drPage_Prompt is assumed.
If none of type, ask, show, option is given but list is given, then type = drPage_List is assumed.
If none of type, ask, show, option is given but tab is given, then type = drPage_Tab is assumed.
If none of type, ask, show, option is given but group is given, then type = drPage_Group is assumed.
If more than one of these is given, the behaviour is undefined.