Divooka Reference

GUI Application

37 nodes

On this page 37

Make GUI Application

Function

This node carries no documentation.

Signature
GUIApplication() -> GUI Application
GUIApplication GUIApplication()

Returns

GUI ApplicationGUI Application
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Add Button

Function

Add a button. Pressing it delivers its intent to the Clicked callback.

Signature
AddButton
    GUI Application: GUI Application
    text: Text
    intent: Text
    kind: Button Kind
    name: Text
void AddButton(
    GUIApplication GUI Application,
    string text,
    string intent,
    ButtonKind kind = ButtonKind.Secondary,
    string name)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
textText—The caption.
intentText—What pressing it means. The caption, unless the graph says otherwise - so a keypad's "7" means "7" with nothing more said, and a button captioned "Go" can mean "Start Run".
kindButton KindSecondaryHow it looks, which says how important it is.
nameText—A name, so the button can be reached afterwards. The intent, unless the graph says otherwise.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Add Divider

Function

Add a hairline rule.

Signature
AddDivider(GUI Application: GUI Application)
void AddDivider(GUIApplication GUI Application)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Add Label

Function

Add a line of text.

Signature
AddLabel
    GUI Application: GUI Application
    text: Text
    name: Text
    role: Label Role
    alignment: Text Alignment
void AddLabel(
    GUIApplication GUI Application,
    string text = "",
    string name,
    LabelRole role = LabelRole.Body,
    TextAlignment alignment = TextAlignment.Left)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
textText—What it says.
nameText—A name, so the text can be changed afterwards with Set Text.
roleLabel RoleBodyHow prominent it is.
alignmentText AlignmentLeftWhere the text sits in the room it has.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Add Spacer

Function

Add empty room: a fixed number of pixels, or with no size, whatever room is free.

Signature
AddSpacer(GUI Application: GUI Application, size: Number)
void AddSpacer(GUIApplication GUI Application, double size = 0)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
sizeNumber0Pixels, or 0 to take the free room in a column or row.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Add Text Box

Function

Add a line of text the person can edit. Read it back with Get Text.

Signature
AddTextBox
    GUI Application: GUI Application
    name: Text
    text: Text
    placeholder: Text
    intent: Text
void AddTextBox(
    GUIApplication GUI Application,
    string name,
    string text = "",
    string placeholder = "",
    string intent)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
nameText—A name; a text box exists to be read, so it always has one.
textText—What it starts out saying.
placeholderText—A hint shown while it is empty.
intentText—What pressing Enter in it means, delivered to Clicked exactly as a button's press is - give a box and its button the same intent, and Enter and the button do one thing, written once. Empty, and Enter in it reaches nothing.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Begin Card

Function

Open a card: a raised surface with an optional heading, holding its children in a column.

Signature
BeginCard
    GUI Application: GUI Application
    title: Text
    subtitle: Text
    name: Text
void BeginCard(
    GUIApplication GUI Application,
    string title,
    string subtitle,
    string name)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
titleText—The heading, or nothing for a plain surface.
subtitleText—A second line under the heading.
nameText—A name, if the graph will need to reach the card afterwards.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Begin Column

Function

Open a column: everything added until the matching End stacks top to bottom.

Signature
BeginColumn
    GUI Application: GUI Application
    spacing: Number
    name: Text
void BeginColumn(
    GUIApplication GUI Application,
    double spacing = 10,
    string name)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
spacingNumber10Gap between the children, in pixels.
nameText—A name, if the graph will need to reach the column afterwards.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Begin Grid

Function

Open a grid of equal cells. Children fill it row by row, in the order they are added, unless one is
placed explicitly with GUIApplication.PlaceInGrid.

Signature
BeginGrid
    GUI Application: GUI Application
    columns: Integer
    rows: Integer
    spacing: Number
    name: Text
void BeginGrid(
    GUIApplication GUI Application,
    int columns = 2,
    int rows = 0,
    double spacing = 8,
    string name)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
columnsInteger2How many cells across.
rowsInteger0How many cells down, or 0 for as many as the children need.
spacingNumber8Gap between cells, in pixels.
nameText—A name, if the graph will need to reach the grid afterwards.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Begin Row

Function

Open a row: everything added until the matching End runs left to right.

Signature
BeginRow
    GUI Application: GUI Application
    spacing: Number
    name: Text
void BeginRow(
    GUIApplication GUI Application,
    double spacing = 8,
    string name)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
spacingNumber8Gap between the children, in pixels.
nameText—A name, if the graph will need to reach the row afterwards.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Close

Function

Ask to stop. Whatever is running the application decides what that means - a windowed host closes its
window, an offline driver stops pumping.

Signature
Close(GUI Application: GUI Application)
void Close(GUIApplication GUI Application)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

End

Function

Close the innermost open container. Every Begin needs one.

