--- a/Toggle.st Fri May 12 20:25:18 1995 +0200
+++ b/Toggle.st Wed May 17 14:26:27 1995 +0200
@@ -23,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.16 1995-05-06 14:18:02 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.17 1995-05-17 12:26:23 claus Exp $
'!
!Toggle class methodsFor:'documentation'!
@@ -44,15 +44,15 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.16 1995-05-06 14:18:02 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.17 1995-05-17 12:26:23 claus Exp $
"
!
documentation
"
- this button changes state whenever pressed and stays pressed until pressed
- again. All the main action is in Button, Toggle just redefines buttonpress/
- release behavior.
+ this button changes state whenever clicked upon and stays down (pressed)
+ until clicked again. All the main action is in Button and the controller
+ (ToggleController).
The toggle may optionally display a little kind-of-lamp (or LED), which
is turned on when the toggle is pressed. (i.e. as in the Interviews toolkit).
@@ -61,7 +61,8 @@
pressAction or releaseAction.
For ST-80 compatibility, if the model is nonNil, this one gets a new
- value and is sent a changed message.
+ value and is sent a changed message. Also, the toggle will follow changes
+ in the model and update its display as appropriate.
If nonNil, the model is supposed to be a ValueHolder holding true or false.
@@ -80,12 +81,13 @@
examples
"
Examples:
- Try these, to see what is possible.
+ Try all, to see what is possible.
(notice, that these examples are meant to show what can be done;
usually, all style-related stuff is preinitialized - you should not
normally play around with onLevel, offLevel, showLamp: etc)
+
simple:
|v t|
@@ -96,6 +98,7 @@
t action:[:value | Transcript show:'toggle state: '; showCr:value.].
v open
+
separate press/release actions:
|v t|
@@ -107,6 +110,7 @@
t releaseAction:[Transcript showCr:'toggle released'.].
v open
+
changing logo:
|v t|
@@ -118,6 +122,7 @@
t releaseAction:[Transcript showCr:'larger'. t label:'eat me'].
v open
+
changing logo and freezing size (looks better):
|v t|
@@ -133,6 +138,7 @@
t releaseAction:[Transcript showCr:'larger'. t label:'eat me'].
v open
+
adding a lamp (in some view styles, this is the default anyway):
|v t|
@@ -145,6 +151,7 @@
t releaseAction:[Transcript showCr:'off'. t label:'off'].
v open
+
changing lamps color:
|v t|
@@ -158,6 +165,7 @@
t releaseAction:[Transcript showCr:'off'. t label:'off'.].
v open
+
changing lamps color & size:
|v t|
@@ -171,6 +179,7 @@
t releaseAction:[Transcript showCr:'off'. t label:'off'.].
v open
+
lamp only - no '3D going-in' (this is the default with IRIS style)
|v t|
@@ -184,6 +193,7 @@
t releaseAction:[Transcript showCr:'off'. t label:'off'].
v open
+
lamp and freezing size of the label (looks better):
|v t|
@@ -197,6 +207,7 @@
t releaseAction:[Transcript showCr:'off'. t label:'off'].
v open
+
another variation:
|v t|
@@ -211,6 +222,7 @@
t releaseAction:[Transcript showCr:'off'. t label:'off'].
v open
+
and another one:
|v t|
@@ -228,6 +240,7 @@
t releaseAction:[Transcript showCr:'off'. t showLamp:false. t label:'off'].
v open
+
another font:
|v t|
@@ -241,6 +254,7 @@
t releaseAction:[Transcript showCr:'off'.].
v open
+
another font (no, I dont know what it means :-):
|v t|
@@ -255,7 +269,8 @@
t releaseAction:[Transcript showCr:'off'.].
v open
- using a model (look at value of model in inspector):
+
+ using a model (look at 'value' in the inspector):
|m v t|
@@ -268,6 +283,7 @@
t model:m.
v open
+
using a model with different changeSelector:
|m v t|
@@ -284,6 +300,23 @@
t origin:10 @ 50.
t model:m; change:#setValue2:.
v open
+
+
+ two toggles on the same model:
+
+ |m v t|
+
+ m := true asValue.
+
+ v := StandardSystemView new extent:200@200.
+ t := Toggle label:'press here' in:v.
+ t origin:10 @ 10.
+ t model:m.
+
+ t := Toggle label:'or here' in:v.
+ t origin:10 @ 50.
+ t model:m.
+ v open
"
! !