Gizmos Widget Reference

Gizmos Widget Reference

Gizmos are custom dialog windows built in XML that Lua scripts can create. They provide interactive UIs for scripts — editing forms, data-bound views, multi-step workflows — anything beyond a simple alert() or query table.

You define the layout in XML, load it with gizmos.load(), then show it. The script handles events from the dialog’s widgets and can read or update their values at any time.

A complete example

This script creates a dialog with a text field and a button. When the user clicks the button, it reads the text field and shows a greeting.

–[[
@tool
@name Greeting
]]

local xml = [[
<dialog title="Greeting" width="300" height="150">
<vbox>
<hbox collapse="yes">
<label value="Name:" />
<text_field id="name_input" expand="horizontal" />
</hbox>
<hbox collapse="yes">
<spacer />
<button id="greet_btn" label="Greet" />
</hbox>
</vbox>
</dialog>
]]

gizmos.load(xml)

function greet_btn_action()
local name = Widget("name_input").text
alert("Hello, " .. name .. "!")
gizmos.close()
end

gizmos.show_modal()
Creating and showing a gizmo

The basic sequence is:

  1. Build an XML string describing the layout.
  2. Call gizmos.load(xml) to parse and create the widgets.
  3. Register any event handlers.
  4. Call gizmos.show() or gizmos.show_modal().

show() opens a non-modal dialog — the user can still interact with the main window. show_modal() blocks interaction with the main window until the dialog is closed.

The gizmos table

All gizmo functions live in the global gizmos table.

FunctionDescription
gizmos.load(xml)Parse XML and create the dialog
gizmos.show()Show the dialog (non-modal)
gizmos.show_modal()Show the dialog (modal — blocks main window)
gizmos.close()Close the dialog
gizmos.call(id, method, …)Call a method on a widget
gizmos.on(id, event_type, callback)Register an event handler
gizmos.on_closing(callback)Intercept window close (return true to allow)
gizmos.open_dialog(xml)Open a child dialog at runtime

gizmos.call() is the low-level way to interact with widgets. You pass the widget’s id, the method name, and any arguments. For example, gizmos.call("name_input", "text") reads the value, and gizmos.call("name_input", "text", "Alice") sets it.

gizmos.on_closing() lets you intercept the user pressing the close button. Return true to allow the close, or false to prevent it (useful for confirming unsaved changes).

Widget proxy shorthand

The Widget() function provides a convenient shorthand that avoids repeated calls to gizmos.call(). It returns a proxy object for the widget with the given id:

local w = Widget("my_field")

– Get a value (calls gizmos.call("my_field", "text"))
local value = w.text

– Set a value (calls gizmos.call("my_field", "text", "hello"))
w.text = "hello"

– Register an event handler
w.on_action = function()
– handle click
end

This is the recommended way to interact with widgets.

Event handling

There are two styles for handling events:

Convention-based

Define a global function named {id}_{event_type}. The gizmo framework finds it automatically:

function ok_btn_action()
gizmos.close()
end

function search_field_change()
– respond to text changes
end
Explicit registration

Use gizmos.on() or the Widget proxy:

gizmos.on("ok_btn", "action", function()
gizmos.close()
end)

– or equivalently:
Widget("ok_btn").on_action = function()
gizmos.close()
end
Event types
EventFires when
"action"Button clicked, Enter pressed, item double-clicked
"change"Value or selection changed
Common attributes

These attributes are available on all widgets:

AttributeValuesPurpose
idany stringUnique identifier used by scripts to interact with the widget
expand"horizontal", "vertical", "both", "no"Controls how the widget grows to fill available space
enabled"true", "false"Whether the widget accepts input
visible"true", "false"Whether the widget is shown
Common methods

These methods are available on all widgets via gizmos.call() or the Widget proxy:

MethodGet/SetDescription
enabledget/setEnable or disable the widget (boolean)
visibleget/setShow or hide the widget (boolean)
focussetGive keyboard focus to the widget
tooltipsetSet the tooltip text
Dialog and frame attributes
The ‘<dialog>‘ element

The root element for gizmos embedded in Pedigree Forge scripts:

