▼ |  | The Racket Graphical Interface Toolkit

1 | Windowing
2 | Widget Gallery
3 | Windowing Classes
4 | Windowing Functions
5 | Editors
6 | Snip and Style Classes
7 | Editor Classes
8 | Editor Functions
9 | WXME Decoding
10 | Preferences
11 | Dynamic Loading
12 | Startup Actions
13 | Init Libraries
14 | Platform Dependencies
| Index

top ← prev up next →

### 2`` Widget Gallery

This section shows the main widgets available in the Racket Graphical User Interface Toolkit. Each image is a link to the documentation of the relevant widget.

> (define button (new button%
> (parent panel)
> (label "Button")))

> (define check-box (new check-box%
> (parent panel)
> (label "Check Box")
> (value #t)))

> (define choice (new choice%
> (label "Choice")
> (parent panel)
> (choices (list "Item 0"))))

> (define combo-field (new combo-field%
> (label "Combo")
> (parent panel)
> (choices (list "Field"))
> (init-value "Field")))

> (define editor-canvas (new editor-canvas%
> (parent panel)
> (label "Editor Canvas")))
> (define text (new text%))
> (send text insert "Editor Canvas")
> (send editor-canvas set-editor text)

> (define gauge (new gauge%
> (label "Gauge")
> (parent panel)
> (range 100)))
> (send gauge set-value 42)

> (define group-box-panel (new group-box-panel%
> (parent panel)
> (label "Group Box Panel")))

> (define list-box (new list-box%
> (label "List Box")
> (parent (new horizontal-panel%
> (parent panel)
> (style (list 'border))))
> (choices (list "Item 0"
> "Item 1"
> "Item 2"))
> (style (list 'single
> 'column-headers))
> (columns (list "First Column"))))

> (define menu-bar (new menu-bar%
> (parent frame)))
> (new menu%
> (label "&File")
> (parent menu-bar))
> (new menu%
> (label "&Edit")
> (parent menu-bar))
> (new menu%
> (label "&Help")
> (parent menu-bar))

> (define message (new message%
> (parent panel)
> (label "Message")))

> (define a-panel (new panel%
> (parent panel)
> (style (list 'border))))
> (new message%
> (parent a-panel)
> (label "Panel"))

> (define radio-box (new radio-box%
> (label "Radio Box")
> (parent panel)
> (choices (list "Button 0"
> "Button 1"
> "Button 2"))))

> (define slider (new slider%
> (label "Slider")
> (parent panel)
> (min-value 0)
> (max-value 100)
> (init-value 42)))

> (define tab-panel (new tab-panel%
> (parent panel)
> (choices (list "Tab 0"
> "Tab 1"
> "Tab 2"))))

> (define text-field (new text-field%
> (label "Text")
> (parent panel)
> (init-value "Field")))

top ← prev up next →