Desktop GUI Applications

A Divooka document can be a desktop application of its own: a window with a display, buttons and text boxes, whose presses run the document's own logic. You build it in Divooka Explore or Divooka Compute, run it there while you work on it, and hand it to other people through Divooka Player or as a program published from Divooka Compute.

There are three ways to describe an interface today, and a fourth framework for windows that redraw every frame. They differ in how you write the interface and in how presses reach your logic, so the right one depends on what you are making.

The ways to build an interface

GUI Framework: describe the screen, answer the presses

One Events graph, authored against the GUI Application base type. Its Build callback describes the screen as a list of statements - open a card, add a label, open a grid, add twenty buttons, close the grid - and every button press arrives at one Clicked callback carrying what the button means (its intent, which is its caption unless you give it another). Key Pressed turns typed keys into presses of the screen's own buttons, so a rule about a key is written once. Elements you name are changed later by that name: set a label's text, read a text box, hide or disable a button.

It opens a window of its own, in the editor too. Best for forms and small tools whose layout is fixed and whose logic is "when this is pressed, do that".

Examples: GUI › Calculator and GUI › Pronounce in Divooka Explore. The details are on the GUI Application page.

GUI Components: lay the interface out as pieces

A Components graph (the Declarative kind) lays the interface out as a tree of pieces wired together - a column holding a card, a grid of buttons, a text box, a table - each piece's look and name set in Properties. A piece's events point at the document's Routines: a button's Pressed runs the Routine you name, and that Routine reads and changes the other pieces by their names. The entry Routine constructs the Components graph and calls Show.

Where it appears is up to whatever runs it: in the editor it runs live in the Active Preview, whose Move to a separate window button gives the running interface a window of its own; in Divooka Player, or in a program published from Divooka Compute, it opens a real window.

Best for forms, lists and tables you want to see and arrange as a layout, with the behaviour in small Routines. Examples: GUI › Calculator (Declarative) in Divooka Explore, and the Components Graph examples in Divooka Compute (Greeting Form, Signup Form, Planet List, Planet Table, Event Page). It is built on ShadowGUI, and Methodox App Maker designs its forms with it.

Immediate GUI: declare the whole interface every frame (experimental)

One graph declares the whole interface again on every frame, from ordinary statements: a button's own call answers whether it was pressed on this frame, so what happens next is written right where the button is. Nothing is kept between frames but the document's own data, which suits interfaces that change shape with what they show - a panel per selected item, a row per track - and windows with no title bar, see-through or always on top, such as overlays.

Example: GUI › Immediate in Divooka Explore, a full-screen painting canvas. See Immediate GUI.

Glaze: windows that redraw every frame

For games, sketches and anything that animates rather than waits for presses, Glaze gives a window, an update loop, drawing, sound and input. It is the framework of the Glaze examples (Sky Hopper, Gem Garden) rather than of forms.

Choosing one

GUI Framework GUI Components Immediate GUI Glaze
How you write the interface Describe it once in Build, then change elements by name Lay it out as pieces in a Components graph Declare all of it again every frame Draw it every frame in the update loop
Graph kind One Events graph A Components graph and Routines One Events graph One Events graph
How a press reaches your logic The Clicked callback, with the button's intent The piece's event runs a Routine The button's own call answers true on that frame Input read in the update loop, or key events
Keyboard Key Pressed turns keys into presses Typing into text boxes Keys and text, every frame Keys, every frame
Where it runs in the editor Its own window The Active Preview, or a separate window Its own window Its own window
Best for Fixed forms and small tools Laid-out forms, lists and tables Changing tools, overlays Games and animation
Status Ready Ready Experimental Ready

Running it as a real window

  • In the editor, a GUI Framework, Immediate GUI or Glaze document opens its own window when you run it; a GUI Components document shows in the Active Preview, and Move to a separate window moves the running interface into a window of its own.
  • Divooka Player runs any of them in a window of its own: open the document with it.
  • Publish in Divooka Compute makes a program that opens its window as any desktop application does.

See also