AttributeDescription
titleWindow title
widthInitial width in pixels
heightInitial height in pixels
modal"true" or "false"
default_buttonid of the button activated by Enter
focusid of the widget that receives initial focus
The ‘<gizmos>‘ wrapper

An alternative root element that supports additional modes:

AttributeValuesDescription
mode"dialog" (default), "app""dialog" for Pedigree Forge scripts; "app" for standalone
themesee belowVisual theme

Available themes: light, dark, light_alt, dark_alt, high_contrast, fluent, sepia, parchment, forest, midnight, ocean, lavender, slate, autumn.

Layout widgets
‘<vbox>‘ — Vertical box

Arranges children in a vertical stack.

AttributeValuesDescription
expand"horizontal", "vertical", "both", "no"Growth behaviour
align"left", "centre", "right"Horizontal alignment of children
collapse"yes"Makes the container fixed-height
‘<hbox>‘ — Horizontal box

Arranges children in a horizontal row.

AttributeValuesDescription
expand"horizontal", "vertical", "both", "no"Growth behaviour
align"top", "middle", "bottom"Vertical alignment of children
collapse"yes"Makes the container fixed-width
‘<grid>‘ — Grid layout

Arranges children in a grid. Children fill cells left-to-right, top-to-bottom.

AttributeValuesDescription
columnsintegerNumber of columns
expand"horizontal", "vertical", "both", "no"Growth behaviour
collapse"yes"Fixed size
‘<panel>‘ — Panel container

A general-purpose container. Also used as tab pages inside <tabs> (see below).

AttributeValuesDescription
nametextLabel shown on the tab when used inside <tabs>
expand"horizontal", "vertical", "both", "no"Growth behaviour
‘<spacer>‘ — Flexible space

Pushes siblings apart by consuming available space. Takes no attributes beyond the common ones.

‘<strut>‘ — Fixed-size spacer

Inserts a fixed gap.

AttributeValuesDescription
widthintegerWidth in pixels
heightintegerHeight in pixels
‘<field_sep>‘ — Field separator

A horizontal rule, optionally with a title.

AttributeValuesDescription
titletextOptional heading text
‘<zbox>‘ — Stacked layout

Stacks all children on top of each other. Only one child is visible at a time — useful for wizard-style step-by-step interfaces.

MethodGet/SetDescription
showsetShow child by index (0-based)
‘<collapsible_panel>‘ — Expandable section

A section with a clickable header that expands or collapses its content.

AttributeValuesDescription
labeltextHeader text
collapsed"true", "false"Initial state
border"true", "false"Draw a border
EventFires when
actionPanel expanded or collapsed
MethodGet/SetDescription
collapsedget/setCollapsed state (boolean)
‘<split_pane>‘ — Resizable split

Splits its area into two resizable panels.

AttributeValuesDescription
orientation"horizontal", "vertical"Split direction
rationumber (0.0 to 1.0)Initial split ratio
expand"horizontal", "vertical", "both", "no"Growth behaviour
MethodGet/SetDescription
modeget/setSplit mode
best_fitsetAuto-fit to content
‘<tabs>‘ — Tab container

Contains <panel> children, each shown as a tab page. The name attribute on each <panel> becomes the tab label.

<tabs id="my_tabs">
<panel name="General">
<!– general content –>
</panel>
<panel name="Advanced">
<!– advanced content –>
</panel>
</tabs>
EventFires when
changeTab selection changes
MethodGet/SetDescription
selected_tabgetIndex of the selected tab (0-based)
set_current_tabsetSwitch to a tab by index
Input widgets
‘<button>‘ — Push button
AttributeValuesDescription
labeltextButton text
tooltiptextTooltip
commandtextBuilt-in command name
command_fortextTarget widget id for the command
EventFires when
actionButton clicked
MethodGet/SetDescription
textget/setButton label
‘<label>‘ — Text label
AttributeValuesDescription
valuetextLabel text
tooltiptextTooltip
MethodGet/SetDescription
textget/setLabel text
clearsetClear the text
‘<check>‘ — Checkbox
AttributeValuesDescription
labeltextCheckbox label
checked"true", "false"Initial state
tooltiptextTooltip
EventFires when
actionCheckbox toggled
MethodGet/SetDescription
checkedget/setChecked state (boolean)
textget/setLabel text
‘<radio>‘ — Radio button