Signature
End(GUI Application: GUI Application)
void End(GUIApplication GUI Application)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Desired Window Size

Function

How big a window to open. A host offers a default before anything runs; the entry callback may say
otherwise, and the host honours whatever the answer is when it opens a window.

Signature
DesiredWindowSize(GUI Application: GUI Application) -> Size
Size DesiredWindowSize(GUIApplication GUI Application)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—

Returns

resultSize
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Desired Window Title

Function

The window's title.

Signature
DesiredWindowTitle(GUI Application: GUI Application) -> Text
string DesiredWindowTitle(GUIApplication GUI Application)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Get Elapsed Time

Function

Time the current frame represents, in milliseconds.

Signature
GetElapsedTime(GUI Application: GUI Application) -> Number
double GetElapsedTime(GUIApplication GUI Application)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—

Returns

resultNumber
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Get Text

Function

What a named element says right now - for a text box, what the person has typed.

Signature
GetText(GUI Application: GUI Application, name: Text) -> Text
string GetText(GUIApplication GUI Application, string name)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
nameText—

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Has Element

Function

Whether the screen has an element of this name.

Signature
HasElement -> Truth
    GUI Application: GUI Application
    name: Text
bool HasElement(GUIApplication GUI Application, string name)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
nameText—

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Place In Grid

Function

Put the element added most recently in a particular cell of the grid it is in.

Signature
PlaceInGrid
    GUI Application: GUI Application
    row: Integer
    column: Integer
    rowSpan: Integer
    columnSpan: Integer
void PlaceInGrid(
    GUIApplication GUI Application,
    int row,
    int column,
    int rowSpan = 1,
    int columnSpan = 1)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
rowInteger—The row, from 0 at the top.
columnInteger—The column, from 0 at the left.
rowSpanInteger1How many rows it covers.
columnSpanInteger1How many columns it covers.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Press

Function

Act on an intent as if a button meaning it had been pressed - what a keyboard shortcut does.

Signature
Press(GUI Application: GUI Application, intent: Text)
void Press(GUIApplication GUI Application, string intent)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
intentText—What to act on.

Remarks

The reason a keyboard arm does not have to repeat a click arm: a graph reads a key, decides which of
its own keys it stands for, and presses that. The press is indistinguishable from a real one - the
same GUIApplication.Clicked, the same GUIApplication.WasClicked for the rest of the frame - because it
goes through the same door. An intent no button carries is allowed: a key may mean something the
screen has no button for.

Calling this from inside GUIApplication.Clicked with the intent being handled would not return; that
is the ordinary hazard of a callback that calls itself, and the answer is the ordinary one.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Rebuild

Function

Ask for the screen to be described again: Build runs afresh before the next frame, and the widgets
are made anew from what it says.

Signature
Rebuild(GUI Application: GUI Application)
void Rebuild(GUIApplication GUI Application)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—

Remarks

Requested rather than done here, because the host is in the middle of a frame - possibly inside the
very button handler asking for this - and the widgets it is routing input through must not be replaced
under it. Nothing is lost by waiting one frame; a rebuild is for a screen whose SHAPE changes, and
text that merely changes goes through GUIApplication.SetText without one.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Enabled

Function

Whether a named element can be used. A disabled button draws dimmed and delivers nothing.

Signature
SetEnabled
    GUI Application: GUI Application
    name: Text
    enabled: Truth
void SetEnabled(
    GUIApplication GUI Application,
    string name,
    bool enabled = true)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
nameText—
enabledTruthTrue
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Padding

Function

Set the room inside the edge of the container opened most recently.

Signature
SetPadding(GUI Application: GUI Application, padding: Number)
void SetPadding(
    GUIApplication GUI Application,
    double padding = 14)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
paddingNumber14Pixels on every side.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Size

Function

Fix the size of the element added most recently. Leave a dimension NaN to keep it free.

Signature
SetSize
    GUI Application: GUI Application
    width: Number
    height: Number
void SetSize(
    GUIApplication GUI Application,
    double width = double.NaN,
    double height = double.NaN)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
widthNumberNaNPixels, or NaN for "as wide as it needs and may".
heightNumberNaNPixels, or NaN for "as tall as it needs and may".
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Stretch

Function

Give the element added most recently a share of the free room in its column or row.

Signature
SetStretch(GUI Application: GUI Application, weight: Number)
void SetStretch(
    GUIApplication GUI Application,
    double weight = 1)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
weightNumber1Its share, against the shares of its siblings. 1 for an equal share.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Text

Function

Change what a named element says: a label's text, a button's caption, a text box's content.

Signature
SetText
    GUI Application: GUI Application
    name: Text
    text: Text
void SetText(
    GUIApplication GUI Application,
    string name,
    string text = "")

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
nameText—
textText—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Text Fit

Function

