40 " |
40 " |
41 ! |
41 ! |
42 |
42 |
43 version |
43 version |
44 " |
44 " |
45 $Header: /cvs/stx/stx/libwidg/Attic/ChckTggle.st,v 1.7 1995-02-06 00:51:59 claus Exp $ |
45 $Header: /cvs/stx/stx/libwidg/Attic/ChckTggle.st,v 1.8 1995-05-03 00:28:49 claus Exp $ |
46 " |
46 " |
47 ! |
47 ! |
48 |
48 |
49 documentation |
49 documentation |
50 " |
50 " |
51 CheckButtons are like Toggles in toggling their state when pressed. |
51 CheckButtons are like Toggles in toggling their state when pressed. |
52 However, they show an ok-marker if on; nothing if off. |
52 However, they show an ok-marker if on; nothing if off. |
|
53 CheckButtons are mostly used as part of a checkBox (since normally, |
|
54 you want to have some label along the check) |
|
55 " |
|
56 ! |
|
57 |
|
58 examples |
|
59 " |
|
60 checkToggle alone: |
|
61 |
|
62 |top check| |
|
63 |
|
64 top := StandardSystemView new. |
|
65 top extent:100@100. |
|
66 |
|
67 check := CheckToggle in:top. |
|
68 check origin:10@10. |
|
69 |
|
70 top open |
|
71 |
|
72 give it an action: |
|
73 |
|
74 |top check| |
|
75 |
|
76 top := StandardSystemView new. |
|
77 top extent:100@100. |
|
78 |
|
79 check := CheckToggle in:top. |
|
80 check origin:10@10. |
|
81 check action:[:value | Transcript showCr:'changed to: ' , value printString]. |
|
82 |
|
83 top open |
|
84 |
|
85 give it a model: |
|
86 |
|
87 |top check model| |
|
88 |
|
89 model := false asValue. |
|
90 |
|
91 top := StandardSystemView new. |
|
92 top extent:100@100. |
|
93 |
|
94 check := CheckToggle in:top. |
|
95 check origin:10@10. |
|
96 check model:model. |
|
97 |
|
98 top openModal. |
|
99 |
|
100 Transcript showCr:'value after closing box: ' , model value printString |
|
101 |
|
102 multiple checks on a single model (with different change selectors): |
|
103 (using a checkBox here, for the demonstration ...) |
|
104 |
|
105 |top model panel ext1 ext2 |
|
106 readFlag writeFlag executeFlag| |
|
107 |
|
108 readFlag := writeFlag := true. |
|
109 executeFlag := false. |
|
110 |
|
111 model := Plug new. |
|
112 model respondTo:#read with:[readFlag]. |
|
113 model respondTo:#write with:[writeFlag]. |
|
114 model respondTo:#execute with:[executeFlag]. |
|
115 model respondTo:#read: with:[:val | readFlag := val]. |
|
116 model respondTo:#write: with:[:val | writeFlag := val]. |
|
117 model respondTo:#execute: with:[:val | executeFlag := val]. |
|
118 |
|
119 top := StandardSystemView new. |
|
120 top extent:200@200. |
|
121 top label:'File permissions:'. |
|
122 |
|
123 panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
124 |
|
125 #(read write execute) do:[:sym | |
|
126 |check| |
|
127 |
|
128 check := CheckBox in:panel. |
|
129 check label:sym. |
|
130 check model:model; aspect:sym; change:(sym , ':') asSymbol. |
|
131 ]. |
|
132 |
|
133 top openModal. |
|
134 |
|
135 Transcript showCr:'settings after closing box:'. |
|
136 Transcript showCr:' read -> ' , readFlag printString. |
|
137 Transcript showCr:' write -> ' , writeFlag printString. |
|
138 Transcript showCr:' execute -> ' , executeFlag printString. |
53 " |
139 " |
54 ! ! |
140 ! ! |
55 |
141 |
56 !CheckToggle class methodsFor:'defaults'! |
142 !CheckToggle class methodsFor:'defaults'! |
57 |
143 |