Radio buttons with the same group value are mutually exclusive.

AttributeValuesDescription
labeltextRadio button label
grouptextGroup name
checked"true", "false"Initial state
tooltiptextTooltip
EventFires when
actionRadio button selected
MethodGet/SetDescription
checkedget/setSelected state (boolean)
textget/setLabel text
‘<text_field>‘ — Single-line text input
AttributeValuesDescription
valuetextInitial text
cuetextPlaceholder text shown when empty
tooltiptextTooltip
expand"horizontal"Growth behaviour
EventFires when
actionEnter pressed
changeText edited
MethodGet/SetDescription
textget/setField text
cuesetPlaceholder text
clearsetClear the text
validgetWhether the current value passes validation
‘<text_area>‘ — Multi-line text input
AttributeValuesDescription
widthintegerWidth in pixels
heightintegerHeight in pixels
valuetextInitial text
read_only"true", "false"Prevent editing
no_return"true", "false"Suppress Enter key (fires action instead)
tooltiptextTooltip
EventFires when
changeText edited
MethodGet/SetDescription
textget/setFull text content
clearsetClear all text
scroll_to_endsetScroll to the bottom
selected_textgetCurrently selected text
replace_selectionsetReplace the selection with new text
selection_startgetStart index of selection
selection_endgetEnd index of selection
‘<choice>‘ — Dropdown list

A non-editable dropdown. Items are defined in XML as children:

<choice id="colour">
<item label="Red" />
<item label="Green" />
<item label="Blue" />
</choice>
AttributeValuesDescription
tooltiptextTooltip
EventFires when
changeSelection changes
MethodGet/SetDescription
selectedgetIndex of selected item (0-based)
selected_textgetText of selected item
selectsetSelect item by index
appendsetAdd an item
clearsetRemove all items
countgetNumber of items
‘<combo>‘ — Editable dropdown

Like <choice>, but the user can also type a custom value.

AttributeValuesDescription
widthintegerWidth in pixels
tooltiptextTooltip

Children: <item label="…"> elements.

EventFires when
changeText or selection changes
MethodGet/SetDescription
textget/setCurrent text (typed or selected)
appendsetAdd an item
clearsetRemove all items
‘<list>‘ — List box
AttributeValuesDescription
widthintegerWidth in pixels
heightintegerHeight in pixels
tooltiptextTooltip

Children: <item label="…" value="…"> elements.

EventFires when
actionItem double-clicked
changeSelection changes
MethodGet/SetDescription
selectedgetIndex of selected item
selected_textgetText of selected item
selectsetSelect item by index
appendsetAdd an item
removesetRemove an item by index
clearsetRemove all items
countgetNumber of items
item_textgetText of item at index
item_valuegetValue of item at index
‘<table>‘ — Data table
AttributeValuesDescription
widthintegerWidth in pixels
heightintegerHeight in pixels
no_headers"true", "false"Hide column headers
auto_size_columns"true", "false"Auto-fit column widths

Columns are defined as children:

<table id="results" width="400" height="200">
<column text="Name" width="200" />
<column text="Born" width="100" right_align="true" />
</table>
EventFires when
actionRow double-clicked
changeSelection changes
MethodGet/SetDescription
add_columnsetAdd a column (text, width)
add_rowsetAdd a row (returns row index)
cell_textget/setGet or set text at (row, column)
selected_rowgetIndex of selected row
row_countgetNumber of rows
column_countgetNumber of columns
clear_rowssetRemove all rows
delete_rowsetRemove a row by index
‘<spinner>‘ — Integer spinner
AttributeValuesDescription
minintegerMinimum value
maxintegerMaximum value
valueintegerInitial value
tooltiptextTooltip
EventFires when
changeValue changes
MethodGet/SetDescription
valueget/setCurrent value
rangesetSet min and max (two arguments)
‘<numeric_spinner>‘ — Floating-point spinner
AttributeValuesDescription
minnumberMinimum value
maxnumberMaximum value
stepnumberIncrement per click
unitstextUnits label (e.g. "mm", "%")
valuenumberInitial value
tooltiptextTooltip
EventFires when
changeValue changes
MethodGet/SetDescription
valueget/setCurrent value
rangesetSet min and max (two arguments)
stepget/setIncrement per click
‘<slider>‘ — Slider
AttributeValuesDescription
minintegerMinimum value
maxintegerMaximum value
valueintegerInitial value
tooltiptextTooltip
EventFires when
changeValue changes
MethodGet/SetDescription
valueget/setCurrent value
rangesetSet min and max (two arguments)
‘<range_slider>‘ — Range slider