Draw the text of the element added most recently as large as fits it, growing and shrinking with the room it is given - or, for a container, the text of every label and button inside it.

Signature
SetTextFit
    GUI Application: GUI Application
    fit: Truth
    margin: Number
void SetTextFit(
    GUIApplication GUI Application,
    bool fit = true,
    double margin = 0.2)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
fitTruthTrueWhether to fit the text; false goes back to the size its role has.
marginNumber0.2How much room to leave round the text, as a share of the box's shorter side on each side: 0.2 leaves a fifth above and below.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Visible

Function

Whether a named element is shown at all. A hidden element takes no room.

Signature
SetVisible
    GUI Application: GUI Application
    name: Text
    visible: Truth
void SetVisible(
    GUIApplication GUI Application,
    string name,
    bool visible = true)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
nameText—
visibleTruthTrue
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Window Size

Function

Set the size the window opens at.

Signature
SetWindowSize
    GUI Application: GUI Application
    width: Number
    height: Number
void SetWindowSize(
    GUIApplication GUI Application,
    double width = 480,
    double height = 640)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
widthNumber480
heightNumber640
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Set Window Title

Function

Set the window's title.

Signature
SetWindowTitle(GUI Application: GUI Application, title: Text)
void SetWindowTitle(
    GUIApplication GUI Application,
    string title = "Divooka")

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
titleTextDivooka
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Show Notice

Function

Show a brief notice in the corner of the window.

Signature
ShowNotice(GUI Application: GUI Application, message: Text)
void ShowNotice(GUIApplication GUI Application, string message)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
messageText—

Remarks

Queued rather than shown, because this package has nothing to show it with; the host drains the queue
each frame. A message posted from Start, before there is a window, is shown on the first frame.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Was Clicked

Function

Whether a button meaning this was pressed during the current frame.

Signature
WasClicked -> Truth
    GUI Application: GUI Application
    intent: Text
bool WasClicked(GUIApplication GUI Application, string intent)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
intentText—

Returns

resultTruth

Remarks

The polling half of input, for an Update that would rather ask than be told. False outside a
frame and false for an intent nobody named: an unpressed button is the ordinary case.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Was Key Pressed

Function

Whether this key was pressed during the current frame.

Signature
WasKeyPressed -> Truth
    GUI Application: GUI Application
    key: Text
bool WasKeyPressed(GUIApplication GUI Application, string key)

Parameters

nametypedefaultdescription
GUI ApplicationGUI Application—
keyText—The key, as GUIApplication.KeyPressed describes it.

Returns

resultTruth

Remarks

The polling half of the keyboard, for an Update that would rather ask than be told.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
GUI Application
Package
GUI Applications

Build

Event

Describe the screen: open containers, add labels and buttons, close containers. Runs once when the
window is ready, and again whenever the graph asks to GUIApplication.Rebuild.

Signature
Build()
void Build()
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events StateMachineState
Declared by
GUI Application
Package
GUI Applications

Clicked

Event

A button was pressed.

Signature
Clicked(intent: Text)
void Clicked(string intent)

Parameters

nametypedefaultdescription
intentText—What the button MEANS - the intent it was added with, which is its caption unless the graph said otherwise.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events StateMachineState
Declared by
GUI Application
Package
GUI Applications

Key Pressed

Event

A key was pressed.

Signature
KeyPressed(key: Text)
void KeyPressed(string key)

Parameters

nametypedefaultdescription
keyText—The key, as text. A key that types something arrives as what it typed - "7", ".", "+", "A" - and a key that types nothing arrives by name: "Enter", "Escape", "Backspace", "Tab", "Delete", "Left", "Right", "Up", "Down", "Home", "End", "Page Up", "Page Down", "Insert", "F1".."F12". See GUIApplication.NamedKeys.

Remarks

Text rather than a key enumeration, for two reasons. A graph compares text - that is what its Equals
and Choose nodes are for - and an enumeration would need a palette of its own before a document could
name a key. And what a key TYPES is the layout's answer, not the keycode's: the key beside
0 types . on one keyboard and , on another, and a calculator wants the former.
A key held down repeats as the platform repeats it, because that is what a person typing expects.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events StateMachineState
Declared by
GUI Application
Package
GUI Applications

Start

Event

Divooka procedural program entry, equivalent to "Main" in many programming languages. Runs before the
window exists, which is where window size and title belong; the screen itself is described in
GUIApplication.Build.

Signature
Start()
void Start()
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events StateMachineState
Declared by
GUI Application
Package
GUI Applications

Update

Event

Called once per frame, after that frame's presses have been delivered.

Signature
Update(deltaTimeMilliseconds: Number)
void Update(double deltaTimeMilliseconds)

Parameters

nametypedefaultdescription
deltaTimeMillisecondsNumber—Time elapsed since the previous frame.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events StateMachineState
Declared by
GUI Application
Package
GUI Applications