On this page:
stretchable-editor-snip-mixin
stretchable-editor-snip%
fixed-width-label-snip
tabbable-text<%>
set-caret-owner
set-ahead
set-back
tabbable-text-mixin
set-tabbing
grey-editor-snip-mixin
grey-editor-mixin
single-line-text-mixin
cue-text-mixin
cue-text%
clear-cue-text

4 Helpers

mixin

stretchable-editor-snip-mixin : (class? . -> . class?)

  argument extends/implements: editor-snip%
  result implements: stretchable-snip<%>
Extends an editor snip the stretchable-snip<%> interface, which allows it to be stretched to fit an alignment-parent<%>’s allotted width. Stretchable snips are useful as the snip of a snip-wrapper%

constructor

(new stretchable-editor-snip% 
    [[stretchable-width stretchable-width] 
    [stretchable-height stretchable-height]]) 
  (is-a?/c stretchable-editor-snip%)
  stretchable-width : boolean? = #t
  stretchable-height : boolean? = #t
Creates a stretchable snip with the given initial stretchability.

procedure

(fixed-width-label-snip possible-labels)  (subclass?/c snip%)

  possible-labels : (listof string?)
Returns a subclass of snip% that takes a single initialization argument. The argument provided when instantiating the class must be a member of possible-labels; the given label is displayed by the snip, but the snip is sized to match the longest of the labels in possible-labels.

In other words, the resulting class helps align multiple GUI elements t hat are labeled from a particular set of strings.

An interface for tabbing between embedded text%s.

method

(send a-tabbable-text set-caret-owner)  void?

Moves the caret into the tabbable-text<%>.

method

(send a-tabbable-text set-ahead)  void?

Called when tabbing ahead.

method

(send a-tabbable-text set-back)  void?

Called when tabbing backward.

mixin

tabbable-text-mixin : (class? . -> . class?)

  argument extends/implements: editor:keymap<%>
  result implements: tabbable-text<%>
Adds the tabbable-text<%> interface to an editor:text% class, where instantiation installs key bindings to tab ahead and backward

procedure

(set-tabbing a-text ...)  void?

  a-text : (is-a?/c tabbable-text<%>)
Sets the tabbing order of tabbable-text<%>s by setting each text’s set-ahead and set-back thunks to point to its neighbor in the argument list.

mixin

grey-editor-snip-mixin : (class? . -> . class?)

  argument extends/implements: editor-snip%
Gives an editor-snip% a colored background indicating that is disabled. The editor is not disabled by the mixin however, and must be locked separately.

mixin

grey-editor-mixin : (class? . -> . class?)

  argument extends/implements: editor<%>
Gives an editor<%> a colored background indicating that is disabled. The editor is not disabled by the mixin however, and must be locked separately.

mixin

single-line-text-mixin : (class? . -> . class?)

  argument extends/implements: editor:keymap<%>
Restricts a text to one line by overriding its key bindings to do nothing on enter.

mixin

cue-text-mixin : (class? . -> . class?)

  argument extends/implements: text%
Gives a text% an instantiation argument of a string that is displayed in the text% initially in grey; the text disappears when the text gets focus. This technique is useful for labeling texts without needing to take up space.

class

cue-text% : class?

  superclass: (cue-text-mixin text%)

constructor

(new cue-text%    
    [[cue-text cue-text]    
    [color color]    
    [behavior behavior]])  (is-a?/c cue-text%)
  cue-text : string? = ""
  color : string? = "gray"
  behavior : (listof (one-of/c 'on-focus 'on-char))
   = '(on-focus)
Creates an instance with the given initial content, color, and behvior for when to clear the text.

method

(send a-cue-text clear-cue-text)  void?

Clears the cue text, if it’s still present.