A slider with two thumbs for selecting a range.

AttributeValuesDescription
minintegerMinimum value
maxintegerMaximum value
tooltiptextTooltip
EventFires when
changeEither thumb moves
MethodGet/SetDescription
lowget/setLower bound value
highget/setUpper bound value
set_rangesetSet both bounds at once
‘<toggle_switch>‘ — Toggle switch
AttributeValuesDescription
labeltextSwitch label
checked"true", "false"Initial state
tooltiptextTooltip
EventFires when
actionSwitch toggled
MethodGet/SetDescription
checkedget/setOn/off state (boolean)
textget/setLabel text
‘<search_box>‘ — Search input

A text field with a search icon and clear button.

AttributeValuesDescription
cuetextPlaceholder text
widthintegerWidth in pixels
tooltiptextTooltip
EventFires when
actionEnter pressed
changeText edited
MethodGet/SetDescription
textget/setSearch text
clearsetClear the text
cuesetPlaceholder text
‘<password_field>‘ — Password input

Text is masked. Otherwise behaves like <text_field>.

AttributeValuesDescription
widthintegerWidth in pixels
tooltiptextTooltip
EventFires when
changeText edited
MethodGet/SetDescription
textget/setField text
clearsetClear the text
‘<tri_check>‘ — Three-state checkbox

Cycles through three states: unchecked (false), checked (true), and indeterminate (nil).

AttributeValuesDescription
labeltextCheckbox label
tooltiptextTooltip
EventFires when
actionCheckbox toggled
MethodGet/SetDescription
valueget/setCurrent state (false, true, or nil)
textget/setLabel text
‘<segmented_control>‘ — Segmented button bar

A row of mutually exclusive buttons. Items defined as children:

<segmented_control id="view_mode">
<item label="List" />
<item label="Grid" />
<item label="Detail" />
</segmented_control>
EventFires when
changeSelection changes
MethodGet/SetDescription
selectedget/setIndex of selected segment (0-based)
‘<link>‘ — Clickable link
AttributeValuesDescription
valuetextLink text
tooltiptextTooltip
EventFires when
actionLink clicked
MethodGet/SetDescription
textget/setLink text
‘<progress>‘ — Progress bar
AttributeValuesDescription
valuenumber (0.0 to 1.0)Initial progress
MethodGet/SetDescription
valueget/setProgress (0.0 to 1.0)
marqueesetEnable indeterminate (animated) mode
Display widgets
‘<text_block>‘ — Wrapped text block

Displays read-only text that wraps within a given width.

AttributeValuesDescription
valuetextText content
widthintegerWidth in pixels
MethodGet/SetDescription
textget/setText content
clearsetClear the text
‘<image>‘ — Image display
AttributeValuesDescription
srcpathImage file path
widthintegerDisplay width
heightintegerDisplay height
MethodGet/SetDescription
setsetSet image by file path
‘<icon_button>‘ — Icon button

A button that displays an icon rather than text.

AttributeValuesDescription
texttextIcon glyph or label
toggle"true", "false"Whether the button toggles on/off
tooltiptextTooltip
EventFires when
actionButton clicked
MethodGet/SetDescription
latchedget/setToggle state (boolean, only for toggle buttons)
textget/setIcon or label text
‘<badge>‘ — Badge indicator

A small indicator, typically overlaid on another widget.

AttributeValuesDescription
style"dot", "count", "label"Badge style
countintegerCount to display (for "count" style)
texttextLabel text (for "label" style)
MethodGet/SetDescription
countget/setCount value
textget/setLabel text
Data widgets
‘<tree>‘ — Tree view

A hierarchical tree. Items are added from Lua code rather than XML.

