CheckToggle.st
changeset 593 86dd024ed773
parent 585 8f395aba0173
child 655 acad3ef3a46c
--- a/CheckToggle.st	Sat Apr 27 20:13:37 1996 +0200
+++ b/CheckToggle.st	Sat Apr 27 20:21:37 1996 +0200
@@ -70,140 +70,153 @@
         Claus Gittinger
 
     [see also:]
-        CheckBox  RadioButton  RadioButtonGroup Toggle Button
+        CheckBox RadioButton RadioButtonGroup Toggle Button
+        Dialog
+        ValueHolder TriggerValue
+        Block
 "
 !
 
 examples 
 "
     checkToggle alone:
+                                                                        [exBegin]
+        |top check|
 
-	|top check|
+        top := StandardSystemView new.
+        top extent:100@100.
 
-	top := StandardSystemView new.
-	top extent:100@100.
+        check := CheckToggle in:top.
+        check origin:10@10.
 
-	check := CheckToggle in:top.
-	check origin:10@10.
+        top open
+                                                                        [exEnd]
 
-	top open
 
     give it an action:
-
-	|top check|
+                                                                        [exBegin]
+        |top check|
 
-	top := StandardSystemView new.
-	top extent:100@100.
+        top := StandardSystemView new.
+        top extent:100@100.
 
-	check := CheckToggle in:top.
-	check origin:10@10.
-	check action:[:value | Transcript showCr:'changed to: ' , value printString].
+        check := CheckToggle in:top.
+        check origin:10@10.
+        check action:[:value | Transcript showCr:'changed to: ' , value printString].
 
-	top open
+        top open
+                                                                        [exEnd]
+
 
     give it a model:
-
-	|top check model|
+                                                                        [exBegin]
+        |top check model|
 
-	model := false asValue.
+        model := false asValue.
 
-	top := StandardSystemView new.
-	top extent:100@100.
+        top := StandardSystemView new.
+        top extent:100@100.
 
-	check := CheckToggle in:top.
-	check origin:10@10.
-	check model:model.
+        check := CheckToggle in:top.
+        check origin:10@10.
+        check model:model.
 
-	top openModal.
+        top openModal.
 
-	Transcript showCr:'value after closing box: ' , model value printString
+        Transcript showCr:'value after closing box: ' , model value printString
+                                                                        [exEnd]
+
 
     multiple checks on a single model (with different change selectors):
     (using a checkBox here, for the demonstration ...)
     (this is a typical many-in-many setup)
+                                                                        [exBegin]
+        |top model panel ext1 ext2
+         readFlag writeFlag executeFlag|
 
-	|top model panel ext1 ext2
-	 readFlag writeFlag executeFlag|
-
-	readFlag := writeFlag := true.
-	executeFlag := false.
+        readFlag := writeFlag := true.
+        executeFlag := false.
 
-	model := Plug new.
-	model respondTo:#read with:[readFlag].
-	model respondTo:#write with:[writeFlag].
-	model respondTo:#execute with:[executeFlag].
-	model respondTo:#read: with:[:val | readFlag := val].
-	model respondTo:#write: with:[:val | writeFlag := val].
-	model respondTo:#execute: with:[:val | executeFlag := val].
+        model := Plug new.
+        model respondTo:#read with:[readFlag].
+        model respondTo:#write with:[writeFlag].
+        model respondTo:#execute with:[executeFlag].
+        model respondTo:#read: with:[:val | readFlag := val].
+        model respondTo:#write: with:[:val | writeFlag := val].
+        model respondTo:#execute: with:[:val | executeFlag := val].
+
+        top := StandardSystemView new.
+        top extent:200@200.
+        top label:'File permissions:'.
 
-	top := StandardSystemView new.
-	top extent:200@200.
-	top label:'File permissions:'.
+        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
+        panel horizontalLayout:#leftSpace.
 
-	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-
-	#(read write execute) do:[:sym |
-	    |check|
+        #(read write execute) do:[:sym |
+            |check|
 
-	    check := CheckBox in:panel.
-	    check label:sym.
-	    check model:model; aspect:sym; changeMessage:(sym , ':') asSymbol.
-	].
+            check := CheckBox in:panel.
+            check label:sym.
+            check model:model; aspect:sym; changeMessage:(sym , ':') asSymbol.
+        ].
 
-	top openModal.
+        top openModal.
 
-	Transcript showCr:'settings after closing box:'.
-	Transcript showCr:'  read -> ' , readFlag printString.
-	Transcript showCr:'  write -> ' , writeFlag printString.
-	Transcript showCr:'  execute -> ' , executeFlag printString.
+        Transcript showCr:'settings after closing box:'.
+        Transcript showCr:'  read -> ' , readFlag printString.
+        Transcript showCr:'  write -> ' , writeFlag printString.
+        Transcript showCr:'  execute -> ' , executeFlag printString.
+                                                                        [exEnd]
 
 
-    checkToggles in a group
+    checkToggles in a group - now, they have RadioButton behavior.
     (this is a typical one-in-many setup)
-
-	|top panel check1 check2 check3 grp|
+                                                                        [exBegin]
+        |top panel check1 check2 check3 grp|
 
-	top := StandardSystemView new.
-	top extent:200@300.
+        top := StandardSystemView new.
+        top extent:200@300.
 
-	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
+        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
 
-	check1 := CheckToggle in:panel.
-	check2 := CheckToggle in:panel.
-	check3 := CheckToggle in:panel.
+        check1 := CheckToggle in:panel.
+        check2 := CheckToggle in:panel.
+        check3 := CheckToggle in:panel.
 
-	grp := RadioButtonGroup new.
-	grp add:check1.
-	grp add:check2.
-	grp add:check3.
+        grp := RadioButtonGroup new.
+        grp add:check1.
+        grp add:check2.
+        grp add:check3.
 
-	top open
+        top open
+                                                                        [exEnd]
 
 
      Channel operation 
      -----------------
 
        enabling other toggles via a toggle
-
-	|top panel t enableChannel|
+                                                                        [exBegin]
+        |top panel t enableChannel|
 
-	top := StandardSystemView new.
-	top extent:(400 @ 200).
+        top := StandardSystemView new.
+        top extent:(400 @ 200).
 
-	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
+        panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
 
-	enableChannel := false asValue.
+        enableChannel := false asValue.
 
-	1 to:10 do:[:i |
-	    t := CheckToggle in:panel.
-	    t enableChannel:enableChannel.
-	].
+        1 to:10 do:[:i |
+            t := CheckToggle in:panel.
+            t enableChannel:enableChannel.
+        ].
 
-	t := Toggle in:panel.
-	t activeLogo:'enabled'; passiveLogo:'disabled'.
-	t controller pressChannel:enableChannel.
+        t := Toggle in:panel.
+        t activeLogo:'enabled'; passiveLogo:'disabled'.
+        t pressChannel:enableChannel.
 
-	top open
+        top open
+                                                                        [exEnd]
 "
 ! !
 
@@ -356,5 +369,5 @@
 !CheckToggle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/CheckToggle.st,v 1.24 1996-04-25 17:22:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/CheckToggle.st,v 1.25 1996-04-27 18:16:52 cg Exp $'
 ! !