Giff Windows and Layout - Owen2k6/GoOS GitHub Wiki

Windows & Layout

A window creates a GoOS Window with a client Canvas:

window Demo {
  title "Demo"
  x 40; y 40; width 400; height 240
  closable true
  titlebar true
  background "#EDEDED"

  onLoad { message "Ready."; }
}

Window properties

  • title (string) — caption. Defaults to the window's name.
  • x, y (int) — screen position. Defaults 40, 40.
  • width, height (int) — client size. Defaults 320, 240.
  • closable (bool) — default true.
  • titlebar (bool) — default true.
  • background (colour) — optional fill; if omitted, system default.

Drawing order

Controls are built in declaration order. For overlapping visuals (e.g., an image placeholder then a label), declare the background first.

Coordinate system

  • Window Contents origin is top-left (0,0).
  • All control coordinates are relative to the window client area.
  • Controls inside a panel are relative to the panel's (x,y).

Title, centring text

Labels can be centred horizontally across the window by setting centre true (or center, etc.). This uses the font metrics to compute x at build time.

label header {
  y 8; text "Giff Title"; textColour black; centre true
}

Backgrounds and rectangles

image nodes paint a grey framed placeholder rectangle (useful for layout). To paint solid areas, prefer a panel with a background.

panel banner {
  x 0; y 0; width 400; height 36; background "#C0D0FF"

  label title { x 8; y 10; text "Banner"; textColour black }
}
⚠️ **GitHub.com Fallback** ⚠️