|
Class: TriggerBox
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
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.
copyrightCOPYRIGHT (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.
accessing-channels
-
triggerChannel: aValueHolder
-
initialization & release
-
defaultCheckToggleClass
-
Button
-
defaultControllerClass
-
-
initialize
-
must be called if redefined
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.
|
|