On this page:
switchable-button%
set-label-visible
command
Version: 4.1

12 Switchable Button

 (require mrlib/switchable-button)

switchable-button% : class?

  superclass: canvas%

A switchable-button% control displays and icon and a string label. It toggles between display of just the icon and a display with the label and the icon side-by-side.

(new switchable-button%

 

[label label]

 

 

 

[callback callback]

 

 

 

[bitmap bitmap]

 

 

 [

[alternate-bitmap alternate-bitmap]]

 

 

 

...superclass-args...)

 

  (is-a?/c switchable-button%)

  label : string?

  callback : (-> (is-a?/c switchable-button%) any/c)

  bitmap : (is-a?/c bitmap%)

  alternate-bitmap : (is-a?/c bitmap%) = bitmap

The callback is called when the button is pressed. The string and bitmap are used as discussed above.

If alternate-bitmap is supplied, then it is used when the button is switched to the view that just shows the bitmap. If it is not supplied, both modes show the same bitmap.

(send a-switchable-button set-label-visible visible?)  void?

  visible? : boolean?

Sets the visibility of the string part of the label.

(send a-switchable-button command)  void?

Calls the button’s callback function.