6 Expandable Snip

▼ |  | Mr Lib: Extra GUI Libraries

1 | Aligned Pasteboard
2 | Arrow Toggle Snip
3 | Bitmap Label
4 | Cache-image Snip
5 | Close Icon
6 | Expandable Snip
7 | GIF and Animated GIF Writing
8 | Graphs
9 | Hierarchical List Control
10 | Include Bitmap
11 | Interactive Value Port
12 | Name Message
13 | Path Dialog
14 | Plot
15 | Switchable Button
16 | Image Core
17 | Matrix Snip
18 | Snip Canvases
19 | Syntax Browser
20 | Te X Table
21 | Terminal Window
22 | White on Black Panel Predicate
23 | Acknowledgments
| Index

On this page:

expandable-snip%
new
get-open-editor
get-closed-editor

Racket
top contents ← prev up next →

## 6 Expandable Snip🔗ℹ

(require mrlib/expandable-snip) | package: gui-lib

class expandable-snip% : class?
superclass: editor-snip%

An expandable snip allows the user to toggle between two views—“open” and “closed”—implemented by two text editors. Typically the closed view is a concise summary and the open view contains more detailed information. The syntax browser snip is an example of an expandable snip.

> > > constructor
> > > (new expandable-snip% |
> > > | [ | [layout layout] |
> > > |  | [closed-editor closed-editor] |
> > > |  | [open-editor open-editor] |
> > > |  | [callback callback]] |
> > > |  | ...superclass-args...) |
> > → (is-a?/c expandable-snip%)
> > layout : (or/c 'append 'replace) = 'append
> > closed-editor : (is-a?/c text%) = (new text%)
> > open-editor : (is-a?/c text%) = (new text%)
> > callback : (-> boolean? any) = void

> The callback is called when the snip state is toggled. It is called with a boolean that indicates whether the new state is open.

> In closed mode, the toggle arrow and closed-editor are displayed adjacent on a single line. In open mode, the layout is controlled by the layout argument as follows:

> - 'append — The first line is unchanged (that is, it contains both toggle arrow and closed-editor), and open-editor is displayed on the second line.

> - 'replace — The toggle arrow and the open-editor are displayed on a single line. The closed-editor is not displayed.

> > method (send an-expandable-snip get-open-editor) → (is-a?/c text%)

> Get the editor for the open mode.

> > method (send an-expandable-snip get-closed-editor) → (is-a?/c text%)

> Gets the editor for the closed mode.

top contents ← prev up next →