eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TriggerBox':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: TriggerBox


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--PanelView
               |
               +--HorizontalPanelView
                  |
                  +--CheckBox
                     |
                     +--TriggerBox

Package:
stx:libwidg2
Category:
Views-Interactors
Version:
rev: 1.4 date: 2017/11/28 18:27:39
user: cg
file: TriggerBox.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


A TriggerBox looks similar to a CheckBox (it contains a button and a label),
but does not show a check-icon.
Instead, a trigger button (unlabelled) performs a momentary action when pressed.


Instance protocol:

accessing-channels
o  triggerChannel: aValueHolder

initialization & release
o  defaultCheckToggleClass
Button

o  defaultControllerClass

o  initialize
must be called if redefined


Examples:


no-op TriggerBox without a label:
   |b|

   b := TriggerBox new.
   b open
no-op TriggerBox:
   |b|

   b := TriggerBox new.
   b label:'foo'.
   b open
combined instance creation & label setup:
   |b|

   b := TriggerBox label:'foo'.
   b open
no-op trigger, disabled:
   |b|

   b := TriggerBox label:'foo'.
   b disable.
   b open
using a trigger channel instead of a callback:
   |b holder|

   holder := TriggerValue new.
   holder onChangeEvaluate:[ Transcript showCR:'changed'].
   b := TriggerBox label:'foo'.
   b triggerChannel:holder.
   b open
changing colors
   |panel b|

   panel := VerticalPanelView new.

   b := TriggerBox label:'foo' in:panel.

   b := TriggerBox label:'bar' in:panel.
   b labelView foregroundColor:Color red.

   b := TriggerBox label:'baz' in:panel.
   b toggleView activeForegroundColor:Color blue.

   panel open
using action-blocks:
   |b|

   b := TriggerBox label:'check'.
   b action:[:value | Transcript show:'trigger called: '].
   b open.
with an enableChannel
   |b enaToggle enaHolder|

   enaHolder := true asValue.

   enaToggle := Toggle label:'enable'.
   enaToggle model:enaHolder.
   enaToggle open.

   b := TriggerBox label:'check'.
   b action:[:value | Transcript showCR:'triggered'].
   b enableChannel:enaHolder.
   b open.


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 16 Apr 2021 12:30:35 GMT