AttributeValuesDescription
widthintegerWidth in pixels
heightintegerHeight in pixels
EventFires when
actionItem double-clicked
changeSelection changes
MethodGet/SetDescription
addsetAdd item: add(parent_data, label, data)
add_frontsetAdd item at the front: add_front(parent_data, label, data)
selectedgetData value of selected item
selected_textgetLabel of selected item
clearsetRemove all items
removesetRemove item by data value
set_boldsetSet bold state for an item
set_imagesetSet an image on an item
get_labelgetGet the label of an item by data value

Tip — Use nil or 0 as parent_data to add root-level items.

‘<editable_table>‘ — Editable table

Like <table>, but cells can be edited directly.

AttributeValuesDescription
widthintegerWidth in pixels
heightintegerHeight in pixels
row_lines"true", "false"Show horizontal lines between rows

Columns are defined as children: <column text="…" width="…">.

EventFires when
actionRow double-clicked
changeCell edited
MethodGet/SetDescription
add_rowsetAdd a row
cell_textget/setGet or set text at (row, column)
selected_rowgetIndex of selected row
selected_colgetIndex of selected column
row_countgetNumber of rows
clear_rowssetRemove all rows
delete_rowsetRemove a row by index
‘<property_grid>‘ — Property grid

A two-column grid of named properties, grouped by category. Properties are added from Lua code.

AttributeValuesDescription
widthintegerWidth in pixels
heightintegerHeight in pixels
EventFires when
changeA property value changes
MethodGet/SetDescription
add_categorysetAdd a category heading
add_text_propertysetAdd a text property: add_text_property(category, name, value)
add_check_propertysetAdd a checkbox property: add_check_property(category, name, checked)
add_choice_propertysetAdd a dropdown property: add_choice_property(category, name, options, selected)
property_valuegetGet the value of a text or choice property by name
property_checkedgetGet the checked state of a checkbox property by name
Data-bound widgets

These widgets connect directly to the genealogy database. They automatically load data when shown and save changes back when edited.

‘<bound_text_field>‘

An editable text field bound to a database field.

AttributeValuesDescription
pathdata expressionRequired. The data path (e.g. "person.surname")
recordrecord IDOptional. Specific record (e.g. "I1"). Defaults to the current selection
completersee belowAuto-completion source
validatorsee belowValidation rule

When the path’s data type is a date, place, age, trade, or similar structured type, the field automatically includes a helper button with an entry assistant. See the entry assistants table below for details.

Supports the same methods as <text_field>.

‘<bound_label>‘

A read-only label bound to a database field.

AttributeValuesDescription
pathdata expressionRequired. The data path
recordrecord IDOptional. Specific record

Supports the same methods as <label>.

Query-bound widgets

These widgets are populated by a query language query string.

‘<bound_table>‘

A read-only table populated from a query.

AttributeValuesDescription
queryQuery stringThe query to execute
‘<bound_edit_table>‘

An editable table populated from a query. Edits are written back to the database. Date, place, and age columns automatically receive helper buttons with entry assistants.

AttributeValuesDescription
queryQuery stringThe query to execute
‘<bound_detail_grid>‘

A detail view populated from a query, displaying results as a property-style grid rather than a table. Date, place, and age properties automatically receive helper buttons with entry assistants.

AttributeValuesDescription
queryQuery stringThe query to execute
Completers and validators

Bound text fields automatically receive a completer and validator based on the type of data they are bound to:

Field typeCompleterValidator
Datedate
Place nameplaceplace
Person namenames
Tradetrades
Age
Time
Address
Cause

You can override these defaults using the completer and validator attributes. Available values: place, names, trades, date, none.

Setting completer="none" or validator="none" disables the auto-assigned behaviour.

Entry assistants

Some field types also receive a helper button that opens an entry assistant dialog. Press F2 or click the button to open it.

Field typeIconAssistant
DateCalendarDate entry assistant
Place nameMap pinPlace entry assistant
AgeClockAge entry assistant
TradeHammer(coming soon)
TimeClock(coming soon)
AddressBuilding(coming soon)
CauseMedical notes(coming soon)

Entry assistants appear automatically on <bound_text_field>, <bound_edit_table>, and <bound_detail_grid> widgets when their data type matches the table above.