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.6 date: 2021/01/20 13:00:55
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.

copyright

COPYRIGHT (c) 2013 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:58:14 GMT