#lang scribble/manual @(require scribble/eval (for-label scheme)) @title{GUIML} This is a DSL for describing GUIs. It is inspired by SXML notation and the HTMLPrag library. "GUIML" is a thin wrapper around Racket's standard GUI library that allows a window and all its initial contents to be specified in a single expression, instead of having to specify each child widget's parent by name. Here is a simple GUI: @racketblock[ (define g (guiml (frame% (|@| (label "Foobar") (width 640) (height 150)) (vertical-panel% (|@|) (message% (|@| (label "Hello, world!"))) (editor-canvas% 'ecanvas (|@|)) (button% (|@| (label "Close") (style '(border)) (callback (lambda ignored-args (sendmsg g show #f))))))))) ] "g" is not an object, but a structure that contains not only the top-level frame% object, but all the child widgets as well. A special version of the @scheme[send] syntax is provided, so that you can ignore this structure. @scheme[sendmsg] is identical to @scheme[send], except it cuts through the extra structure. It can also be used with regular Racket objects: @racketblock[ (sendmsg g show #t) ] If you use the optional symbolic identifier in defining a GUI widget, it is possible to address that widget even if it resides deep down in the hierarchy, by using the @scheme[get-widget-by-id] function: @racketblock[ ;; Get the editor-canvas% named 'ecanvas and give it an editor: (sendmsg (get-widget-by-id g 'ecanvas) set-editor (new text%)) ]