author | Claus Gittinger <cg@exept.de> |
Mon, 02 Nov 2009 12:25:05 +0100 | |
changeset 4058 | 6c30a8f944f5 |
parent 3944 | d5ed8d618608 |
child 4093 | 9afc4af5a88a |
permissions | -rw-r--r-- |
76 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
13 |
|
76 | 14 |
ModalBox subclass:#DialogBox |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
15 |
instanceVariableNames:'buttonPanel okButton okAction abortButton abortAction |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
16 |
acceptReturnAsOK yPosition leftIndent rightIndent addedComponents |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
17 |
inputFieldGroup acceptOnLeave acceptValue tabableElements |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
18 |
hideOnAccept acceptCheck needResize autoAccept focusToOKOnLeave |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
19 |
bindings namedComponents verticalPanel' |
2439 | 20 |
classVariableNames:'DefaultFocusToOKOnLeave AboutToOpenBoxNotificationSignal' |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
21 |
poolDictionaries:'' |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
22 |
category:'Views-DialogBoxes' |
76 | 23 |
! |
24 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
25 |
!DialogBox class methodsFor:'documentation'! |
76 | 26 |
|
197 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
76 | 39 |
! |
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
this class implements the common behavior of dialogboxes. |
|
44 |
||
647 | 45 |
DialogBox is also a superclass of many other boxes - see InfoBox, |
76 | 46 |
WarningBox, YesNoBox etc. for concrete examples. |
47 |
Most of them simply add buttons or other elements. |
|
48 |
||
121 | 49 |
For programmatically created boxes, instances support adding of components |
50 |
in a top-to-bottom fashion, and also keep track of added text-fields and, |
|
51 |
since they are most common, automatically create an EnterFieldGroup for |
|
52 |
them. |
|
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
53 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
54 |
Caveat: |
3935 | 55 |
more adding support is required - especially for row-wise construction. |
56 |
The programmatic interface is best suited for row-wise |
|
57 |
arranged components; laying out elements in columns is a bit |
|
58 |
complicate - for complicated dialogs, it may be better to not use |
|
59 |
the automatic arrangement, but instead give explicit layouts to |
|
60 |
the components (in a subclass) or better use the UIPainter. |
|
122 | 61 |
|
600 | 62 |
Compatibility note: |
3935 | 63 |
For ST-80 compatibility, DialogBox is also accessable under |
64 |
the global named 'Dialog' (which is the name of an ST-80 class, |
|
65 |
providing a very similar protocol). |
|
66 |
This may lead to confusion, if DialogBox is recompiled - you have |
|
67 |
to manually assign Dialog again to refer to the new DialogBox class. |
|
68 |
In future versions of ST/X, DialogBox may be renamed to Dialog. |
|
600 | 69 |
|
183 | 70 |
Historic note: |
3935 | 71 |
originally, ST/X had separate classes for the various entry methods; |
72 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
73 |
ST-80 has all this defined in the common Dialog. |
|
74 |
Therefore, for compatibility, many ST/X methods defined here in Dialogs |
|
75 |
class protocol simply dispatch to some other boxes class method. |
|
76 |
In the future, those existing subclasses' functionality is going to |
|
77 |
be moved full into Dialog, and the subclasses will be replaced by dummy |
|
78 |
delegators. (They will be kept for backward compatibility, though). |
|
183 | 79 |
|
121 | 80 |
|
585 | 81 |
[instance variables:] |
76 | 82 |
|
3935 | 83 |
buttonPanel <PanelView> contains the button(s) |
84 |
||
85 |
okButton <Button> the ok-Button |
|
86 |
||
87 |
okAction <Block> the action to be performed when ok is pressed, |
|
88 |
or return is pressed. |
|
89 |
||
90 |
acceptReturnAsOK <Boolean> if true, pressing the return-key counts |
|
91 |
as if ok was pressed. Default is true. |
|
92 |
||
93 |
abortButton <Button> the cancel-Button |
|
94 |
||
95 |
abortAction <Block> the action to be performed when cancel is |
|
96 |
pressed. |
|
97 |
||
98 |
yPosisition <Integer> current y position when adding components |
|
99 |
||
100 |
leftIndent <Integer> left inset to use when adding components |
|
101 |
||
102 |
rightIndent <Integer> right inset to use when adding components |
|
103 |
||
104 |
addedComponents <Collection> programmatically added components |
|
105 |
||
106 |
inputFieldGroup <EnterFieldGroup> |
|
107 |
for added input fields |
|
108 |
||
109 |
acceptOnLeave <Boolean> if true (the default) and there are |
|
110 |
tabable inputFields, accept and close when |
|
111 |
the last field is left. If false, the ok |
|
112 |
button must be pressed to close the box. |
|
113 |
||
114 |
acceptedValue v(<Boolean>) valueHolder on a boolean |
|
115 |
after close: holds true if box was accepted |
|
116 |
(i.e. ok-Button was pressed), false if box was |
|
117 |
closed via cancel or window manager. |
|
118 |
||
119 |
autoAccept Boolean if true, pressing ok (or return) |
|
120 |
sends #accept to all subcomponents. |
|
121 |
I.e. all subfields update their models |
|
122 |
first. The default is true. |
|
123 |
||
124 |
variablePanel nil|VPanel an optional additional panel to be filled dynamically |
|
125 |
in an aboutToOpenNotification hook. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
126 |
|
100 | 127 |
For compatibility with ST-80, this class is also available under |
128 |
the global names DialogView and Dialog (see patches file). |
|
585 | 129 |
|
130 |
[author:] |
|
3935 | 131 |
Claus Gittinger |
593 | 132 |
|
133 |
[see also:] |
|
3935 | 134 |
Button CheckToggle Toggle |
135 |
EditField SelectionInListView FileSelectionList |
|
136 |
FramedBox Separator |
|
137 |
( introduction to view programming :html: programming/viewintro.html ) |
|
76 | 138 |
" |
139 |
! |
|
140 |
||
141 |
examples |
|
142 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
143 |
historically, DialogBox was used as an abstract class as a base for InfoBox, |
600 | 144 |
YesNoBox etc. |
145 |
However, the programmatic construction protocol (#addComponent:) |
|
146 |
now allows those classes to be easily replaced and future versions of |
|
147 |
ST/X may do this and make those subclasses obsolete. |
|
148 |
However, dummy stubs will remain to exist for backward compatibility |
|
149 |
(i.e. do not fear using YesNoBox, EnterBox etc.) |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
150 |
|
125 | 151 |
For most simple standard dialogs, there are ready to use |
152 |
methods in the class protocol. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
153 |
|
125 | 154 |
For example: |
155 |
||
156 |
info & warnings: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
157 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
158 |
Dialog information:'hi there' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
159 |
[exEnd] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
160 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
161 |
Dialog warn:'oops' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
162 |
[exEnd] |
125 | 163 |
|
164 |
||
165 |
yes/no questions: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
166 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
167 |
(Dialog confirm:'is this simple ?') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
168 |
ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
169 |
Transcript showCR:'thats what I expected' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
170 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
171 |
Transcript showCR:'read more examples and documentation' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
172 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
173 |
[exEnd] |
125 | 174 |
|
175 |
||
176 |
yes/no question with cancel option: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
177 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
178 |
|answer| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
179 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
180 |
answer := Dialog confirmWithCancel:'is this simple ?'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
181 |
answer isNil ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
182 |
Transcript showCR:'no easy decision' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
183 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
184 |
answer ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
185 |
Transcript showCR:'thats what I expected' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
186 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
187 |
Transcript showCR:'read more examples and documentation' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
188 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
189 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
190 |
[exEnd] |
125 | 191 |
|
192 |
||
193 |
asking for a string: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
194 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
195 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
196 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
197 |
s := Dialog request:'enter your name, please:'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
198 |
s notEmpty ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
199 |
Transcript showCR:'you entered: ' , s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
200 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
201 |
[exEnd] |
125 | 202 |
|
203 |
||
204 |
asking for a string with given default: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
205 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
206 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
207 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
208 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
209 |
request:'enter your name, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
210 |
initialAnswer:(OperatingSystem getLoginName). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
211 |
s notEmpty ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
212 |
Transcript showCR:'you entered: ' , s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
213 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
214 |
[exEnd] |
125 | 215 |
|
216 |
||
217 |
asking for a filename: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
218 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
219 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
220 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
221 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
222 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
223 |
default:''. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
224 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
225 |
[exEnd] |
125 | 226 |
|
227 |
||
1030 | 228 |
with a namefiler pattern: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
229 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
230 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
231 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
232 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
233 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
234 |
default:'' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
235 |
pattern:'*.rc'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
236 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
237 |
[exEnd] |
1030 | 238 |
|
239 |
||
240 |
another namefiler pattern: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
241 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
242 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
243 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
244 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
245 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
246 |
default:'' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
247 |
pattern:'*.rc;*.st;*.h'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
248 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
249 |
[exEnd] |
1030 | 250 |
|
251 |
||
125 | 252 |
with changed button label and pattern: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
253 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
254 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
255 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
256 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
257 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
258 |
default:'' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
259 |
ok:'show' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
260 |
abort:'cancel' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
261 |
pattern:'*.rc'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
262 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
263 |
[exEnd] |
125 | 264 |
|
302 | 265 |
|
266 |
asking for a password: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
267 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
268 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
269 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
270 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
271 |
requestPassword:'enter your secret, please:'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
272 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
273 |
[exEnd] |
302 | 274 |
|
645 | 275 |
multiple choice dialogs: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
276 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
277 |
Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
278 |
choose:'choose any' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
279 |
fromList:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
280 |
values:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
281 |
buttons:#('one' 'two' 'three' 'four') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
282 |
values:#(1 2 3 4) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
283 |
lines:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
284 |
cancel:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
285 |
[exEnd] |
645 | 286 |
|
287 |
multiple choice dialog, with list & buttons: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
288 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
289 |
Transcript showCR:( |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
290 |
Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
291 |
choose:'choose example' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
292 |
fromList:#('one' 'two' 'three' 'four') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
293 |
values:#(1 2 3 4) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
294 |
buttons:#('five' 'six' 'seven') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
295 |
values:#(5 6 7) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
296 |
lines:4 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
297 |
cancel:[Transcript flash. #aborted] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
298 |
) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
299 |
[exEnd] |
645 | 300 |
|
301 |
You can (and often have to) construct custom dialogs programmatically, |
|
302 |
from individual components. As shown in the following examples: |
|
91 | 303 |
|
121 | 304 |
basic (unusable) example: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
305 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
306 |
DialogBox new open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
307 |
[exEnd] |
76 | 308 |
|
121 | 309 |
still unusable - only an ok-button: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
310 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
311 |
DialogBox new addOkButton; open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
312 |
[exEnd] |
121 | 313 |
|
314 |
both ok- and abortButtons: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
315 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
316 |
DialogBox new addAbortButton; addOkButton; open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
317 |
[exEnd] |
121 | 318 |
|
122 | 319 |
with different ok-label: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
320 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
321 |
DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
322 |
[exEnd] |
122 | 323 |
|
645 | 324 |
adding a (centered by default) textlabel gives an infoBox: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
325 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
326 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
327 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
328 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
329 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
330 |
[exEnd] |
121 | 331 |
|
332 |
a textlabel with abort- and okButton gives a yesNoBox: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
333 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
334 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
335 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
336 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
337 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
338 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
339 |
[exEnd] |
121 | 340 |
|
341 |
the same, adjusting the labels contents to the left: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
342 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
343 |
|box| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
344 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
345 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
346 |
(box addTextLabel:'hello') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
347 |
box addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
348 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
349 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
350 |
[exEnd] |
121 | 351 |
|
122 | 352 |
with modified buttons: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
353 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
354 |
|box| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
355 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
356 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
357 |
(box addTextLabel:'are you certain ?') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
358 |
box addAbortButtonLabelled:'not really'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
359 |
(box addOkButtonLabelled:'yes, absolutely') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
360 |
activeBackgroundColor:Color red. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
361 |
box open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
362 |
[exEnd] |
122 | 363 |
|
364 |
||
645 | 365 |
mswindows style (different up/down bitmaps in buttons): |
366 |
((try tabbing ...) |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
367 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
368 |
|b box| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
369 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
370 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
371 |
(box addTextLabel:'are you certain ?') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
372 |
b := Button new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
373 |
b activeLogo:(Image fromFile:'cancel_down.bmp' inPackage:'stx:goodies/bitmaps/winImages'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
374 |
b passiveLogo:(Image fromFile:'cancel_up.bmp' inPackage:'stx:goodies/bitmaps/winImages'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
375 |
b focusLogo:(Image fromFile:'cancel_focus.bmp' inPackage:'stx:goodies/bitmaps/winImages'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
376 |
b beImageButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
377 |
box addAbortButton:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
378 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
379 |
b := Button new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
380 |
b activeLogo:(Image fromFile:'ok_down.bmp' inPackage:'stx:goodies/bitmaps/winImages'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
381 |
b passiveLogo:(Image fromFile:'ok_up.bmp' inPackage:'stx:goodies/bitmaps/winImages'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
382 |
b focusLogo:(Image fromFile:'ok_focus.bmp' inPackage:'stx:goodies/bitmaps/winImages'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
383 |
b beImageButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
384 |
box addOkButton:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
385 |
box open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
386 |
[exEnd] |
162 | 387 |
|
388 |
||
121 | 389 |
two textlabels: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
390 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
391 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
392 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
393 |
addTextLabel:'world'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
394 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
395 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
396 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
397 |
[exEnd] |
118 | 398 |
|
121 | 399 |
fixing the dialogs size (suppres it calculating its size from the |
130 | 400 |
preferredExtents of its components): |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
401 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
402 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
403 |
label:'a simple dialog'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
404 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
405 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
406 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
407 |
extent:200@200; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
408 |
sizeFixed:true; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
409 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
410 |
[exEnd] |
118 | 411 |
|
121 | 412 |
asking the box if it was closed via ok: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
413 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
414 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
415 |
label:'a simple dialog'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
416 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
417 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
418 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
419 |
extent:200@200; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
420 |
sizeFixed:true; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
421 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
422 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
423 |
Transcript showCR:'yes' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
424 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
425 |
Transcript showCR:'no' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
426 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
427 |
[exEnd] |
118 | 428 |
|
121 | 429 |
textLabels are not limited to strings (although, the name which is |
430 |
used for ST-80 compatibility, suggests it): |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
431 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
432 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
433 |
addTextLabel:(Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages'); |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
434 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
435 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
436 |
[exEnd] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
437 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
438 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
439 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
440 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
441 |
addTextLabel:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
442 |
magnifiedTo:200@150); |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
443 |
addTextLabel:'world'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
444 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
445 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
446 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
447 |
[exEnd] |
120 | 448 |
|
121 | 449 |
adding an input field (on a string model): |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
450 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
451 |
|stringModel| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
452 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
453 |
stringModel := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
454 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
455 |
addTextLabel:'Please enter a string:'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
456 |
addInputFieldOn:stringModel; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
457 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
458 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
459 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
460 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
461 |
Transcript showCR:'entered: ', stringModel value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
462 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
463 |
[exEnd] |
120 | 464 |
|
465 |
||
121 | 466 |
multiple input fields (notice, that the dialog connects the fields |
467 |
in a group, so stepping is allowed via Cursor and Return keys): |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
468 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
469 |
|firstName lastName| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
470 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
471 |
firstName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
472 |
lastName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
473 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
474 |
addTextLabel:'Please enter your name:'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
475 |
addInputFieldOn:firstName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
476 |
addVerticalSpace; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
477 |
addInputFieldOn:lastName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
478 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
479 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
480 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
481 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
482 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
483 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
484 |
[exEnd] |
121 | 485 |
|
486 |
||
487 |
of course, the model may contain a value initially: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
488 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
489 |
|firstName lastName p line i name| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
490 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
491 |
firstName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
492 |
lastName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
493 |
p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
494 |
p notNil ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
495 |
line := p nextLine. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
496 |
(i := line findString:'Name:') ~~ 0 ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
497 |
name := line copyFrom:(i + 'Name:' size). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
498 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
499 |
(i := line findString:'real life:') == 0 ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
500 |
line := p nextLine. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
501 |
]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
502 |
(i := line findString:'real life:') ~~ 0 ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
503 |
name := line copyFrom:(i + 'real life:' size). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
504 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
505 |
]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
506 |
name notNil ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
507 |
firstName value: name asCollectionOfWords first. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
508 |
lastName value: name asCollectionOfWords last. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
509 |
Transcript showCR:'initially ' , firstName value , ' ' , lastName value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
510 |
]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
511 |
p close. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
512 |
]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
513 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
514 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
515 |
addTextLabel:'Please enter your name:'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
516 |
addInputFieldOn:firstName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
517 |
addVerticalSpace; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
518 |
addInputFieldOn:lastName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
519 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
520 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
521 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
522 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
523 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
524 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
525 |
[exEnd] |
121 | 526 |
|
120 | 527 |
|
302 | 528 |
validated password entry: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
529 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
530 |
|box firstEntry secondEntry| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
531 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
532 |
firstEntry := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
533 |
secondEntry := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
534 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
535 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
536 |
(box addTextLabel:'Please enter your secret:') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
537 |
(box addInputFieldOn:firstEntry) passwordCharacter:$*. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
538 |
box addVerticalSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
539 |
(box addInputFieldOn:secondEntry) passwordCharacter:$*. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
540 |
box addAbortButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
541 |
box addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
542 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
543 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
544 |
firstEntry value ~= secondEntry value ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
545 |
Transcript showCR:'wrong input - try again' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
546 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
547 |
Transcript showCR:'entered: ', firstEntry value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
548 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
549 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
550 |
[exEnd] |
593 | 551 |
|
552 |
input fields with a label: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
553 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
554 |
|box firstNameHolder middleNameHolder lastNameHolder| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
555 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
556 |
firstNameHolder := 'John' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
557 |
middleNameHolder := 'F' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
558 |
lastNameHolder := 'Peters' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
559 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
560 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
561 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
562 |
addLabelledInputField:'first name:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
563 |
adjust:#right |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
564 |
on:firstNameHolder |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
565 |
tabable:true |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
566 |
separateAtX:0.4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
567 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
568 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
569 |
addLabelledInputField:'middle initial:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
570 |
adjust:#right |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
571 |
on:middleNameHolder |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
572 |
tabable:true |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
573 |
separateAtX:0.4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
574 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
575 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
576 |
addLabelledInputField:'last name:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
577 |
adjust:#right |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
578 |
on:lastNameHolder |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
579 |
tabable:true |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
580 |
separateAtX:0.4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
581 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
582 |
box addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
583 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
584 |
[exEnd] |
593 | 585 |
|
586 |
||
587 |
constructing a dialog from other elements: |
|
121 | 588 |
adding a fileSelectionList: |
589 |
(since the dialog adds the component with its preferred extent, |
|
590 |
ignoring the 300-height, this looks ugly ... |
|
591 |
... especially when resized vertically) |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
592 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
593 |
|top l scr fileName| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
594 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
595 |
fileName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
596 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
597 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
598 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
599 |
l := FileSelectionList new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
600 |
l useIndex:false. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
601 |
l doubleClickAction:[:name | top okPressed]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
602 |
l action:[:name | fileName value:name]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
603 |
scr := ScrollableView forView:l. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
604 |
scr extent:(1.0 @ 300). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
605 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
606 |
top addComponent:scr. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
607 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
608 |
top openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
609 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
610 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
611 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
612 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
613 |
[exEnd] |
121 | 614 |
|
615 |
same, looks better, since the height is made larger (not using |
|
616 |
fileLists preferredExtent): |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
617 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
618 |
|top l scr fileName| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
619 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
620 |
fileName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
621 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
622 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
623 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
624 |
l := FileSelectionList new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
625 |
l useIndex:false. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
626 |
l doubleClickAction:[:name | top okPressed]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
627 |
l action:[:name | fileName value:name]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
628 |
scr := ScrollableView forView:l. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
629 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
630 |
top addComponent:scr withExtent:300@300. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
631 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
632 |
top openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
633 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
634 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
635 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
636 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
637 |
[exEnd] |
121 | 638 |
|
639 |
||
640 |
again, setting the boxes initial size and fixing it |
|
130 | 641 |
(let it ignore the components' preferredExtent): |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
642 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
643 |
|top fixFrame l scr fileName| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
644 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
645 |
fileName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
646 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
647 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
648 |
top extent:300@300. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
649 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
650 |
fixFrame := View new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
651 |
fixFrame extent:(1.0 @ 300). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
652 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
653 |
l := FileSelectionList new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
654 |
l useIndex:false. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
655 |
l doubleClickAction:[:name | top okPressed]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
656 |
l action:[:name | fileName value:name]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
657 |
scr := ScrollableView forView:l. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
658 |
scr origin:0.0@0.0 corner:1.0@1.0. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
659 |
fixFrame add:scr. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
660 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
661 |
top addComponent:fixFrame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
662 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
663 |
top openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
664 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
665 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
666 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
667 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
668 |
[exEnd] |
118 | 669 |
|
670 |
||
671 |
adding a panel with checkBoxes: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
672 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
673 |
|top panel b value1 value2 value3 value4| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
674 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
675 |
value1 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
676 |
value2 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
677 |
value3 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
678 |
value4 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
679 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
680 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
681 |
top extent:200@300. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
682 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
683 |
panel := VerticalPanelView new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
684 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
685 |
b := CheckBox on:value1. b label:'check1'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
686 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
687 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
688 |
b := CheckBox on:value2. b label:'check2'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
689 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
690 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
691 |
b := CheckBox on:value3. b label:'check3'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
692 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
693 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
694 |
b := CheckBox on:value4. b label:'check4'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
695 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
696 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
697 |
top addComponent:panel. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
698 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
699 |
top open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
700 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
701 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
702 |
Transcript show:'value1: '; showCR:value1 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
703 |
Transcript show:'value2: '; showCR:value2 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
704 |
Transcript show:'value3: '; showCR:value3 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
705 |
Transcript show:'value4: '; showCR:value4 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
706 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
707 |
[exEnd] |
118 | 708 |
|
120 | 709 |
same, using a more convenient interface: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
710 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
711 |
|box value1 value2 value3 value4| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
712 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
713 |
value1 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
714 |
value2 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
715 |
value3 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
716 |
value4 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
717 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
718 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
719 |
box extent:200@300. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
720 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
721 |
box addCheckBox:'check1' on:value1. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
722 |
box addVerticalSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
723 |
box addCheckBox:'check2' on:value2. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
724 |
box addVerticalSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
725 |
box addCheckBox:'check3' on:value3. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
726 |
box addVerticalSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
727 |
box addCheckBox:'check4' on:value4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
728 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
729 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
730 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
731 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
732 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
733 |
Transcript show:'value1: '; showCR:value1 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
734 |
Transcript show:'value2: '; showCR:value2 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
735 |
Transcript show:'value3: '; showCR:value3 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
736 |
Transcript show:'value4: '; showCR:value4 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
737 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
738 |
[exEnd] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
739 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
740 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
741 |
same, using an even better interface: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
742 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
743 |
|box values labels| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
744 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
745 |
values := #(true false false true) collect:[:val | val asValue]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
746 |
labels := #('check1' 'check2' 'check3' 'check4'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
747 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
748 |
box := Dialog new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
749 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
750 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
751 |
addColumn:(1 to:labels size) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
752 |
fromX:0.0 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
753 |
toX:1.0 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
754 |
collect:[:index | CheckBox label:(labels at:index) model:(values at:index)] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
755 |
tabable:true. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
756 |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
757 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
758 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
759 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
760 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
761 |
values with:labels do:[:val :lbl | |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
762 |
Transcript show:(lbl , ': '); showCR:val value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
763 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
764 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
765 |
[exEnd] |
126 | 766 |
|
767 |
||
164 | 768 |
adding two panels in a frame: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
769 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
770 |
|box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
771 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
772 |
box := Dialog new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
773 |
box label:'example'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
774 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
775 |
frame := FramedBox label:'frame'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
776 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
777 |
vPanel1 := VerticalPanelView origin:0.0@0.0 corner:0.5@1.0 in:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
778 |
vPanel1 horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
779 |
vPanel1 verticalLayout:#spreadSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
780 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
781 |
vPanel2 := VerticalPanelView origin:0.5@0.0 corner:1.0@1.0 in:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
782 |
vPanel2 horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
783 |
vPanel2 verticalLayout:#spreadSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
784 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
785 |
m1 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
786 |
m2 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
787 |
m3 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
788 |
m4 := 'hello' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
789 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
790 |
vPanel1 add:(Label label:'check1'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
791 |
vPanel1 add:(Label label:'m2'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
792 |
vPanel1 add:(Label label:'m3'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
793 |
vPanel1 add:(Label label:'enter'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
794 |
vPanel1 add:(Label label:'lbl1'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
795 |
vPanel1 add:(Label label:'lbl2'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
796 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
797 |
vPanel2 add:(chk := CheckToggle on:m1). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
798 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
799 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
800 |
vPanel2 add:(chk := CheckToggle on:m2). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
801 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
802 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
803 |
vPanel2 add:(chk := CheckToggle on:m3). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
804 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
805 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
806 |
vPanel2 add:(chk := CheckToggle on:m3). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
807 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
808 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
809 |
vPanel2 add:(chk := CheckToggle on:m3). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
810 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
811 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
812 |
vPanel2 add:(ef := EditField on:m4). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
813 |
ef immediateAccept:true. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
814 |
box makeTabable:ef. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
815 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
816 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
817 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
818 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
819 |
box openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
820 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
821 |
Transcript showCR:'accepted with:'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
822 |
Transcript showCR:' m1: ' , m1 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
823 |
Transcript showCR:' m2: ' , m2 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
824 |
Transcript showCR:' m3: ' , m3 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
825 |
Transcript showCR:' m4: ' , m4 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
826 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
827 |
[exEnd] |
593 | 828 |
|
829 |
||
830 |
||
831 |
a full example (combined settings dialog - as in launcher): |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
832 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
833 |
|box warnSTX allowUnderscore immutableArrays logDoits |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
834 |
listOfLanguages listOfStyles styleNames |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
835 |
frame panel c resourceDir dir | |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
836 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
837 |
warnSTX := Compiler warnSTXSpecials asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
838 |
allowUnderscore := Compiler allowUnderscoreInIdentifier asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
839 |
immutableArrays := Compiler arraysAreImmutable asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
840 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
841 |
logDoits := Smalltalk logDoits asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
842 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
843 |
listOfLanguages := SelectionInList with:#('english' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
844 |
'french' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
845 |
'german' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
846 |
'italian' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
847 |
'spanish' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
848 |
). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
849 |
listOfLanguages selection:(Language asString). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
850 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
851 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
852 |
resourceDir := Smalltalk getSystemFileName:'resources'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
853 |
dir := FileDirectory directoryNamed:resourceDir. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
854 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
855 |
styleNames := dir select:[:aFileName | aFileName endsWith:'.style']. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
856 |
styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
857 |
listOfStyles := SelectionInList with:styleNames sort. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
858 |
listOfStyles selection:(View defaultStyle asString). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
859 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
860 |
box := Dialog new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
861 |
box label:'Settings'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
862 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
863 |
frame := FramedBox label:'Compiler'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
864 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
865 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
866 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
867 |
panel add:((CheckBox on:warnSTX) label:'warn about ST/X language extensions'; resize). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
868 |
panel add:((CheckBox on:allowUnderscore) label:'allow underscore in identifiers'; resize). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
869 |
panel add:((CheckBox on:immutableArrays) label:'literal arrays are immutable'; resize). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
870 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
871 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
872 |
frame := FramedBox label:'Misc'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
873 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
874 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
875 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
876 |
panel add:((CheckBox on:logDoits) label:'log doIts in changes file'; resize). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
877 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
878 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
879 |
frame := FramedBox label:'Language'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
880 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
881 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
882 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
883 |
panel add:((PopUpList on:listOfLanguages) width:0.5). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
884 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
885 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
886 |
frame := FramedBox label:'Style'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
887 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
888 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
889 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
890 |
panel add:((PopUpList on:listOfStyles) width:0.5). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
891 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
892 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
893 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
894 |
box showAtPointer. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
895 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
896 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
897 |
Transcript topView withCursor:Cursor wait do:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
898 |
Compiler warnSTXSpecials:warnSTX value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
899 |
Compiler allowUnderscoreInIdentifier:allowUnderscore value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
900 |
Compiler arraysAreImmutable:immutableArrays value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
901 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
902 |
Smalltalk logDoits:logDoits value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
903 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
904 |
Transcript showCR:'change language to ' , listOfLanguages selection , ' ...'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
905 |
Smalltalk at:#Language put:listOfLanguages selection asSymbol. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
906 |
Smalltalk changed:#Language. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
907 |
ResourcePack flushCachedResourcePacks. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
908 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
909 |
Transcript showCR:'change style to ' , listOfStyles selection , ' ...'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
910 |
View defaultStyle:listOfStyles selection asSymbol. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
911 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
912 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
913 |
[exEnd] |
625 | 914 |
an example from Hopkins/Horan: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
915 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
916 |
|aText index| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
917 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
918 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
919 |
index := aText findString:'Smalltalk/X' startingAt:1. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
920 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
921 |
to:'Smalltalk/X' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
922 |
with:#bold. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
923 |
index := aText findString:'Introduction' startingAt:index. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
924 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
925 |
to:'Introduction' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
926 |
with:#italic. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
927 |
Dialog warn:aText |
625 | 928 |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
929 |
[exEnd] |
625 | 930 |
the same, with colors: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
931 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
932 |
|aText index| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
933 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
934 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
935 |
index := aText findString:'Smalltalk/X' startingAt:1. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
936 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
937 |
to:'Smalltalk/X' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
938 |
with:(Array with:#bold with:#underline with:(#color->Color red)). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
939 |
index := aText findString:'Introduction' startingAt:index. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
940 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
941 |
to:'Introduction' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
942 |
with:#italic. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
943 |
Dialog warn:aText |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
944 |
[exEnd] |
76 | 945 |
" |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
946 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
947 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
948 |
inputFocus |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
949 |
" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
950 |
a DialogBox with multiple input fields can be configured on how it |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
951 |
shall behave if the RETURN key is pressed. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
952 |
|
600 | 953 |
The default is to shift the focus to the ok-button - thus, another return |
954 |
has to be entered (as confirmation) to close & accept the box. |
|
955 |
||
956 |
This can be changed to force an automatic OK with: |
|
1401 | 957 |
aBox focusToOKOnLeave:false |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
958 |
|
600 | 959 |
Then, leaving the last field with return, automatically accepts the box, |
960 |
as if ok was pressed. (useful for simple - single entry dialogs). |
|
961 |
All simple dialogs (like 'enter a searchString') behave this way. |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
962 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
963 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
964 |
With: |
1401 | 965 |
aBox acceptReturnAsOK:false |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
966 |
|
600 | 967 |
any focusShift or automatic OK is turned off, and the input group |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
968 |
switches its focus back to the topMost field. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
969 |
The default for this is true. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
970 |
(useful, if you want an explicit ok from the user, or need all fields |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
971 |
to be handled somehow). |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
972 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
973 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
974 |
Simply leaving the group with a cursor movement may also be either |
600 | 975 |
interpreted as a return (the default), or again wrap back to the top |
976 |
of the group. |
|
977 |
||
978 |
With: |
|
1401 | 979 |
aBox acceptOnLeave:false |
600 | 980 |
this is turned off, so that with cursor-down, the focus is moved back |
981 |
to the first entry field. The default is true. |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
982 |
" |
76 | 983 |
! ! |
984 |
||
2768 | 985 |
!DialogBox class methodsFor:'Compatibility-VW'! |
1371 | 986 |
|
987 |
choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock for:aView |
|
988 |
"launch a Dialog showing the message and list. |
|
989 |
The user can select an item and click ok; in this case, the corresponding value |
|
990 |
from listValues is returned (doubleclick works as well). |
|
991 |
If cancel is pressed, the value of cancelBlock is returned. |
|
992 |
Pressing ok without a selection is treated like cancel. |
|
993 |
This is a new VW2.5 interface - passing an addtional argument. |
|
994 |
In ST/X, this is not needed and ignored" |
|
995 |
||
996 |
^ self |
|
1401 | 997 |
choose:aString |
998 |
fromList:list |
|
999 |
values:listValues |
|
1000 |
lines:maxLines |
|
1001 |
cancel:cancelBlock |
|
1371 | 1002 |
|
1003 |
" |
|
1004 |
Transcript showCR:( |
|
1401 | 1005 |
Dialog |
1006 |
choose:'choose any' |
|
1007 |
fromList:#('one' 'two' 'three' 'four') |
|
1008 |
values:#(1 2 3 4) |
|
1009 |
lines:4 |
|
1010 |
cancel:nil |
|
1371 | 1011 |
) |
1012 |
||
1013 |
Transcript showCR:( |
|
1401 | 1014 |
Dialog |
1015 |
choose:'choose example' |
|
1016 |
fromList:#('one' 'two' 'three' 'four') |
|
1017 |
values:#(1 2 3 4) |
|
1018 |
lines:4 |
|
1019 |
cancel:[Transcript flash. #aborted] |
|
1371 | 1020 |
) |
1021 |
" |
|
1022 |
||
1023 |
"Created: / 1.11.1997 / 13:21:32 / cg" |
|
1024 |
"Modified: / 1.11.1997 / 13:21:54 / cg" |
|
1025 |
! |
|
1102 | 1026 |
|
1027 |
confirm:aMessageString for:ignoredView |
|
1371 | 1028 |
"VW compatibility - confirm using the same viewStyle as in the view |
1102 | 1029 |
argument; not supported in ST/X (who mixes styles ?)" |
1030 |
||
3456 | 1031 |
^ self |
1032 |
confirm:aMessageString |
|
1033 |
title:nil |
|
1034 |
yesLabel:nil noLabel:nil |
|
1035 |
initialAnswer:true. |
|
1036 |
||
1037 |
"Created: / 06-03-1997 / 15:45:54 / cg" |
|
1038 |
"Modified: / 02-03-2007 / 15:25:15 / cg" |
|
1371 | 1039 |
! |
1040 |
||
1041 |
request:aString for:aView |
|
1042 |
"launch a Dialog, which allows user to enter something. |
|
1043 |
Return the entered string (may be empty string) |
|
1044 |
or the empty string (if cancel was pressed), |
|
1045 |
This is a new VW2.5 interface - passing an addtional argument. |
|
1046 |
In ST/X, this is not needed and ignored" |
|
1047 |
||
1048 |
^ self |
|
1401 | 1049 |
request:aString |
1371 | 1050 |
|
1051 |
"Created: / 31.10.1997 / 03:26:32 / cg" |
|
1052 |
"Modified: / 31.10.1997 / 11:53:50 / cg" |
|
1053 |
! |
|
1054 |
||
1055 |
request:aString initialAnswer:initial for:aView |
|
1056 |
"launch a Dialog, which allows user to enter something. |
|
1057 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
1058 |
This is a new VW2.5 interface - passing an addtional argument. |
|
1059 |
In ST/X, this is not needed and ignored" |
|
1060 |
||
1061 |
^ self |
|
1401 | 1062 |
request:aString |
1063 |
initialAnswer:initial |
|
1371 | 1064 |
|
1065 |
"Modified: / 29.5.1996 / 14:30:05 / cg" |
|
1066 |
"Created: / 1.11.1997 / 13:18:29 / cg" |
|
1067 |
! |
|
1068 |
||
1069 |
requestFileName:title default:default version:versionSym ifFail:failBlock for:aViewOrNil |
|
1070 |
"new VW2.5 interface - passing an addtional argument. |
|
1071 |
In ST/X, this is not needed and ignored" |
|
1072 |
||
1073 |
^ self |
|
1401 | 1074 |
requestFileName:title default:default version:versionSym ifFail:failBlock |
1371 | 1075 |
|
1076 |
"Created: / 31.10.1997 / 02:00:42 / cg" |
|
1077 |
"Modified: / 31.10.1997 / 11:52:53 / cg" |
|
1102 | 1078 |
! |
1079 |
||
1080 |
warn:aMessageString for:ignoredView |
|
1371 | 1081 |
"VW compatibility - warn using the same viewStyle as in the view |
1102 | 1082 |
argument; not supported in ST/X (who mixes styles ?)" |
1083 |
||
1084 |
^ self warn:aMessageString |
|
1085 |
||
1371 | 1086 |
"Created: / 6.3.1997 / 15:46:02 / cg" |
1087 |
"Modified: / 31.10.1997 / 11:54:35 / cg" |
|
1102 | 1088 |
! ! |
1089 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1090 |
!DialogBox class methodsFor:'class initialization'! |
498 | 1091 |
|
1092 |
initialize |
|
528
3ed1f0b5a0bb
oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
1093 |
self == DialogBox ifTrue:[ |
1757 | 1094 |
Dialog := self |
1095 |
]. |
|
1096 |
||
1097 |
DefaultFocusToOKOnLeave := false. |
|
3902
eb4576429ff0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
3888
diff
changeset
|
1098 |
|
eb4576429ff0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
3888
diff
changeset
|
1099 |
"/ for backward whitebox compatibility (customer subclasses which access the classVar directly) |
eb4576429ff0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
3888
diff
changeset
|
1100 |
AboutToOpenBoxNotificationSignal := SimpleView aboutToOpenBoxNotificationSignal |
498 | 1101 |
! ! |
1102 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1103 |
!DialogBox class methodsFor:'common dialogs'! |
100 | 1104 |
|
2479 | 1105 |
about:text label:label icon:image |
1106 |
"opens an standard about box for an application." |
|
1107 |
||
1108 |
|box| |
|
1109 |
||
1110 |
AboutBox isNil ifTrue:[ |
|
1111 |
"/ this handles bad installations of ST/X, |
|
1112 |
"/ where the AboutBox is missing. |
|
1113 |
"/ (May vanish in the future) |
|
1114 |
^ self information:text |
|
1115 |
]. |
|
1116 |
||
1117 |
box := AboutBox title:text. |
|
1118 |
||
2672 | 1119 |
box image:image. |
2479 | 1120 |
box label:label. |
1121 |
box autoHideAfter:10 with:[]. |
|
3548
7cc719de254f
aboutToObenBoxNotification for aboutBox
Claus Gittinger <cg@exept.de>
parents:
3538
diff
changeset
|
1122 |
self showAndThenDestroyBox:box. |
7cc719de254f
aboutToObenBoxNotification for aboutBox
Claus Gittinger <cg@exept.de>
parents:
3538
diff
changeset
|
1123 |
"/ box open. |
2479 | 1124 |
|
1125 |
"Created: / 17.11.2001 / 23:04:53 / cg" |
|
1126 |
"Modified: / 17.11.2001 / 23:06:06 / cg" |
|
1127 |
! |
|
1128 |
||
2499 | 1129 |
aboutClass:aClass |
1130 |
"opens astandard (simple) aboutBox for aClass." |
|
1131 |
||
1132 |
|rev clsRev msg resources| |
|
1133 |
||
1134 |
rev := ''. |
|
1135 |
||
1136 |
(clsRev := aClass revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
|
1137 |
resources := aClass classResources. |
|
1138 |
||
1139 |
msg := '\' withCRs , aClass name asBoldText, rev. |
|
1140 |
||
1141 |
self |
|
1142 |
about:(resources string:msg) |
|
1143 |
label:(resources string:'About ' , aClass nameWithoutPrefix) |
|
3629
e4ff4d031bbc
allow for different icon to be used for about boxes
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
1144 |
icon:aClass defaultIconForAboutBox |
2499 | 1145 |
! |
1146 |
||
1703
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1147 |
informUser:aString during:aBlock |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1148 |
"show a message-box while executing aBlock" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1149 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1150 |
|box| |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1151 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1152 |
[ |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1153 |
box := InfoBox title:aString. |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1154 |
box hideButtons. |
2439 | 1155 |
self showBox:box. "/ box showAtPointer. |
1704
304ccbc56ec4
fixed #informUser:during: in case of timeSlicer not running.
Claus Gittinger <cg@exept.de>
parents:
1703
diff
changeset
|
1156 |
] forkAt:(Processor activePriority + 1). |
2522
d80496af7eaf
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2517
diff
changeset
|
1157 |
aBlock ensure:[box destroy] |
1703
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1158 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1159 |
" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1160 |
Dialog informUser:'wait a second...' during:[Delay waitForSeconds:1] |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1161 |
Dialog informUser:'wait a few seconds...' during:[10000 factorial] |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1162 |
" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1163 |
! |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1164 |
|
2622 | 1165 |
informUser:aString during:aBlock cancel:canCancel |
1166 |
"show a message-box while executing aBlock" |
|
1167 |
||
1168 |
|box subProcess| |
|
1169 |
||
1170 |
box := InfoBox title:aString. |
|
1171 |
canCancel ifTrue:[ |
|
2640
2672ec342e7e
Do not refer to uninitialized ClassResources
Stefan Vogel <sv@exept.de>
parents:
2637
diff
changeset
|
1172 |
box okText:(self classResources string:'Abort'). |
2622 | 1173 |
] ifFalse:[ |
1174 |
box hideButtons. |
|
1175 |
]. |
|
1176 |
||
1177 |
subProcess := [ |
|
1178 |
aBlock ensure:[box destroy] |
|
1179 |
] forkAt:(Processor activePriority - 1). |
|
1180 |
||
1181 |
self showBox:box. |
|
1182 |
subProcess terminate. |
|
1183 |
||
1184 |
||
1185 |
" |
|
1186 |
Dialog informUser:'don''t wait ...' during:[true] cancel:true |
|
3137 | 1187 |
Dialog informUser:'please wait a second...' during:[Delay waitForSeconds:1] cancel:true |
1188 |
Dialog informUser:'please wait, while I compute 30000 factorial...' during:[30000 factorial] cancel:true |
|
2622 | 1189 |
" |
1190 |
! |
|
1191 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1192 |
information:aString |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1193 |
"launch a Dialog to tell user something" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1194 |
|
2493 | 1195 |
|currentScreen| |
1196 |
||
2781 | 1197 |
((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[ |
2493 | 1198 |
^ currentScreen |
1199 |
nativeInformationOK:aString |
|
1200 |
title:aString |
|
1201 |
]. |
|
2439 | 1202 |
self showAndThenDestroyBox:(InfoBox title:aString) |
197 | 1203 |
|
1204 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1205 |
Dialog information:'help' |
197 | 1206 |
" |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1207 |
|
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1208 |
"Modified: 29.5.1996 / 15:23:03 / cg" |
197 | 1209 |
! |
1210 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1211 |
warn:aString |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1212 |
"launch a Dialog to warn user" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1213 |
|
2493 | 1214 |
|currentScreen| |
1215 |
||
2781 | 1216 |
((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[ |
2493 | 1217 |
^ currentScreen |
1218 |
nativeWarnOK:aString |
|
1219 |
title:aString |
|
1220 |
]. |
|
2439 | 1221 |
self showAndThenDestroyBox:(WarningBox title:aString) |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1222 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1223 |
" |
625 | 1224 |
Dialog warn:'some warning message' |
1225 |
||
1226 |
Dialog warn:('some text with italic emphasis' asText |
|
2439 | 1227 |
emphasizeFrom:16 to:22 with:#italic) |
625 | 1228 |
|
1229 |
Dialog warn:('some warning message' asText |
|
2439 | 1230 |
emphasizeAllWith:(#color->Color red)) |
625 | 1231 |
|
1232 |
Dialog warn:('some text with color emphasis' asText |
|
2439 | 1233 |
emphasizeFrom:6 to:10 with:(#color->Color blue); |
1234 |
emphasizeFrom:16 to:20 with:(#color->Color red)) |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1235 |
" |
625 | 1236 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1237 |
"Modified: 29.5.1996 / 15:23:14 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1238 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1239 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1240 |
!DialogBox class methodsFor:'confirmation dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1241 |
|
197 | 1242 |
confirm:aString |
3355 | 1243 |
"open a modal yes-no dialog. |
1244 |
Return true for yes, false for no" |
|
197 | 1245 |
|
498 | 1246 |
^ self |
3456 | 1247 |
confirm:aString |
1248 |
title:nil |
|
1249 |
yesLabel:nil noLabel:nil |
|
1250 |
initialAnswer:true. |
|
498 | 1251 |
|
197 | 1252 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1253 |
Dialog confirm:'really ?' |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1254 |
|
655 | 1255 |
Transcript showCR:( |
2298 | 1256 |
Dialog confirm:'are you certain ?' |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1257 |
) |
197 | 1258 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1259 |
|
3456 | 1260 |
"Modified: / 02-03-2007 / 15:25:34 / cg" |
197 | 1261 |
! |
1262 |
||
2317 | 1263 |
confirm:aString default:what |
1264 |
"launch a Dialog, which allows user to enter yes or no. |
|
1265 |
return true for yes, false for no. |
|
1266 |
InitialAnswer must be true or false and defines which button is to be |
|
1267 |
the default (i.e. return-) button" |
|
1268 |
||
3456 | 1269 |
^ self |
1270 |
confirm:aString |
|
1271 |
title:nil |
|
1272 |
yesLabel:nil noLabel:nil |
|
1273 |
initialAnswer:what. |
|
2453 | 1274 |
|
1275 |
" |
|
1276 |
Dialog confirm:'Are you happy' default:true |
|
1277 |
||
1278 |
Dialog confirm:'Are you happy' default:false |
|
1279 |
" |
|
3456 | 1280 |
|
1281 |
"Modified: / 02-03-2007 / 15:25:23 / cg" |
|
2317 | 1282 |
! |
1283 |
||
197 | 1284 |
confirm:aString initialAnswer:what |
1285 |
"launch a Dialog, which allows user to enter yes or no. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1286 |
return true for yes, false for no. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1287 |
InitialAnswer must be true or false and defines which button is to be |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1288 |
the default (i.e. return-) button" |
197 | 1289 |
|
2439 | 1290 |
^ self |
1291 |
confirm:aString |
|
1292 |
title:nil |
|
3456 | 1293 |
yesLabel:nil noLabel:nil |
2439 | 1294 |
initialAnswer:what. |
197 | 1295 |
|
1296 |
" |
|
1297 |
Dialog confirm:'really ?' initialAnswer:false |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1298 |
|
655 | 1299 |
Transcript showCR:( |
2361 | 1300 |
Dialog confirm:'are you certain ?' initialAnswer:false |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1301 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1302 |
|
655 | 1303 |
Transcript showCR:( |
2361 | 1304 |
Dialog confirm:'are you certain ?' initialAnswer:true |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1305 |
) |
197 | 1306 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1307 |
|
3456 | 1308 |
"Modified: / 02-03-2007 / 15:24:52 / cg" |
197 | 1309 |
! |
1310 |
||
2618 | 1311 |
confirm:aString initialAnswer:what noLabel:noText |
1312 |
"launch a Dialog, which allows user to enter yes or no. |
|
1313 |
return true for yes, false for no. |
|
1314 |
InitialAnswer must be true or false and defines which button is to be |
|
1315 |
the default (i.e. return-) button" |
|
1316 |
||
1317 |
^ self |
|
1318 |
confirm:aString |
|
1319 |
title:nil |
|
3456 | 1320 |
yesLabel:nil noLabel:noText |
2618 | 1321 |
initialAnswer:what. |
3456 | 1322 |
|
1323 |
"Modified: / 02-03-2007 / 15:24:49 / cg" |
|
2618 | 1324 |
! |
1325 |
||
2079 | 1326 |
confirm:aString noLabel:noText |
1327 |
"launch a Dialog, which allows user to enter yes or no. |
|
1328 |
return true for yes, false for no. |
|
1329 |
The no-button is labeled noText (for example, if you need a 'cancel' there)" |
|
1330 |
||
1331 |
^ self |
|
1332 |
confirm:aString |
|
2493 | 1333 |
title:nil |
3456 | 1334 |
yesLabel:nil noLabel:noText |
1335 |
initialAnswer:true |
|
2079 | 1336 |
|
1337 |
" |
|
1338 |
Dialog confirm:'really ?' |
|
1339 |
||
2493 | 1340 |
Dialog confirm:'really ?' noLabel:'Cancel' |
2079 | 1341 |
" |
3456 | 1342 |
|
1343 |
"Modified: / 02-03-2007 / 15:24:43 / cg" |
|
1344 |
! |
|
1345 |
||
1346 |
confirm:aString title:title |
|
1347 |
"open a modal yes-no dialog. |
|
1348 |
Return true for yes, false for no" |
|
1349 |
||
1350 |
^ self |
|
1351 |
confirm:aString |
|
1352 |
title:nil |
|
1353 |
yesLabel:nil noLabel:nil |
|
1354 |
initialAnswer:true |
|
1355 |
||
1356 |
" |
|
1357 |
Dialog confirm:'really ?' |
|
1358 |
||
1359 |
Transcript showCR:( |
|
1360 |
Dialog confirm:'are you certain ?' |
|
1361 |
) |
|
1362 |
" |
|
1363 |
||
1364 |
"Created: / 02-03-2007 / 15:21:25 / cg" |
|
2079 | 1365 |
! |
1366 |
||
1367 |
confirm:aString title:title noLabel:noText |
|
1368 |
"launch a Dialog, which allows user to enter yes or no. |
|
1369 |
return true for yes, false for no. |
|
1370 |
The no buttons label is defined by noText (for example, to make it 'cancel')." |
|
1371 |
||
1372 |
^ self |
|
2493 | 1373 |
confirm:aString |
1374 |
title:title |
|
1375 |
yesLabel:nil noLabel:noText |
|
3456 | 1376 |
initialAnswer:true |
2079 | 1377 |
|
1378 |
" |
|
1379 |
Dialog |
|
1380 |
confirm:'really ?' |
|
1381 |
title:'fooBar' |
|
2493 | 1382 |
noLabel:'Nope' |
2079 | 1383 |
" |
1384 |
||
1385 |
" |
|
1386 |
Dialog |
|
1387 |
confirm:'really ?' |
|
1388 |
title:nil |
|
2493 | 1389 |
noLabel:'Cancel' |
2079 | 1390 |
" |
3456 | 1391 |
|
1392 |
"Modified: / 02-03-2007 / 15:23:55 / cg" |
|
2079 | 1393 |
! |
1394 |
||
498 | 1395 |
confirm:aString title:title yesLabel:yesText noLabel:noText |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1396 |
"launch a Dialog, which allows user to enter yes or no. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1397 |
return true for yes, false for no. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1398 |
The yes/no buttons labels are defined by yesText/noText." |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1399 |
|
2493 | 1400 |
^ self |
1401 |
confirm:aString |
|
1402 |
title:title |
|
1403 |
yesLabel:yesText noLabel:noText |
|
1404 |
initialAnswer:true |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1405 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1406 |
" |
498 | 1407 |
Dialog |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1408 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1409 |
title:'fooBar' |
2493 | 1410 |
yesLabel:'Oh well' |
1411 |
noLabel:'Nope' |
|
498 | 1412 |
" |
1413 |
||
881 | 1414 |
" |
1415 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1416 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1417 |
title:nil |
2493 | 1418 |
yesLabel:'Oh well' |
1419 |
noLabel:'Nope' |
|
881 | 1420 |
" |
1421 |
||
1422 |
" |
|
1423 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1424 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1425 |
title:'' |
2493 | 1426 |
yesLabel:'Oh well' |
1427 |
noLabel:'Nope' |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1428 |
" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1429 |
|
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1430 |
"Created: / 21.2.1996 / 01:10:14 / cg" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1431 |
"Modified: / 18.4.1998 / 19:25:21 / cg" |
498 | 1432 |
! |
1433 |
||
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1434 |
confirm:aString title:title yesLabel:yesText noLabel:noText initialAnswer:what |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1435 |
"launch a Dialog, which allows user to enter yes or no. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1436 |
return true for yes, false for no. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1437 |
The yes/no buttons labels are defined by yesText/noText." |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1438 |
|
3456 | 1439 |
|box answer t currentScreen| |
1440 |
||
1441 |
t := title. |
|
1442 |
t isNil ifTrue:[ t := self classResources string:'Confirm' ]. |
|
1443 |
||
1444 |
((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[ |
|
1445 |
"/ experimental |
|
1446 |
^ currentScreen |
|
1447 |
nativeConfirmYesNo:aString |
|
1448 |
title:t |
|
1449 |
initialAnswer:what |
|
1450 |
]. |
|
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1451 |
|
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1452 |
box := YesNoBox title:aString. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1453 |
yesText notNil ifTrue:[ |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1454 |
box yesLabel:yesText. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1455 |
]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1456 |
noText notNil ifTrue:[ |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1457 |
box noLabel:noText. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1458 |
]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1459 |
answer := false. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1460 |
box yesAction:[answer := true]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1461 |
|
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1462 |
box label:t. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1463 |
what == false ifTrue:[ |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1464 |
box okButton isReturnButton:false. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1465 |
box acceptReturnAsOK:false. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1466 |
box cancelButton beReturnButton. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1467 |
]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1468 |
|
2439 | 1469 |
self showAndThenDestroyBox:box. |
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1470 |
box yesAction:nil noAction:nil. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1471 |
^ answer |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1472 |
|
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1473 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1474 |
Dialog |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1475 |
confirm:'really ?' |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1476 |
title:'fooBar' |
2493 | 1477 |
yesLabel:'Oh well' |
1478 |
noLabel:'Nope' |
|
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1479 |
initialAnswer:true |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1480 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1481 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1482 |
Dialog |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1483 |
confirm:'really ?' |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1484 |
title:'fooBar' |
2493 | 1485 |
yesLabel:'Oh well' |
1486 |
noLabel:'Nope' |
|
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1487 |
initialAnswer:false |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1488 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1489 |
|
3456 | 1490 |
"Created: / 21-02-1996 / 01:10:14 / cg" |
1491 |
"Modified: / 02-03-2007 / 15:23:31 / cg" |
|
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1492 |
! |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1493 |
|
2710 | 1494 |
confirm:msg withCancel:aBoolean |
1495 |
"launch a Dialog, which allows user to enter yes, no and optionally: cancel. |
|
1496 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
1497 |
||
1498 |
aBoolean ifTrue:[ |
|
1499 |
^ Dialog confirmWithCancel:msg. |
|
1500 |
] ifFalse:[ |
|
1501 |
^ Dialog confirm:msg. |
|
1502 |
]. |
|
1503 |
||
1504 |
" |
|
1505 |
Dialog confirm:'really ?' withCancel:false |
|
1506 |
Dialog confirm:'really ?' withCancel:true |
|
1507 |
" |
|
1508 |
! |
|
1509 |
||
3357
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1510 |
confirm:msg withCancel:aBoolean default:default |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1511 |
"launch a Dialog, which allows user to enter yes, no and optionally: cancel. |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1512 |
return true for 'yes', false for 'no', nil for 'cancel'" |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1513 |
|
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1514 |
aBoolean ifTrue:[ |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1515 |
^ Dialog confirmWithCancel:msg default:default. |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1516 |
] ifFalse:[ |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1517 |
^ Dialog confirm:msg default:default. |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1518 |
]. |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1519 |
|
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1520 |
" |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1521 |
Dialog confirm:'really ?' withCancel:false |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1522 |
Dialog confirm:'really ?' withCancel:true |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1523 |
" |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1524 |
! |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1525 |
|
3382 | 1526 |
confirm:aString yesLabel:yesText |
1527 |
"launch a Dialog, which allows user to enter yes or no. |
|
1528 |
return true for yes, false for no. |
|
1529 |
The yes button's label is defined by yesText." |
|
1530 |
||
1531 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:nil |
|
1532 |
||
1533 |
" |
|
1534 |
Dialog |
|
1535 |
confirm:'really ?' |
|
1536 |
yesLabel:'Oh well' |
|
1537 |
" |
|
1538 |
||
1539 |
"Created: / 04-09-2006 / 11:18:50 / cg" |
|
1540 |
! |
|
1541 |
||
498 | 1542 |
confirm:aString yesLabel:yesText noLabel:noText |
1543 |
"launch a Dialog, which allows user to enter yes or no. |
|
1544 |
return true for yes, false for no. |
|
3382 | 1545 |
The yes/no buttons' labels are defined by yesText/noText." |
498 | 1546 |
|
1547 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:noText |
|
1548 |
||
1549 |
" |
|
2493 | 1550 |
Dialog |
1551 |
confirm:'really ?' |
|
1552 |
yesLabel:'Oh well' |
|
1553 |
noLabel:'Nope' |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1554 |
" |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1555 |
|
3382 | 1556 |
"Created: / 21-02-1996 / 01:10:14 / cg" |
1557 |
"Modified: / 04-09-2006 / 11:19:00 / cg" |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1558 |
! |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1559 |
|
3255 | 1560 |
confirm:aString yesLabel:yesText noLabel:noText initialAnswer:what |
1561 |
"launch a Dialog, which allows user to enter yes or no. |
|
1562 |
return true for yes, false for no. |
|
1563 |
The yes/no buttons labels are defined by yesText/noText." |
|
1564 |
||
1565 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:noText initialAnswer:what |
|
1566 |
||
1567 |
" |
|
1568 |
Dialog |
|
1569 |
confirm:'really ?' |
|
1570 |
yesLabel:'Oh well' |
|
1571 |
noLabel:'Nope' |
|
1572 |
initialAnswer:false |
|
1573 |
" |
|
1574 |
||
1575 |
"Created: 21.2.1996 / 01:10:14 / cg" |
|
1576 |
"Modified: 8.3.1996 / 21:15:06 / cg" |
|
1577 |
! |
|
1578 |
||
2790 | 1579 |
confirmOKCancel:aString |
1580 |
"launch a Dialog, which allows user to enter OK or Cancel. |
|
1581 |
return true for OK, false for Cancel." |
|
1582 |
||
1583 |
|resources| |
|
1584 |
||
1585 |
resources := self classResources. |
|
1586 |
^ self |
|
1587 |
confirm:aString |
|
1588 |
yesLabel:(resources string:'OK') |
|
1589 |
noLabel:(resources string:'Cancel') |
|
1590 |
||
1591 |
" |
|
1592 |
Dialog confirmOKCancel:'really ?' |
|
1593 |
" |
|
1594 |
! |
|
1595 |
||
197 | 1596 |
confirmWithCancel:aString |
1597 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1598 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
1599 |
||
3456 | 1600 |
^ self |
1601 |
confirmWithCancel:aString |
|
1602 |
default:nil |
|
1603 |
title:nil |
|
1004 | 1604 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1605 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1606 |
Dialog confirmWithCancel:'really ?' |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1607 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1608 |
|
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1609 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1610 |
Transcript showCR:( |
3456 | 1611 |
Dialog confirmWithCancel:'really ?' |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1612 |
) |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1613 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1614 |
|
3456 | 1615 |
"Modified: / 02-03-2007 / 15:26:05 / cg" |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1616 |
! |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1617 |
|
1004 | 1618 |
confirmWithCancel:aString default:default |
1619 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1620 |
return true for 'yes', false for 'no', nil for 'cancel'. |
|
1621 |
The default argument marks the return-button; it may be one of nil, false or true" |
|
1622 |
||
3456 | 1623 |
^ self |
2415 | 1624 |
confirmWithCancel:aString |
3456 | 1625 |
default:default |
1626 |
title:nil |
|
2790 | 1627 |
|
1004 | 1628 |
" |
1629 |
Dialog confirmWithCancel:'really ?' default:false |
|
2437 | 1630 |
Dialog confirmWithCancel:'really ?' default:true |
1004 | 1631 |
" |
3456 | 1632 |
|
1633 |
"Modified: / 02-03-2007 / 15:26:13 / cg" |
|
1004 | 1634 |
! |
1635 |
||
2788
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1636 |
confirmWithCancel:aString default:defaultValue onCancel:cancelValue |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1637 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1638 |
return true for 'yes', false for 'no', cancelValues value for 'cancel'" |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1639 |
|
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1640 |
|answer| |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1641 |
|
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1642 |
answer := self confirmWithCancel:aString default:defaultValue. |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1643 |
answer isNil ifTrue:[ |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1644 |
^ cancelValue value |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1645 |
]. |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1646 |
^ answer |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1647 |
|
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1648 |
" |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1649 |
Dialog confirmWithCancel:'really ?' onCancel:[AbortSignal raise] |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1650 |
" |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1651 |
! |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1652 |
|
3456 | 1653 |
confirmWithCancel:aString default:default title:titleString |
1654 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1655 |
return true for 'yes', false for 'no', nil for 'cancel'. |
|
1656 |
The default argument marks the return-button; it may be one of nil, false or true" |
|
1657 |
||
1658 |
^ self |
|
1659 |
confirmWithCancel:aString |
|
1660 |
labels:(self classResources array:#('Cancel' 'No' 'Yes') ) |
|
1661 |
values:#(nil false true) |
|
1662 |
default:(#(nil false true) indexOf:default ifAbsent:nil) |
|
1663 |
title:titleString |
|
1664 |
||
1665 |
" |
|
1666 |
Dialog confirmWithCancel:'really ?' default:false |
|
1667 |
Dialog confirmWithCancel:'really ?' default:true |
|
1668 |
" |
|
1669 |
||
1670 |
"Created: / 02-03-2007 / 15:09:56 / cg" |
|
1671 |
! |
|
1672 |
||
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1673 |
confirmWithCancel:aString labels:labelArray |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1674 |
"launch a Dialog, which allows user to enter cancel, no or yes. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1675 |
Return true for 'yes', false for 'no', nil for 'cancel'. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1676 |
The default is yes. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1677 |
The buttons labels are given in labelArray" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1678 |
|
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1679 |
^ self |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1680 |
confirmWithCancel:aString |
3456 | 1681 |
labels:(self classResources array:labelArray) |
1682 |
default:3 |
|
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1683 |
" |
2493 | 1684 |
Dialog confirmWithCancel:'really ?' labels:#( 'Oops' 'Nope' 'Yea') |
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1685 |
" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1686 |
|
3456 | 1687 |
"Modified: / 02-03-2007 / 15:10:34 / cg" |
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1688 |
! |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1689 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1690 |
confirmWithCancel:aString labels:buttonLabels default:default |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1691 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1692 |
Return true for 'yes', false for 'no', nil for 'cancel'. |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1693 |
The strings for cancel, no and yes are to be passed in |
1004 | 1694 |
buttonLabels; |
1695 |
The default argument (if non-nil) defines the index of the |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1696 |
return button (1 to 3)" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1697 |
|
1707 | 1698 |
^ self |
1699 |
confirmWithCancel:aString |
|
1700 |
labels:buttonLabels |
|
1701 |
values:#(nil false true) |
|
1702 |
default:default |
|
1703 |
||
1704 |
" |
|
1705 |
Transcript showCR:( |
|
1706 |
Dialog |
|
1707 |
confirmWithCancel:'really ?' |
|
2493 | 1708 |
labels:#('mhmh' 'Maybe' 'Definitely') |
1707 | 1709 |
default:3 |
1710 |
) |
|
1711 |
" |
|
1712 |
||
1713 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
|
1714 |
"Modified: / 21.10.1998 / 15:49:16 / cg" |
|
1715 |
! |
|
1716 |
||
1717 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default |
|
1718 |
"launch a Dialog, which allows user to click on any button. |
|
1719 |
Return the corresponding value from the values array. |
|
1720 |
The labels for for the buttons are to be passed in |
|
1721 |
buttonLabels; |
|
1722 |
The default argument (if non-nil) defines the index of the |
|
1723 |
return button (1 to n)" |
|
1724 |
||
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1725 |
^ self |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1726 |
confirmWithCancel:aString |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1727 |
labels:buttonLabels |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1728 |
values:buttonValues |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1729 |
default:default |
3456 | 1730 |
title:nil |
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1731 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1732 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1733 |
Transcript showCR:( |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1734 |
Dialog |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1735 |
confirmWithCancel:'really ?' |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1736 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1737 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1738 |
default:3 |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1739 |
) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1740 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1741 |
|
3456 | 1742 |
"Created: / 18-10-1996 / 14:50:51 / cg" |
1743 |
"Modified: / 02-03-2007 / 15:09:24 / cg" |
|
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1744 |
! |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1745 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1746 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default boxLabel:boxLabelOrNil |
3456 | 1747 |
"obsolete - for backward compatibility" |
1748 |
||
1749 |
^ self |
|
1750 |
confirmWithCancel:aString |
|
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1751 |
labels:buttonLabels |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1752 |
values:buttonValues |
3456 | 1753 |
default:default |
1754 |
title:boxLabelOrNil |
|
1755 |
||
1756 |
"Modified: / 02-03-2007 / 15:09:11 / cg" |
|
1757 |
! |
|
1758 |
||
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1759 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default check:checkLabelOrNil on:checkHolderOrNil title:boxLabelOrNil |
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1760 |
"launch a Dialog, which allows user to click on any button. |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1761 |
Return the corresponding value from the values array. |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1762 |
The labels for for the buttons are to be passed in |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1763 |
buttonLabels; |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1764 |
The default argument (if non-nil) defines the index of the return button (1 to n). |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1765 |
If checkLabel/checkHolder are not nil, and additional labelled checkBox is added to operate on |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1766 |
checkHolder. This can be used for 'do not show this box again' checkItems." |
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1767 |
|
3701 | 1768 |
|box buttons answer i| |
197 | 1769 |
|
1708
dc23c5ca439e
fixed button-creation in confirmWithCancel.
Claus Gittinger <cg@exept.de>
parents:
1707
diff
changeset
|
1770 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1771 |
box buttonTitles:buttonLabels |
1707 | 1772 |
actions:(buttonValues collect:[:v | [answer := v]]). |
2972
d66d46e04cd4
Use #image:/#label: instead of obsolete #form:
Stefan Vogel <sv@exept.de>
parents:
2966
diff
changeset
|
1773 |
box image:(YesNoBox iconBitmap). |
3622 | 1774 |
default notNil ifTrue:[ |
3805
33b4a2271c19
dont care for RETURN-key in keyPress:x:y:; its already done in keyboardProcessor
Claus Gittinger <cg@exept.de>
parents:
3756
diff
changeset
|
1775 |
box defaultButtonIndex:(default isInteger |
33b4a2271c19
dont care for RETURN-key in keyPress:x:y:; its already done in keyboardProcessor
Claus Gittinger <cg@exept.de>
parents:
3756
diff
changeset
|
1776 |
ifTrue:[default] |
33b4a2271c19
dont care for RETURN-key in keyPress:x:y:; its already done in keyboardProcessor
Claus Gittinger <cg@exept.de>
parents:
3756
diff
changeset
|
1777 |
ifFalse:[ buttonValues indexOf:default]) |
3622 | 1778 |
]. |
2493 | 1779 |
box label:(boxLabelOrNil ? (self classResources string:'Confirm')). |
3701 | 1780 |
buttons := box buttons. |
2907
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1781 |
(i := buttonValues indexOf:true) ~~ 0 ifTrue:[ |
3701 | 1782 |
i <= buttons size ifTrue:[ |
1783 |
(buttons at:i) cursor:(Cursor thumbsUp). |
|
3218 | 1784 |
] |
2907
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1785 |
]. |
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1786 |
(i := buttonValues indexOf:false) ~~ 0 ifTrue:[ |
3701 | 1787 |
i <= buttons size ifTrue:[ |
1788 |
(buttons at:i) cursor:(Cursor thumbsDown). |
|
3218 | 1789 |
] |
2907
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1790 |
]. |
2908
b26616b2e603
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2907
diff
changeset
|
1791 |
(i := buttonValues indexOf:nil) ~~ 0 ifTrue:[ |
3701 | 1792 |
i <= buttons size ifTrue:[ |
1793 |
(buttons at:i) cursor:(Cursor thumbsDown). |
|
3218 | 1794 |
] |
2908
b26616b2e603
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2907
diff
changeset
|
1795 |
]. |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1796 |
checkLabelOrNil notNil ifTrue:[ |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1797 |
box addCheckBox:checkLabelOrNil on:checkHolderOrNil. |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1798 |
]. |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1799 |
|
2439 | 1800 |
self showAndThenDestroyBox:box. |
197 | 1801 |
box actions:nil. |
1802 |
^ answer |
|
1803 |
||
1804 |
" |
|
1707 | 1805 |
Transcript showCR:( |
1806 |
Dialog |
|
1807 |
confirmWithCancel:'really ?' |
|
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1808 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1809 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1810 |
default:3 |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1811 |
check:'Again' on:(true asValue) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1812 |
title:'hello there' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1813 |
) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1814 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1815 |
Transcript showCR:( |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1816 |
Dialog |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1817 |
confirmWithCancel:'really ?' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1818 |
labels:#('mhmh' 'maybe' 'definitely') |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1819 |
values:#(1 2 3) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1820 |
default:3 |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1821 |
check:nil on:nil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1822 |
title:'hello there' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1823 |
) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1824 |
" |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1825 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1826 |
"Created: / 02-03-2007 / 15:08:49 / cg" |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1827 |
! |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1828 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1829 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default title:boxLabelOrNil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1830 |
"launch a Dialog, which allows user to click on any button. |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1831 |
Return the corresponding value from the values array. |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1832 |
The labels for for the buttons are to be passed in |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1833 |
buttonLabels; |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1834 |
The default argument (if non-nil) defines the index of the |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1835 |
return button (1 to n)" |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1836 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1837 |
^ self |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1838 |
confirmWithCancel:aString |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1839 |
labels:buttonLabels |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1840 |
values:buttonValues |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1841 |
default:default |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1842 |
check:nil on:nil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1843 |
title:boxLabelOrNil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1844 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1845 |
" |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1846 |
Transcript showCR:( |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1847 |
Dialog |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1848 |
confirmWithCancel:'really ?' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1849 |
labels:#('mhmh' 'maybe' 'definitely') |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1850 |
values:#(1 2 3) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1851 |
default:3 |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1852 |
title:'hello there' |
1707 | 1853 |
) |
1854 |
" |
|
1855 |
||
3456 | 1856 |
"Created: / 02-03-2007 / 15:08:49 / cg" |
2787
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1857 |
! |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1858 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1859 |
confirmWithCancel:aString onCancel:cancelValue |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1860 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1861 |
return true for 'yes', false for 'no', cancelValues value for 'cancel'" |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1862 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1863 |
|answer| |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1864 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1865 |
answer := self confirmWithCancel:aString. |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1866 |
answer isNil ifTrue:[ |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1867 |
^ cancelValue value |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1868 |
]. |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1869 |
^ answer |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1870 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1871 |
" |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1872 |
Dialog confirmWithCancel:'really ?' onCancel:[AbortSignal raise] |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
1873 |
" |
3456 | 1874 |
! |
1875 |
||
1876 |
confirmWithCancel:aString title:titleString |
|
1877 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1878 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
1879 |
||
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1880 |
^ self |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1881 |
confirmWithCancel:aString |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1882 |
default:nil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1883 |
title:titleString |
3456 | 1884 |
|
1885 |
" |
|
1886 |
Dialog confirmWithCancel:'really ?' |
|
1887 |
" |
|
1888 |
||
1889 |
" |
|
1890 |
Transcript showCR:( |
|
1891 |
Dialog confirmWithCancel:'really ?' |
|
1892 |
) |
|
1893 |
" |
|
1894 |
||
1895 |
"Created: / 02-03-2007 / 15:11:14 / cg" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1896 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1897 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1898 |
!DialogBox class methodsFor:'defaults'! |
573 | 1899 |
|
1900 |
defaultLabel |
|
1901 |
"return the boxes default window title." |
|
1902 |
||
1903 |
^ 'Dialog' |
|
1904 |
||
1905 |
"Created: 23.4.1996 / 17:13:10 / cg" |
|
1757 | 1906 |
! |
1907 |
||
1908 |
updateStyleCache |
|
1909 |
"extract values from the styleSheet and cache them in class variables" |
|
1910 |
||
1911 |
<resource: #style (#'dialogBox.returnShiftsFocusToOK')> |
|
1912 |
||
1913 |
DefaultFocusToOKOnLeave := StyleSheet at:'dialogBox.returnShiftsFocusToOK' default:false. |
|
1914 |
||
573 | 1915 |
! ! |
1916 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1917 |
!DialogBox class methodsFor:'file name dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
1918 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1919 |
requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1920 |
"same as requestFileName, but only show directories." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1921 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1922 |
^ self |
2825 | 1923 |
requestDirectoryName:'Select Directory' |
1924 |
default:nil |
|
1925 |
ok:nil abort:nil |
|
1926 |
ifFail:'' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1927 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1928 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1929 |
Dialog requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1930 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1931 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1932 |
"Created: 19.4.1996 / 14:29:48 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1933 |
"Modified: 19.4.1996 / 14:32:42 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1934 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1935 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1936 |
requestDirectoryName:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1937 |
"same as requestFileName, but only show directories." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1938 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1939 |
^ self |
2825 | 1940 |
requestDirectoryName:title |
1941 |
default:nil |
|
1942 |
ok:nil abort:nil |
|
1943 |
ifFail:'' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1944 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1945 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1946 |
Dialog |
2825 | 1947 |
requestDirectoryName:'which directory ?' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1948 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1949 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1950 |
"Created: 19.4.1996 / 14:29:48 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1951 |
"Modified: 19.4.1996 / 14:32:02 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1952 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1953 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1954 |
requestDirectoryName:title default:aFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1955 |
"same as requestFileName, but only show directories" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1956 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1957 |
^ self |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1958 |
requestDirectoryName:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1959 |
default:aFileName |
2825 | 1960 |
ok:nil abort:nil |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1961 |
ifFail:'' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1962 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1963 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1964 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1965 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
1966 |
default:'/etc' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1967 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1968 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1969 |
"Created: 19.4.1996 / 14:29:10 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1970 |
"Modified: 19.4.1996 / 14:31:52 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1971 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1972 |
|
2966 | 1973 |
requestDirectoryName:title default:aFileName acceptReturnAsOK:aBoolean |
1974 |
"same as requestFileName, but only show directories" |
|
1975 |
||
1976 |
^ self |
|
1977 |
requestDirectoryName:title |
|
1978 |
default:aFileName |
|
1979 |
ok:nil abort:nil |
|
1980 |
ifFail:'' |
|
1981 |
acceptReturnAsOK:aBoolean |
|
1982 |
||
1983 |
" |
|
1984 |
Dialog |
|
1985 |
requestDirectoryName:'which directory ?' |
|
1986 |
default:'/etc' |
|
1987 |
" |
|
1988 |
||
1989 |
"Created: 19.4.1996 / 14:29:10 / cg" |
|
1990 |
"Modified: 19.4.1996 / 14:31:52 / cg" |
|
1991 |
! |
|
1992 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1993 |
requestDirectoryName:title default:aFileName ifFail:failBlock |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1994 |
"same as requestFileName, but only show directories" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
1995 |
|
2825 | 1996 |
^ self |
1997 |
requestDirectoryName:title |
|
1998 |
default:aFileName |
|
1999 |
ok:nil abort:nil |
|
2000 |
ifFail:failBlock |
|
2001 |
||
2002 |
" |
|
2003 |
Dialog |
|
2004 |
requestDirectoryName:'which directory ?' |
|
2005 |
default:'/etc' |
|
2006 |
ifFail:'none' 'none' |
|
2007 |
" |
|
2008 |
||
2009 |
"Created: 19.4.1996 / 14:31:04 / cg" |
|
2010 |
"Modified: 23.10.1997 / 19:24:41 / cg" |
|
2011 |
! |
|
2012 |
||
2013 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText |
|
2014 |
"same as requestFileName, but only show directories" |
|
2015 |
||
2016 |
^ self |
|
2017 |
requestDirectoryName:title |
|
2018 |
default:aFileName |
|
2019 |
ok:okText abort:abortText |
|
2020 |
ifFail:'' |
|
2021 |
||
2022 |
" |
|
2023 |
Dialog |
|
2024 |
requestDirectoryName:'which directory ?' |
|
2025 |
default:'/etc' |
|
2026 |
ok:'Yes' abort:'No' |
|
2027 |
" |
|
2028 |
||
2029 |
"Created: 19.4.1996 / 14:31:04 / cg" |
|
2030 |
"Modified: 23.10.1997 / 19:24:41 / cg" |
|
2031 |
! |
|
2032 |
||
2033 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
|
2966 | 2034 |
"Same as requestFileName, but only show directories. |
2035 |
" |
|
2036 |
||
2037 |
^ self requestDirectoryName:title |
|
2038 |
default: aFileName |
|
2039 |
ok: okText |
|
2040 |
abort: abortText |
|
2041 |
ifFail: failBlock |
|
2042 |
acceptReturnAsOK: false |
|
2043 |
! |
|
2044 |
||
2045 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
|
2046 |
"Same as requestFileName, but only show directories. |
|
2047 |
Extended to accept return as ok if wanted." |
|
2825 | 2048 |
|
2049 |
|t dir dirF fN fileBox enteredName resources| |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2050 |
|
2621 | 2051 |
UserPreferences current useNewFileDialog ifTrue:[ |
3004 | 2052 |
^ "FileDialogV2" FileDialog requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
2621 | 2053 |
]. |
2789 | 2054 |
|
2055 |
resources := self classResources. |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2056 |
fileBox := FileSelectionBox |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2057 |
title:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2058 |
action:[:fileName | enteredName := fileName]. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2059 |
|
3352 | 2060 |
fileBox acceptReturnAsOK:aBoolean. |
2966 | 2061 |
|
2825 | 2062 |
okText notNil |
2063 |
ifTrue:[ t := okText ] |
|
2064 |
ifFalse:[ t := resources string:'OK' ]. |
|
2065 |
fileBox okText:t. |
|
2066 |
||
2067 |
abortText notNil |
|
2068 |
ifTrue:[ t := abortText ] |
|
2069 |
ifFalse:[ t := resources string:'Cancel' ]. |
|
2070 |
fileBox abortText:t. |
|
2071 |
||
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2072 |
fN := aFileName. |
1780
bfc30a82aae3
dont get confused with a nil default
Claus Gittinger <cg@exept.de>
parents:
1764
diff
changeset
|
2073 |
dirF := (aFileName ? '.') asFilename. |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2074 |
dirF name = dirF baseName ifFalse:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2075 |
dir := dirF directoryName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2076 |
fN := dirF baseName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2077 |
] ifTrue:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2078 |
dir := FileSelectionBox lastFileSelectionDirectory. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2079 |
]. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2080 |
dir notNil ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2081 |
fileBox directory:dir. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2082 |
]. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2083 |
|
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2084 |
fileBox initialText:fN. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2085 |
fileBox selectingDirectory:true. |
2439 | 2086 |
|
2087 |
self showAndThenDestroyBox:fileBox. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2088 |
|
3237
4c6fe0664cab
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
3234
diff
changeset
|
2089 |
(enteredName isEmptyOrNil) ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2090 |
^ failBlock value |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2091 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2092 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2093 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2094 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2095 |
^ enteredName |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2096 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2097 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2098 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2099 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2100 |
default:'/etc' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2101 |
ifFail:'none' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2102 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2103 |
|
3352 | 2104 |
"Created: / 19-04-1996 / 14:31:04 / cg" |
2105 |
"Modified: / 23-08-2006 / 12:33:55 / cg" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2106 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2107 |
|
2631 | 2108 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
2109 |
"same as requestFileName, but only show directories" |
|
2110 |
||
2111 |
^ FileDialog |
|
2112 |
requestDirectoryName:titleString |
|
2113 |
default:aFileName |
|
2114 |
ok:okText |
|
2115 |
abort:abortText |
|
2116 |
version:versionSymbol |
|
2117 |
pattern:pattern |
|
2118 |
fromDirectory:aDirectoryPath |
|
2119 |
ifFail:failBlock |
|
2120 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
2121 |
asLoadDialog:aBoolean. |
|
2122 |
! |
|
2123 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2124 |
requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2125 |
"launch a Dialog, which allows the user to enter a filename. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2126 |
Return the pathname string consisting of the full pathname of the filename, |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2127 |
or an empty string (if cancel was pressed)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2128 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2129 |
^ self |
1401 | 2130 |
requestFileName:'filename:' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2131 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2132 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2133 |
Dialog requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2134 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2135 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2136 |
"Created: 27.1.1996 / 13:24:35 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2137 |
"Modified: 19.4.1996 / 13:49:28 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2138 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2139 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2140 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2141 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2142 |
Return the pathname string consisting of the full pathname of the filename, |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2143 |
or an empty string (if cancel was pressed)." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2144 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2145 |
^ self |
1401 | 2146 |
requestFileName:titleString |
2147 |
default:'file.ext' |
|
183 | 2148 |
|
197 | 2149 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2150 |
Dialog requestFileName:'enter a fileName:' |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2151 |
Dialog requestFileName:'enter a fileName:' |
183 | 2152 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2153 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2154 |
"Created: 27.1.1996 / 13:24:35 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2155 |
"Modified: 19.4.1996 / 13:53:17 / cg" |
118 | 2156 |
! |
2157 |
||
100 | 2158 |
requestFileName:titleString default:defaultName |
2159 |
"launch a Dialog, which allows user to enter a filename. |
|
2160 |
The box will not allow pressing 'ok' without an entered string. |
|
2161 |
Return the pathname string consisting of the full pathname of the filename, |
|
2162 |
or an empty string (if cancel was pressed)." |
|
2163 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2164 |
^ self |
1401 | 2165 |
requestFileName:titleString |
2166 |
default:defaultName |
|
2167 |
version:nil |
|
2168 |
ifFail:'' |
|
100 | 2169 |
|
2170 |
" |
|
2171 |
Dialog requestFileName:'enter a fileName:' default:'' |
|
2172 |
Dialog requestFileName:'enter a fileName:' default:'Makefile.bak' |
|
2173 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2174 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2175 |
"Modified: 19.4.1996 / 13:47:44 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2176 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2177 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2178 |
requestFileName:titleString default:defaultName fromDirectory:aDirectoryPath |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2179 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2180 |
The box will not allow pressing 'ok' without an entered string. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2181 |
Return the pathname string consisting of the full pathname of the filename, |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2182 |
or an empty string (if cancel was pressed)." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2183 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2184 |
^ self |
1401 | 2185 |
requestFileName:titleString |
2186 |
default:defaultName |
|
2187 |
version:nil |
|
2188 |
ifFail:'' |
|
2189 |
fromDirectory:aDirectoryPath |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2190 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2191 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2192 |
Dialog |
1401 | 2193 |
requestFileName:'enter a fileName:' |
2194 |
default:'Makefile.bak' |
|
2195 |
fromDirectory:'..' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2196 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2197 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2198 |
"Modified: 19.4.1996 / 14:27:31 / cg" |
100 | 2199 |
! |
2200 |
||
2637
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2201 |
requestFileName:titleString default:defaultName ifFail:cancelBlockOrValue |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2202 |
"launch a Dialog, which allows user to enter a filename. |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2203 |
The box will not allow pressing 'ok' without an entered string. |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2204 |
Return the pathname string consisting of the full pathname of the filename, |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2205 |
or an empty string (if cancel was pressed)." |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2206 |
|
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2207 |
^ self |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2208 |
requestFileName:titleString |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2209 |
default:defaultName |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2210 |
version:nil |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2211 |
ifFail:cancelBlockOrValue |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2212 |
|
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2213 |
" |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2214 |
Dialog requestFileName:'enter a fileName:' default:'' |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2215 |
Dialog requestFileName:'enter a fileName:' default:'Makefile.bak' |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2216 |
" |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2217 |
|
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2218 |
"Modified: 19.4.1996 / 13:47:44 / cg" |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2219 |
! |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2220 |
|
1736 | 2221 |
requestFileName:titleString default:defaultName ifFail:failReturn pattern:pattern fromDirectory:dir |
2222 |
"launch a Dialog, which allows user to enter a filename. |
|
2223 |
The files presented initially are those from dir. |
|
2224 |
The box will show ok/cancel in its buttons. |
|
2225 |
The matchPattern is set to pattern initially. |
|
2226 |
Return the string or failReturn if cancel was pressed." |
|
2227 |
||
2228 |
^ self |
|
2229 |
requestFileName:titleString |
|
2230 |
default:defaultName |
|
2231 |
version:nil |
|
2232 |
ifFail:failReturn |
|
2233 |
pattern:pattern |
|
2234 |
fromDirectory:dir |
|
2235 |
||
2236 |
! |
|
2237 |
||
2825 | 2238 |
requestFileName:titleString default:defaultName ok:okText abort:abortText |
2239 |
"launch a Dialog, which allows user to enter a filename. |
|
2240 |
The files presented initially are those from the current directory. |
|
2241 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2242 |
The matchPattern is set to pattern initially. |
|
2243 |
Return the string or nil if cancel was pressed." |
|
2244 |
||
2245 |
^ self |
|
2246 |
requestFileName:titleString |
|
2247 |
default:defaultName |
|
2248 |
ok:okText abort:abortText |
|
2249 |
pattern:'*' |
|
2250 |
||
2251 |
" |
|
2252 |
Dialog |
|
2253 |
requestFileName:'enter a fileName:' |
|
2254 |
default:'' |
|
2255 |
ok:'yeah' |
|
2256 |
abort:'oh, no' |
|
2257 |
" |
|
2258 |
! |
|
2259 |
||
197 | 2260 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern |
2261 |
"launch a Dialog, which allows user to enter a filename. |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2262 |
The files presented initially are those from the current directory. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2263 |
The box will show okText in its okButton, abortText in the abortButton. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2264 |
The matchPattern is set to pattern initially. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2265 |
Return the string or nil if cancel was pressed." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2266 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2267 |
^ self |
1401 | 2268 |
requestFileName:titleString |
2269 |
default:defaultName |
|
2270 |
ok:okText |
|
2271 |
abort:abortText |
|
2272 |
pattern:pattern |
|
2273 |
fromDirectory:nil |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2274 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2275 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2276 |
Dialog |
1401 | 2277 |
requestFileName:'enter a fileName:' |
2278 |
default:'' |
|
2279 |
ok:'yeah' |
|
2280 |
abort:'oh, no' |
|
2281 |
pattern:'*.st' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2282 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2283 |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2284 |
"Modified: 20.2.1997 / 18:13:13 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2285 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2286 |
|
2218 | 2287 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2288 |
"launch a Dialog, which allows user to enter a filename. |
2218 | 2289 |
The files presented initially are those in aDirectoryPathOrNil, or the |
2290 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
197 | 2291 |
The box will show okText in its okButton, abortText in the abortButton. |
2292 |
The matchPattern is set to pattern initially. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2293 |
Return the string, or nil if cancel was pressed." |
197 | 2294 |
|
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2295 |
^ self |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2296 |
requestFileName:titleString |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2297 |
default:defaultName |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2298 |
ok:okText |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2299 |
abort:abortText |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2300 |
pattern:pattern |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2301 |
fromDirectory:aDirectoryPathOrNil |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2302 |
whenBoxCreatedEvaluate:nil |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2303 |
! |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2304 |
|
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2305 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2306 |
"launch a Dialog, which allows user to enter a filename. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2307 |
The files presented initially are those in aDirectoryPathOrNil, or the |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2308 |
last fileBox directory (default: current directory) (if a nil path is given). |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2309 |
The box will show okText in its okButton, abortText in the abortButton. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2310 |
The matchPattern is set to pattern initially. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2311 |
Return the string, or nil if cancel was pressed." |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2312 |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2313 |
|box defaultDir defaultNm dir enteredName| |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2314 |
|
3575
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2315 |
UserPreferences current useNativeFileDialog ifTrue:[ |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2316 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2317 |
^ Win32FileDialog |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2318 |
fileDialogFor:nil |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2319 |
save:false |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2320 |
title:titleString |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2321 |
inDirectory:aDirectoryPathOrNil |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2322 |
initialAnswer:defaultName |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2323 |
filter:pattern |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2324 |
extension:nil |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2325 |
]. |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2326 |
]. |
2620 | 2327 |
UserPreferences current useNewFileDialog ifTrue:[ |
3575
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2328 |
^ FileDialog |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2329 |
requestFileName:titleString |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2330 |
default:defaultName |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2331 |
ok:okText abort:abortText |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2332 |
pattern:pattern |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2333 |
fromDirectory:aDirectoryPathOrNil |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2334 |
whenBoxCreatedEvaluate:boxCreatedCallback |
2620 | 2335 |
]. |
2336 |
||
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2337 |
defaultNm := defaultName. |
2218 | 2338 |
defaultDir := aDirectoryPathOrNil. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2339 |
defaultDir isNil ifTrue:[ |
2218 | 2340 |
defaultNm notNil ifTrue:[ |
2341 |
defaultDir := defaultName asFilename directoryName. |
|
2342 |
defaultNm := defaultNm asFilename baseName. |
|
2343 |
defaultDir = Filename currentDirectory name ifTrue:[ |
|
2344 |
defaultName asFilename isExplicitRelative ifFalse:[ |
|
2345 |
defaultDir := nil |
|
2346 |
] |
|
2347 |
] |
|
2348 |
]. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2349 |
]. |
197 | 2350 |
|
2351 |
box := FileSelectionBox |
|
2218 | 2352 |
title:titleString |
2353 |
okText:okText |
|
2354 |
abortText:abortText |
|
2355 |
action:[:fileName | enteredName := fileName]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2356 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2357 |
defaultDir notNil ifTrue:[ |
2218 | 2358 |
box directory:defaultDir |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2359 |
] ifFalse:[ |
2218 | 2360 |
dir := FileSelectionBox lastFileSelectionDirectory. |
2361 |
dir notNil ifTrue:[ |
|
2362 |
box directory:dir. |
|
2363 |
]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2364 |
]. |
197 | 2365 |
box pattern:pattern. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2366 |
box initialText:defaultNm. |
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2367 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:box]. |
2439 | 2368 |
|
2369 |
self showAndThenDestroyBox:box. |
|
197 | 2370 |
box action:nil. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2371 |
|
3237
4c6fe0664cab
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
3234
diff
changeset
|
2372 |
(enteredName notEmptyOrNil) ifTrue:[ |
2218 | 2373 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2374 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2375 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2376 |
^ enteredName |
197 | 2377 |
|
2378 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2379 |
Dialog |
2218 | 2380 |
requestFileName:'enter a fileName:' |
2381 |
default:'' |
|
2382 |
ok:'yeah' |
|
2383 |
abort:'oh, no' |
|
2384 |
pattern:'rc*' |
|
2385 |
fromDirectory:'/etc' |
|
197 | 2386 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2387 |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2388 |
"Modified: 23.10.1997 / 19:59:01 / cg" |
197 | 2389 |
! |
2390 |
||
2631 | 2391 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
2392 |
"launch a Dialog, which allows user to enter a filename. |
|
2393 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
2394 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
2395 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2396 |
The matchPattern is set to pattern initially. |
|
2397 |
Return the string, or nil if cancel was pressed |
|
2398 |
The version argument allows validation of the files existance; |
|
2399 |
it may be any of: |
|
2400 |
#mustBeNew - fail (return empty string) if the file exists |
|
2401 |
#new - confirm if the file exists |
|
2402 |
#mustBeOld - fail if the file does not exist |
|
2403 |
#old - confirm if the file does not exist |
|
2404 |
#any (other) - no validation |
|
2405 |
" |
|
2406 |
||
2407 |
^ FileDialog |
|
2408 |
requestFileName:titleString |
|
2409 |
default:defaultName |
|
2410 |
ok:okText |
|
2411 |
abort:abortText |
|
2412 |
version:versionSymbol |
|
2413 |
ifFail:failBlock |
|
2414 |
pattern:pattern |
|
2415 |
fromDirectory:aDirectoryPath |
|
2416 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
2417 |
asLoadDialog:aBoolean. |
|
2418 |
! |
|
2419 |
||
1030 | 2420 |
requestFileName:titleString default:defaultName pattern:pattern |
2421 |
"launch a Dialog, which allows user to enter a filename. |
|
2422 |
The files presented initially are those from the current directory. |
|
2423 |
The box will show ok/cancel in its buttons. |
|
2424 |
The matchPattern is set to pattern initially. |
|
2425 |
Return the string or nil if cancel was pressed." |
|
2426 |
||
2415 | 2427 |
|resources| |
2428 |
||
2429 |
resources := self classResources. |
|
1030 | 2430 |
^ self |
2415 | 2431 |
requestFileName:titleString |
2432 |
default:defaultName |
|
3276 | 2433 |
ok:(resources string:'OK') |
2415 | 2434 |
abort:(resources string:'Cancel') |
2435 |
pattern:pattern |
|
2436 |
fromDirectory:nil |
|
1030 | 2437 |
|
2438 |
" |
|
2439 |
Dialog |
|
2415 | 2440 |
requestFileName:'enter a fileName:' |
2441 |
default:'' |
|
2442 |
pattern:'*.st' |
|
1030 | 2443 |
" |
2444 |
" |
|
2445 |
Dialog |
|
2415 | 2446 |
requestFileName:'enter a fileName:' |
2447 |
default:'' |
|
2448 |
pattern:'*.st;*.h' |
|
1030 | 2449 |
" |
2450 |
||
2451 |
"Created: 21.2.1997 / 11:16:52 / cg" |
|
2452 |
"Modified: 21.2.1997 / 11:18:40 / cg" |
|
2453 |
! |
|
2454 |
||
2525 | 2455 |
requestFileName:titleString default:defaultName pattern:pattern fromDirectory:aDirectory |
2456 |
"launch a Dialog, which allows user to enter a filename. |
|
2457 |
The files presented initially are those from the current directory. |
|
2458 |
The box will show ok/cancel in its buttons. |
|
2459 |
The matchPattern is set to pattern initially. |
|
2460 |
Return the string or nil if cancel was pressed." |
|
2461 |
||
2462 |
|resources| |
|
2463 |
||
2464 |
resources := self classResources. |
|
2465 |
^ self |
|
2466 |
requestFileName:titleString |
|
2467 |
default:defaultName |
|
3276 | 2468 |
ok:(resources string:'OK') |
2525 | 2469 |
abort:(resources string:'Cancel') |
2470 |
pattern:pattern |
|
2471 |
fromDirectory:aDirectory |
|
2472 |
||
2473 |
" |
|
2474 |
Dialog |
|
2475 |
requestFileName:'enter a fileName:' |
|
2476 |
default:'' |
|
2477 |
pattern:'*.st' |
|
2478 |
" |
|
2479 |
" |
|
2480 |
Dialog |
|
2481 |
requestFileName:'enter a fileName:' |
|
2482 |
default:'' |
|
2483 |
pattern:'*.st;*.h' |
|
2484 |
" |
|
2485 |
||
2486 |
"Created: 21.2.1997 / 11:16:52 / cg" |
|
2487 |
"Modified: 21.2.1997 / 11:18:40 / cg" |
|
2488 |
! |
|
2489 |
||
100 | 2490 |
requestFileName:titleString default:defaultName version:versionSymbol |
2491 |
"launch a Dialog, which allows user to enter a filename. |
|
2492 |
The box will not allow pressing 'ok' without an entered string. |
|
2493 |
Return the pathname string or the empty string if cancel was pressed. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2494 |
The version argument allows validation of the files existance; |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2495 |
it may be any of: |
1401 | 2496 |
#mustBeNew - fail (return empty string) if the file exists |
2497 |
#new - confirm if the file exists |
|
2498 |
#mustBeOld - fail if the file does not exist |
|
2499 |
#old - confirm if the file does not exist |
|
2500 |
#any (other) - no validation |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2501 |
" |
100 | 2502 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2503 |
^ self |
1401 | 2504 |
requestFileName:titleString |
2505 |
default:defaultName |
|
2506 |
version:versionSymbol |
|
2507 |
ifFail:'' |
|
100 | 2508 |
|
2509 |
" |
|
2510 |
Dialog requestFileName:'enter a fileName:' |
|
1401 | 2511 |
default:'' |
2512 |
version:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2513 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2514 |
Dialog requestFileName:'enter a fileName:' |
1401 | 2515 |
default:'' |
2516 |
version:#mustBeNew |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2517 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2518 |
Dialog requestFileName:'enter a fileName:' |
1401 | 2519 |
default:'' |
2520 |
version:#new |
|
100 | 2521 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2522 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2523 |
"Modified: 19.4.1996 / 13:53:58 / cg" |
100 | 2524 |
! |
2525 |
||
2526 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock |
|
2527 |
"launch a Dialog, which allows user to enter a filename. |
|
2528 |
The box will not allow pressing 'ok' without an entered string. |
|
2529 |
Return the string or the value of failBlock if cancel was pressed. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2530 |
The version argument allows validation of the files existance; |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2531 |
it may be any of: |
1401 | 2532 |
#mustBeNew - fail (return empty string) if the file exists |
2533 |
#new - confirm if the file exists |
|
2534 |
#mustBeOld - fail if the file does not exist |
|
2535 |
#old - confirm if the file does not exist |
|
2536 |
#any (other) - no validation |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2537 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2538 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2539 |
^ self |
1401 | 2540 |
requestFileName:titleString |
2541 |
default:defaultName |
|
2542 |
version:versionSymbol |
|
2543 |
ifFail:failBlock |
|
2544 |
fromDirectory:nil |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2545 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2546 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2547 |
Dialog |
1401 | 2548 |
requestFileName:'enter a fileName:' |
2549 |
default:'' |
|
2550 |
version:nil |
|
2551 |
ifFail:['none'] |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2552 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2553 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2554 |
Dialog |
1401 | 2555 |
requestFileName:'enter a fileName:' |
2556 |
default:'' |
|
2557 |
version:#old |
|
2558 |
ifFail:['none'] |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2559 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2560 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2561 |
"Modified: 19.4.1996 / 14:26:36 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2562 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2563 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2564 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock fromDirectory:aDirectoryPath |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2565 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2566 |
Return the string or the value of failBlock if cancel was pressed. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2567 |
The version argument allows validation of the files existance; |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2568 |
it may be any of: |
1736 | 2569 |
#mustBeNew - fail (return empty string) if the file exists |
2570 |
#new - confirm if the file exists |
|
2571 |
#mustBeOld - fail if the file does not exist |
|
2572 |
#old - confirm if the file does not exist |
|
2573 |
#any (other) - no validation |
|
2574 |
" |
|
2575 |
||
2576 |
^ self |
|
2577 |
requestFileName:titleString |
|
2578 |
default:defaultName |
|
2579 |
version:versionSymbol |
|
2580 |
ifFail:failBlock |
|
2581 |
pattern:nil |
|
2582 |
fromDirectory:aDirectoryPath |
|
1031 | 2583 |
|
2584 |
" |
|
2585 |
Dialog |
|
1736 | 2586 |
requestFileName:'enter a fileName:' |
2587 |
default:'' |
|
2588 |
version:nil |
|
2589 |
ifFail:['none'] |
|
2590 |
fromDirectory:'/etc' |
|
1031 | 2591 |
" |
2592 |
" |
|
2593 |
Dialog |
|
1736 | 2594 |
requestFileName:'enter a fileName:' |
2595 |
default:'' |
|
2596 |
version:#old |
|
2597 |
ifFail:['none'] |
|
2598 |
fromDirectory:'/etc' |
|
1031 | 2599 |
" |
2600 |
" |
|
2601 |
Dialog |
|
1736 | 2602 |
requestFileName:'enter a fileName:' |
2603 |
default:'' |
|
2604 |
version:#mustBeNew |
|
2605 |
ifFail:['none'] |
|
2606 |
fromDirectory:'/etc' |
|
1031 | 2607 |
" |
2608 |
||
2609 |
"Modified: 20.2.1997 / 18:12:28 / cg" |
|
2610 |
"Modified: 21.2.1997 / 14:27:27 / stefan" |
|
2611 |
! |
|
2612 |
||
2613 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath |
|
2614 |
"launch a Dialog, which allows user to enter a filename. |
|
2615 |
Return the string or the value of failBlock if cancel was pressed. |
|
2616 |
The version argument allows validation of the files existance; |
|
2617 |
it may be any of: |
|
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2618 |
#mustBeNew - fail (return empty string) if the file exists |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2619 |
#new - confirm if the file exists |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2620 |
#mustBeOld - fail if the file does not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2621 |
#old - confirm if the file does not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2622 |
#any (other) - no validation |
1031 | 2623 |
" |
2624 |
||
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2625 |
^ self |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2626 |
requestFileName:titleString |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2627 |
default:defaultName |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2628 |
version:versionSymbol |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2629 |
ifFail:failBlock |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2630 |
pattern:pattern |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2631 |
fromDirectory:aDirectoryPath |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2632 |
whenBoxCreatedEvaluate:nil |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2633 |
! |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2634 |
|
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2635 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2636 |
"launch a Dialog, which allows user to enter a filename. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2637 |
Return the string or the value of failBlock if cancel was pressed. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2638 |
The version argument allows validation of the files existance; |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2639 |
it may be any of: |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2640 |
#mustBeNew - fail (return empty string) if the file exists |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2641 |
#new - confirm if the file exists |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2642 |
#mustBeOld - fail if the file does not exist |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2643 |
#old - confirm if the file does not exist |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2644 |
#any (other) - no validation |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2645 |
" |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2646 |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2647 |
|box defaultDir defaultNm| |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2648 |
|
3574 | 2649 |
UserPreferences current useNativeFileDialog ifTrue:[ |
2650 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
2651 |
^ Win32FileDialog |
|
2652 |
fileDialogFor:nil |
|
2653 |
save:false |
|
2654 |
title:titleString |
|
2655 |
inDirectory:aDirectoryPath |
|
2656 |
initialAnswer:defaultName |
|
2657 |
filter:pattern |
|
2658 |
extension:nil |
|
2659 |
]. |
|
2660 |
]. |
|
2661 |
||
2621 | 2662 |
UserPreferences current useNewFileDialog ifTrue:[ |
2769 | 2663 |
^ FileDialog |
2664 |
requestFileName:titleString |
|
2665 |
default:defaultName |
|
2666 |
version:versionSymbol |
|
2667 |
ifFail:failBlock |
|
2668 |
pattern:pattern |
|
2669 |
fromDirectory:aDirectoryPath |
|
2670 |
whenBoxCreatedEvaluate:boxCreatedCallback. |
|
2621 | 2671 |
]. |
2773 | 2672 |
defaultName notNil ifTrue:[defaultNm := defaultName asFilename name]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2673 |
defaultDir := aDirectoryPath. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2674 |
defaultDir isNil ifTrue:[ |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2675 |
defaultNm notNil ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2676 |
defaultName asFilename withoutSuffix baseName = '*' ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2677 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2678 |
defaultNm := ''. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2679 |
] ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2680 |
defaultDir := defaultName asFilename directoryName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2681 |
defaultNm := defaultNm asFilename baseName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2682 |
] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2683 |
]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2684 |
]. |
100 | 2685 |
|
2686 |
box := FileSelectionBox title:titleString. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2687 |
defaultDir notNil ifTrue:[box directory:defaultDir]. |
1031 | 2688 |
pattern notNil ifTrue:[box pattern:pattern]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2689 |
box initialText:defaultNm. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2690 |
box action:[:name | |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2691 |
versionSymbol == #mustBeNew ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2692 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2693 |
name asFilename exists ifTrue:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2694 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2695 |
versionSymbol == #new ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2696 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2697 |
name asFilename exists ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2698 |
(self confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs) |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2699 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2700 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2701 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2702 |
versionSymbol == #mustBeOld ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2703 |
name asFilename exists ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2704 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2705 |
versionSymbol == #old ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2706 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2707 |
name asFilename exists ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2708 |
(self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs) |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2709 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2710 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2711 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2712 |
FileSelectionBox lastFileSelectionDirectory:box directory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2713 |
box destroy. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2714 |
^ name |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2715 |
]. |
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2716 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:box]. |
2439 | 2717 |
self showAndThenDestroyBox:box. |
100 | 2718 |
box action:nil. |
2719 |
^ failBlock value |
|
2720 |
||
2721 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2722 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2723 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2724 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2725 |
version:nil |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2726 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2727 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2728 |
fromDirectory:'/etc' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2729 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2730 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2731 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2732 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2733 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2734 |
version:#old |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2735 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2736 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2737 |
fromDirectory:'/etc' |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2738 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2739 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2740 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2741 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2742 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2743 |
version:#mustBeNew |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2744 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2745 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2746 |
fromDirectory:'/etc' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2747 |
" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2748 |
|
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2749 |
"Created: / 21.2.1997 / 14:23:44 / stefan" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2750 |
"Modified: / 21.2.1997 / 14:38:04 / stefan" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2751 |
"Modified: / 16.6.1998 / 13:34:23 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2752 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2753 |
|
3877 | 2754 |
requestFileName:titleString fromDirectory:aDirectory |
2755 |
"launch a Dialog, which allows user to enter a filename. |
|
2756 |
The files presented initially are those from the current directory. |
|
2757 |
The box will show ok/cancel in its buttons. |
|
2758 |
Return the string or nil if cancel was pressed." |
|
2759 |
||
2760 |
^ self |
|
2761 |
requestFileName:titleString |
|
2762 |
default:nil |
|
2763 |
pattern:'*' |
|
2764 |
fromDirectory:aDirectory |
|
2765 |
||
2766 |
" |
|
2767 |
Dialog |
|
2768 |
requestFileName:'enter a fileName:' |
|
2769 |
fromDirectory:'../../libbasic' |
|
2770 |
" |
|
2771 |
! |
|
2772 |
||
2637
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2773 |
requestFileName:titleString ifFail:cancelBlockOrValue |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2774 |
"launch a Dialog, which allows user to enter a filename. |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2775 |
Return the pathname string consisting of the full pathname of the filename, |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2776 |
or the value from evaluating cancelBlock (if cancel was pressed)." |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2777 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2778 |
^ self |
2637
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2779 |
requestFileName:titleString |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2780 |
default:'file.ext' |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2781 |
version:nil |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2782 |
ifFail:cancelBlockOrValue |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2783 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2784 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2785 |
Dialog requestFileName:'enter a fileName:' ifFail:['foo'] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2786 |
Dialog requestFileName:'enter a fileName:' ifFail:[nil] |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2787 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2788 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2789 |
"Modified: 19.4.1996 / 13:53:17 / cg" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2790 |
"Created: 19.4.1996 / 13:56:28 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2791 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2792 |
|
2524 | 2793 |
requestFileName:titleString pattern:pattern |
2794 |
"launch a Dialog, which allows user to enter a filename. |
|
2795 |
The files presented initially are those from the current directory. |
|
2796 |
The box will show ok/cancel in its buttons. |
|
2797 |
The matchPattern is set to pattern initially. |
|
2798 |
Return the string or nil if cancel was pressed." |
|
2799 |
||
2800 |
^ self |
|
2801 |
requestFileName:titleString |
|
2802 |
default:nil |
|
2803 |
pattern:pattern |
|
2804 |
||
2805 |
" |
|
2806 |
Dialog |
|
2807 |
requestFileName:'enter a fileName:' |
|
2808 |
pattern:'*.st' |
|
2809 |
" |
|
2810 |
" |
|
2811 |
Dialog |
|
2812 |
requestFileName:'enter a fileName:' |
|
2813 |
pattern:'*.st;*.h' |
|
2814 |
" |
|
2815 |
! |
|
2816 |
||
2525 | 2817 |
requestFileName:titleString pattern:pattern fromDirectory:aDirectory |
2818 |
"launch a Dialog, which allows user to enter a filename. |
|
2819 |
The files presented initially are those from the current directory. |
|
2820 |
The box will show ok/cancel in its buttons. |
|
2821 |
The matchPattern is set to pattern initially. |
|
2822 |
Return the string or nil if cancel was pressed." |
|
2823 |
||
2824 |
^ self |
|
2825 |
requestFileName:titleString |
|
2826 |
default:nil |
|
2827 |
pattern:pattern |
|
2828 |
fromDirectory:aDirectory |
|
2829 |
" |
|
2830 |
Dialog |
|
2831 |
requestFileName:'enter a fileName:' |
|
2832 |
pattern:'*.st' |
|
2833 |
" |
|
2834 |
" |
|
2835 |
Dialog |
|
2836 |
requestFileName:'enter a fileName:' |
|
2837 |
pattern:'*.st;*.h' |
|
2838 |
" |
|
2839 |
! |
|
2840 |
||
2631 | 2841 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
2842 |
"launch a Dialog, which allows user to enter a filename. |
|
2843 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
2844 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
2845 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2846 |
The matchPattern is set to pattern initially. |
|
2847 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
2848 |
" |
|
2849 |
||
2850 |
^ FileDialog |
|
2851 |
requestFileNames:titleString |
|
2852 |
default:defaultName |
|
2853 |
ok:okText |
|
2854 |
abort:abortText |
|
2855 |
ifFail:failBlock |
|
2856 |
pattern:pattern |
|
2857 |
fromDirectory:aDirectoryPath |
|
2858 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
2859 |
asLoadDialog:asLoadDialog. |
|
2860 |
! |
|
2861 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2862 |
requestNewFileName:titleString default:defaultName |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2863 |
"launch a Dialog, which allows user to enter a filename. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2864 |
We expect a new files (i.e. nonexisting) name to be enterred, |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2865 |
and confirm if it already exists. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2866 |
The box will not allow pressing 'ok' without an entered string. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2867 |
Return the pathname string consisting of the full pathname of the filename, |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2868 |
or an empty string (if cancel was pressed)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2869 |
|
1736 | 2870 |
^ self |
2871 |
requestFileName:titleString |
|
2872 |
default:defaultName |
|
2873 |
version:#new |
|
2874 |
ifFail:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2875 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2876 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2877 |
Dialog requestNewFileName:'enter a fileName:' default:'' |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2878 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2879 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2880 |
"Modified: 27.1.1996 / 13:44:13 / cg" |
2694 | 2881 |
! |
2882 |
||
2883 |
requestSaveFileName:title default:defaultOrNil fromDirectory:directoryOrNil action:action appendAction:appendActionOrNil |
|
3418 | 2884 |
"save contents into a file - ask user for filename using a fileSelectionBox. |
2885 |
Append is NOT offered, if appendActionOrNil is nil." |
|
2694 | 2886 |
|
2789 | 2887 |
|doAppend fileBox fileName dialog default resources| |
2694 | 2888 |
|
2889 |
default := defaultOrNil. |
|
2890 |
default notNil ifTrue:[ default := default asString]. |
|
2891 |
||
2789 | 2892 |
resources := self classResources. |
2893 |
||
3574 | 2894 |
UserPreferences current useNativeFileDialog ifTrue:[ |
2895 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
2896 |
appendActionOrNil isNil ifTrue:[ |
|
2897 |
^ Win32FileDialog |
|
2898 |
fileDialogFor:nil |
|
2899 |
save:true |
|
2900 |
title:title |
|
2901 |
inDirectory:directoryOrNil |
|
2902 |
initialAnswer:default |
|
2903 |
filter:nil |
|
2904 |
extension:nil |
|
2905 |
]. |
|
2906 |
]. |
|
2907 |
]. |
|
2908 |
||
2694 | 2909 |
UserPreferences current useNewFileDialog ifTrue:[ |
2910 |
fileName := FileDialog |
|
2911 |
requestFileName:title |
|
2912 |
default:default |
|
2789 | 2913 |
ok:(resources string:'Save') |
2694 | 2914 |
abort:nil |
2915 |
version:nil |
|
2916 |
ifFail:nil |
|
2917 |
pattern:nil |
|
2918 |
fromDirectory:directoryOrNil |
|
2919 |
whenBoxCreatedEvaluate:[:box | (dialog := box) appendButtonVisibleHolder value:appendActionOrNil notNil]. |
|
2920 |
||
2921 |
doAppend := dialog appendWasPressed |
|
2922 |
] ifFalse:[ |
|
2923 |
fileBox := FileSaveBox |
|
2924 |
title:title |
|
2789 | 2925 |
okText:(resources string:'Save') |
2926 |
abortText:(resources string:'Cancel') |
|
2694 | 2927 |
action:[:fn | doAppend := false. fileName := fn]. |
2928 |
fileBox appendAction:[:fn | doAppend := true. fileName := fn]. |
|
2929 |
directoryOrNil notNil ifTrue:[ fileBox directory:directoryOrNil]. |
|
2930 |
default notNil ifTrue:[fileBox initialText:default]. |
|
2931 |
fileBox showAtPointer. |
|
2932 |
fileBox destroy. |
|
2933 |
]. |
|
2934 |
||
2935 |
fileName size > 0 ifTrue:[ |
|
2705
a7c0e46f20fb
requestSaveFileName:title default:defaultOrNil fromDirectory:directoryOrNil action:action appendAction
tm
parents:
2700
diff
changeset
|
2936 |
(doAppend ifTrue:[appendActionOrNil] ifFalse:[action]) |
2694 | 2937 |
value:fileName |
2938 |
]. |
|
2939 |
^ self. |
|
3418 | 2940 |
|
2941 |
" |
|
2942 |
Dialog |
|
2943 |
requestSaveFileName:'Save dialog example with append' |
|
2944 |
default:'xxx.txt' |
|
2945 |
fromDirectory:(Filename homeDirectory) |
|
2946 |
action:[:fn | Transcript showCR:'save ',fn] |
|
2947 |
appendAction:[:fn | Transcript showCR:'append ',fn] |
|
2948 |
||
2949 |
Dialog |
|
2950 |
requestSaveFileName:'Save dialog example' |
|
2951 |
default:'xxx.txt' |
|
2952 |
fromDirectory:(Filename homeDirectory) |
|
2953 |
action:[:fn | Transcript showCR:'save ',fn] |
|
2954 |
appendAction:nil |
|
2955 |
" |
|
2956 |
||
2957 |
"Modified: / 27-10-2006 / 09:47:01 / cg" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2958 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2959 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2960 |
!DialogBox class methodsFor:'fill in the blank dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
2961 |
|
2315 | 2962 |
forRequestText:title editViewClass:editViewClass lines:numLines columns:numCols initialAnswer:initialText model:textModel |
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2963 |
"return a dialog asking for multiline text. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2964 |
The box is not shown yet, for further customization" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2965 |
|
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2966 |
^ self |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2967 |
forRequestText:title |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2968 |
editViewClass:EditTextView |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2969 |
lines:numLines columns:numCols |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2970 |
initialAnswer:initialText model:textModel |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2971 |
setupWith: |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2972 |
[:textView :dialog| |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2973 |
textView model:textModel. |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2974 |
textView acceptChannel:(dialog acceptChannel). |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2975 |
|
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2976 |
] |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2977 |
|
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2978 |
"Modified: / 12-10-2006 / 13:59:21 / cg" |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2979 |
! |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2980 |
|
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2981 |
forRequestText:title editViewClass:editViewClass lines:numLines columns:numCols initialAnswer:initialText model:textModel setupWith:aSetupBlockOrNil |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2982 |
"return a dialog asking for multiline text. |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2983 |
The box is not shown yet, for further customization" |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2984 |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2985 |
|dialog textView| |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2986 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2987 |
dialog := self new. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2988 |
(dialog addTextLabel:(self classResources string:title)) adjust:#left. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2989 |
textView := dialog addTextBoxOn:nil |
2315 | 2990 |
class:editViewClass |
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2991 |
withNumberOfLines:numLines |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2992 |
hScrollable:true |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2993 |
vScrollable:true. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2994 |
dialog width:(textView preferredExtentForLines:numLines cols:numCols) x. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2995 |
dialog addAbortAndOkButtons. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2996 |
dialog okButton isReturnButton:false. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2997 |
dialog makeTabable:textView. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
2998 |
dialog stickAtBottomWithVariableHeight:textView. |
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
2999 |
|
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3000 |
aSetupBlockOrNil notNil ifTrue:[ |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3001 |
aSetupBlockOrNil valueWithOptionalArgument:textView and:dialog |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3002 |
]. |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3003 |
textModel notNil ifTrue:[ |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3004 |
textModel value:initialText. |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3005 |
]. |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3006 |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3007 |
^ dialog |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3008 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3009 |
" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3010 |
|dialog textHolder| |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3011 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3012 |
textHolder := ValueHolder new. |
2315 | 3013 |
dialog := Dialog |
3014 |
forRequestText:'foo' |
|
3015 |
editViewClass:EditTextView |
|
3016 |
lines:10 columns:40 |
|
3017 |
initialAnswer:'hello' model:textHolder. |
|
3018 |
dialog open. |
|
3019 |
dialog accepted ifTrue:[ |
|
3020 |
^ textHolder value |
|
3021 |
]. |
|
3022 |
^ nil |
|
3023 |
" |
|
3024 |
||
3025 |
" |
|
3026 |
|dialog textHolder| |
|
3027 |
||
3028 |
textHolder := ValueHolder new. |
|
3029 |
dialog := Dialog |
|
3030 |
forRequestText:'foo' |
|
3031 |
editViewClass:CodeView |
|
3032 |
lines:10 columns:40 |
|
3033 |
initialAnswer:'hello' model:textHolder. |
|
3034 |
dialog open. |
|
3035 |
dialog accepted ifTrue:[ |
|
3036 |
^ textHolder value |
|
3037 |
]. |
|
3038 |
^ nil |
|
3039 |
" |
|
3040 |
||
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3041 |
"Created: / 12-10-2006 / 13:59:27 / cg" |
2315 | 3042 |
! |
3043 |
||
3044 |
forRequestText:title lines:numLines columns:numCols initialAnswer:initialText model:textModel |
|
3045 |
"return a dialog asking for multiline text. |
|
3046 |
The box is not shown yet, for further customization" |
|
3047 |
||
3048 |
^ self |
|
3049 |
forRequestText:title |
|
3050 |
editViewClass:EditTextView |
|
3051 |
lines:numLines columns:numCols |
|
3052 |
initialAnswer:initialText model:textModel |
|
3053 |
||
3054 |
" |
|
3055 |
|dialog textHolder| |
|
3056 |
||
3057 |
textHolder := ValueHolder new. |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3058 |
dialog := Dialog forRequestText:'foo' lines:10 columns:40 initialAnswer:'hello' model:textHolder. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3059 |
dialog open. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3060 |
dialog accepted ifTrue:[ |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3061 |
^ textHolder value |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3062 |
]. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3063 |
^ nil |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3064 |
" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3065 |
|
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3066 |
"Modified: / 12-10-2006 / 12:45:47 / cg" |
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3067 |
! |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3068 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3069 |
request:aString |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3070 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3071 |
Return the entered string (may be empty string) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3072 |
or the empty string (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3073 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3074 |
^ self |
2439 | 3075 |
request:aString |
3076 |
displayAt:nil |
|
3077 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3078 |
action:nil |
|
3079 |
initialAnswer:'' |
|
3080 |
onCancel:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3081 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3082 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3083 |
Dialog |
2439 | 3084 |
request:'enter a string:' |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3085 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3086 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3087 |
"Modified: 29.5.1996 / 14:26:25 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3088 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3089 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3090 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3091 |
"launch a Dialog, which allows user to enter a string. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3092 |
If aPoint is nonNil, the box is shown there, optionally centered around |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3093 |
that point. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3094 |
If it is nil, it is shown at the current pointer position or at the |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3095 |
screen center. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3096 |
Return the string or an empty string (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3097 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3098 |
^ self |
2444 | 3099 |
request:aString |
3100 |
displayAt:aPoint |
|
3101 |
centered:centered |
|
3102 |
action:resultAction |
|
3103 |
initialAnswer:initial |
|
3104 |
okLabel:nil |
|
3105 |
cancelLabel:nil |
|
3106 |
title:nil |
|
3107 |
onCancel:'' |
|
3108 |
list:nil |
|
3109 |
initialSelection:nil |
|
3110 |
entryCompletionBlock:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3111 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3112 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3113 |
centered around 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3114 |
|
2444 | 3115 |
Dialog |
2548 | 3116 |
request:'Enter a string:' |
2444 | 3117 |
displayAt:200@200 |
3118 |
centered:true |
|
3119 |
action:[:result | result printNewline] |
|
3120 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3121 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3122 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3123 |
origin at 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3124 |
|
2444 | 3125 |
Dialog |
2548 | 3126 |
request:'Enter a string:' |
2444 | 3127 |
displayAt:200@200 |
3128 |
centered:false |
|
3129 |
action:[:result | result printNewline] |
|
3130 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3131 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3132 |
under mouse pointer: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3133 |
|
2444 | 3134 |
Dialog |
2548 | 3135 |
request:'Enter a string:' |
2444 | 3136 |
displayAt:nil |
3137 |
centered:false |
|
3138 |
action:[:result | result printNewline] |
|
3139 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3140 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3141 |
centered on the screen: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3142 |
|
2444 | 3143 |
Dialog |
2548 | 3144 |
request:'Enter a string:' |
2444 | 3145 |
displayAt:nil |
3146 |
centered:true |
|
3147 |
action:[:result | result printNewline] |
|
3148 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3149 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3150 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3151 |
"Created: 7.12.1995 / 23:14:10 / cg" |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3152 |
"Modified: 29.5.1996 / 14:19:36 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3153 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3154 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3155 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3156 |
"launch a Dialog, which allows user to enter a string. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3157 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3158 |
If it is nil, it is shown at the current pointer position or at the |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3159 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3160 |
The ok-button is labelled okLabel (or the default, ifNil), |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3161 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3162 |
Return the string or the value of cancelValue (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3163 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3164 |
^ self |
2444 | 3165 |
request:aString |
3166 |
displayAt:aPoint |
|
3167 |
centered:centered |
|
3168 |
action:resultAction |
|
3169 |
initialAnswer:initial |
|
3170 |
okLabel:okLabel |
|
3171 |
cancelLabel:cancelLabel |
|
3172 |
title:nil |
|
3173 |
onCancel:cancelValue |
|
3174 |
list:nil |
|
3175 |
initialSelection:nil |
|
3176 |
entryCompletionBlock:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3177 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3178 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3179 |
at topLeft (centering is suppressed, to make the box fully visible) |
2444 | 3180 |
Dialog |
2548 | 3181 |
request:'Enter a string:' |
2444 | 3182 |
displayAt:0@0 |
3183 |
centered:true |
|
3184 |
action:[:result | result printNewline] |
|
3185 |
initialAnswer:'the default' |
|
2548 | 3186 |
okLabel:'Yes' |
3187 |
cancelLabel:'No' |
|
2444 | 3188 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3189 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3190 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3191 |
|
2444 | 3192 |
Dialog |
2548 | 3193 |
request:'Enter a string:' |
2444 | 3194 |
displayAt:200@200 |
3195 |
centered:true |
|
3196 |
action:[:result | result printNewline] |
|
3197 |
initialAnswer:'the default' |
|
2548 | 3198 |
okLabel:'Yes' |
3199 |
cancelLabel:'No' |
|
2444 | 3200 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3201 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3202 |
topLeft of box at 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3203 |
|
2444 | 3204 |
Dialog |
2548 | 3205 |
request:'Enter a string:' |
2444 | 3206 |
displayAt:200@200 |
3207 |
centered:false |
|
3208 |
action:[:result | result printNewline] |
|
3209 |
initialAnswer:'the default' |
|
2548 | 3210 |
okLabel:'Yes' |
3211 |
cancelLabel:'No' |
|
2444 | 3212 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3213 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3214 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3215 |
|
2444 | 3216 |
Dialog |
2548 | 3217 |
request:'Enter a string:' |
2444 | 3218 |
displayAt:nil |
3219 |
centered:false |
|
3220 |
action:[:result | result printNewline] |
|
3221 |
initialAnswer:'the default' |
|
2548 | 3222 |
okLabel:'Yes' |
3223 |
cancelLabel:'No' |
|
2444 | 3224 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3225 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3226 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3227 |
|
2444 | 3228 |
Dialog |
2548 | 3229 |
request:'Enter a string:' |
2444 | 3230 |
displayAt:nil |
3231 |
centered:true |
|
3232 |
action:[:result | result printNewline] |
|
3233 |
initialAnswer:'the default' |
|
2548 | 3234 |
okLabel:'Yes' |
3235 |
cancelLabel:'No' |
|
2444 | 3236 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3237 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3238 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3239 |
"Created: 7.12.1995 / 23:14:10 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3240 |
"Modified: 29.5.1996 / 14:35:45 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3241 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3242 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3243 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3244 |
"launch a Dialog, which allows user to enter a string. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3245 |
The dialogs window is titled titleString, or the default (if nil). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3246 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3247 |
If it is nil, it is shown at the current pointer position or at the |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3248 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3249 |
The ok-button is labelled okLabel (or the default, ifNil), |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3250 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3251 |
Return the string or the value of cancelValue (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3252 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3253 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3254 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3255 |
displayAt:aPoint |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3256 |
centered:centered |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3257 |
action:resultAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3258 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3259 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3260 |
cancelLabel:cancelLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3261 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3262 |
onCancel:cancelValue |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3263 |
list:nil |
2444 | 3264 |
initialSelection:nil |
3265 |
entryCompletionBlock:nil |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3266 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3267 |
|
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3268 |
request:aString displayAt:aPoint centered:centered action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3269 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3270 |
onCancel:cancelValue list:listToSelectFrom |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3271 |
"launch a Dialog, which allows user to enter a string. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3272 |
The dialogs window is titled titleString, or the default (if nil). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3273 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3274 |
If it is nil, it is shown at the current pointer position or at the |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3275 |
screen center (if centered is true). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3276 |
The ok-button is labelled okLabel (or the default, ifNil), |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3277 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3278 |
Return the string or the value of cancelValue (if cancel was pressed)" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3279 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3280 |
^ self |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3281 |
request:aString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3282 |
displayAt:aPoint |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3283 |
centered:centered |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3284 |
action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3285 |
initialAnswer:initial |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3286 |
okLabel:okLabel |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3287 |
cancelLabel:cancelLabel |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3288 |
title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3289 |
onCancel:cancelValue |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3290 |
list:listToSelectFrom |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3291 |
initialSelection:nil |
2444 | 3292 |
entryCompletionBlock:nil |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3293 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3294 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3295 |
centered around 200@200: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3296 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3297 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3298 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3299 |
displayAt:200@200 |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3300 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3301 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3302 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3303 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3304 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3305 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3306 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3307 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3308 |
under mouse pointer: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3309 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3310 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3311 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3312 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3313 |
centered:false |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3314 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3315 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3316 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3317 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3318 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3319 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3320 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3321 |
centered on the screen: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3322 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3323 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3324 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3325 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3326 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3327 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3328 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3329 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3330 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3331 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3332 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3333 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3334 |
with a list: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3335 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3336 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3337 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3338 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3339 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3340 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3341 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3342 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3343 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3344 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3345 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3346 |
list:#(foo bar baz) |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3347 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3348 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3349 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3350 |
"Modified: / 5.5.1999 / 10:50:22 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3351 |
! |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3352 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3353 |
request:aString displayAt:aPoint centered:centered action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3354 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3355 |
onCancel:cancelValue list:listToSelectFrom initialSelection:anInterval |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3356 |
"launch a Dialog, which allows user to enter a string. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3357 |
The dialogs window is titled titleString, or the default (if nil). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3358 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3359 |
If it is nil, it is shown at the current pointer position or at the |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3360 |
screen center (if centered is true). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3361 |
The ok-button is labelled okLabel (or the default, ifNil), |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3362 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3363 |
Return the string or the value of cancelValue (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3364 |
|
2444 | 3365 |
^ self |
3366 |
request:aString |
|
3367 |
displayAt:aPoint |
|
3368 |
centered:centered |
|
3369 |
action:resultAction |
|
3370 |
initialAnswer:initial |
|
3371 |
okLabel:okLabel |
|
3372 |
cancelLabel:cancelLabel |
|
3373 |
title:titleString |
|
3374 |
onCancel:cancelValue |
|
3375 |
list:listToSelectFrom |
|
3376 |
initialSelection:anInterval |
|
3377 |
entryCompletionBlock:nil |
|
3378 |
||
3379 |
" |
|
3380 |
centered around 200@200: |
|
3381 |
||
3382 |
Dialog |
|
2548 | 3383 |
request:'Enter a string:' |
2444 | 3384 |
displayAt:200@200 |
3385 |
centered:true |
|
3386 |
action:[:result | result printNewline] |
|
3387 |
initialAnswer:'the default' |
|
2548 | 3388 |
okLabel:'Yes' |
3389 |
cancelLabel:'No' |
|
2444 | 3390 |
title:'foo' |
3391 |
onCancel:#foo |
|
3392 |
||
3393 |
under mouse pointer: |
|
3394 |
||
3395 |
Dialog |
|
2548 | 3396 |
request:'Enter a string:' |
2444 | 3397 |
displayAt:nil |
3398 |
centered:false |
|
3399 |
action:[:result | result printNewline] |
|
3400 |
initialAnswer:'the default' |
|
2548 | 3401 |
okLabel:'Yes' |
3402 |
cancelLabel:'No' |
|
2444 | 3403 |
title:'foo' |
3404 |
onCancel:#foo |
|
3405 |
||
3406 |
centered on the screen: |
|
3407 |
||
3408 |
Dialog |
|
2548 | 3409 |
request:'Enter a string:' |
2444 | 3410 |
displayAt:nil |
3411 |
centered:true |
|
3412 |
action:[:result | result printNewline] |
|
3413 |
initialAnswer:'the default' |
|
2548 | 3414 |
okLabel:'Yes' |
3415 |
cancelLabel:'No' |
|
2444 | 3416 |
title:'foo' |
3417 |
onCancel:#foo |
|
3418 |
||
3419 |
with a list: |
|
3420 |
||
3421 |
Dialog |
|
2548 | 3422 |
request:'Enter a string:' |
2444 | 3423 |
displayAt:nil |
3424 |
centered:true |
|
3425 |
action:[:result | result printNewline] |
|
3426 |
initialAnswer:'the default' |
|
2548 | 3427 |
okLabel:'Yes' |
3428 |
cancelLabel:'No' |
|
2444 | 3429 |
title:'foo' |
3430 |
onCancel:#foo |
|
3431 |
list:#(foo bar baz) |
|
3432 |
" |
|
3433 |
||
3434 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
|
3435 |
"Modified: / 5.5.1999 / 10:50:22 / cg" |
|
3436 |
! |
|
3437 |
||
3438 |
request:aString displayAt:aPoint centered:centeredOrNil action:resultAction |
|
3439 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
|
3440 |
onCancel:cancelValue list:listToSelectFrom initialSelection:anInterval |
|
3441 |
entryCompletionBlock:entryCompletionBlock |
|
3442 |
"launch a Dialog, which allows user to enter a string. |
|
3443 |
The dialogs window is titled titleString, or the default (if nil). |
|
3444 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
|
3445 |
If it is nil, it is shown at the current pointer position or at the |
|
3446 |
screen center (if centered is true). |
|
3447 |
The ok-button is labelled okLabel (or the default, ifNil), |
|
3448 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
|
3449 |
Return the string or the value of cancelValue (if cancel was pressed)" |
|
3450 |
||
3451 |
|box centered| |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3452 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3453 |
listToSelectFrom isNil ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3454 |
box := EnterBox title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3455 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3456 |
box := EnterBoxWithList title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3457 |
box list:listToSelectFrom. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3458 |
]. |
2685 | 3459 |
initial notNil ifTrue:[ box initialText:initial printString ]. |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3460 |
anInterval notNil ifTrue:[ |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3461 |
box selectFrom:anInterval start to:anInterval stop. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3462 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
3463 |
box abortAction:[:val | box destroy. ^ cancelValue value]. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3464 |
okLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3465 |
box okText:okLabel. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3466 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3467 |
cancelLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3468 |
box abortText:cancelLabel |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3469 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3470 |
resultAction isNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3471 |
box action:[:val | box destroy. ^ val] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3472 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3473 |
box action:[:val | box destroy. ^ resultAction value:val] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3474 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3475 |
titleString notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3476 |
box label:titleString |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3477 |
]. |
2444 | 3478 |
entryCompletionBlock notNil ifTrue:[ |
2517 | 3479 |
"/ box entryCompletionBlock:[:text | box |
3480 |
"/ initialText:(entryCompletionBlock value:text) |
|
3481 |
"/ selected:false]. |
|
3482 |
box entryCompletionBlock:entryCompletionBlock. |
|
2444 | 3483 |
]. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3484 |
|
2444 | 3485 |
centered := centeredOrNil ? (ForceModalBoxesToOpenAtCenter ? false). |
3486 |
||
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3487 |
aPoint notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3488 |
box showAt:aPoint center:centered |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3489 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3490 |
centered ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3491 |
box showAtCenter |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3492 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3493 |
box showAtPointer |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3494 |
] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3495 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
3496 |
box destroy. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3497 |
^ cancelValue value. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3498 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3499 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3500 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3501 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3502 |
Dialog |
2548 | 3503 |
request:'Enter a string:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3504 |
displayAt:200@200 |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3505 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3506 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3507 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3508 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3509 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3510 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3511 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3512 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3513 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3514 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3515 |
Dialog |
2548 | 3516 |
request:'Enter a string:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3517 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3518 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3519 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3520 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3521 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3522 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3523 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3524 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3525 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3526 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3527 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3528 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3529 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3530 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3531 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3532 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3533 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3534 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3535 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3536 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3537 |
onCancel:#foo |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3538 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3539 |
with a list: |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3540 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3541 |
Dialog |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3542 |
request:'enter a string:' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3543 |
displayAt:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3544 |
centered:true |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3545 |
action:[:result | result printNewline] |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3546 |
initialAnswer:'the default' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3547 |
okLabel:'yes' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3548 |
cancelLabel:'no' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3549 |
title:'foo' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3550 |
onCancel:#foo |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3551 |
list:#(foo bar baz) |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3552 |
" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3553 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3554 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3555 |
"Modified: / 5.5.1999 / 10:50:22 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3556 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3557 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3558 |
request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial onCancel:cancelValue |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3559 |
"launch a Dialog, which allows user to enter a string. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3560 |
If aPoint is nonNil, the box is shown there, optionally centered. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3561 |
If it is nil, it is shown at the current pointer position or at the screen center. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3562 |
Return the string or the value of cancelValue (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3563 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3564 |
^ self |
2444 | 3565 |
request:aString |
3566 |
displayAt:aPoint |
|
3567 |
centered:centered |
|
3568 |
action:resultAction |
|
3569 |
initialAnswer:initial |
|
3570 |
okLabel:nil |
|
3571 |
cancelLabel:nil |
|
3572 |
title:nil |
|
3573 |
onCancel:cancelValue |
|
3574 |
list:nil |
|
3575 |
initialSelection:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3576 |
|
100 | 3577 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3578 |
at topLeft (centering is suppressed, to make the box fully visible) |
2444 | 3579 |
Dialog |
3580 |
request:'enter a string:' |
|
3581 |
displayAt:0@0 |
|
3582 |
centered:true |
|
3583 |
action:[:result | result printNewline] |
|
3584 |
initialAnswer:'the default' |
|
3585 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3586 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3587 |
centered around 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3588 |
|
2444 | 3589 |
Dialog |
3590 |
request:'enter a string:' |
|
3591 |
displayAt:200@200 |
|
3592 |
centered:true |
|
3593 |
action:[:result | result printNewline] |
|
3594 |
initialAnswer:'the default' |
|
3595 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3596 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3597 |
topLeft of box at 200@200: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3598 |
|
2444 | 3599 |
Dialog |
3600 |
request:'enter a string:' |
|
3601 |
displayAt:200@200 |
|
3602 |
centered:false |
|
3603 |
action:[:result | result printNewline] |
|
3604 |
initialAnswer:'the default' |
|
3605 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3606 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3607 |
under mouse pointer: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3608 |
|
2444 | 3609 |
Dialog |
3610 |
request:'enter a string:' |
|
3611 |
displayAt:nil |
|
3612 |
centered:false |
|
3613 |
action:[:result | result printNewline] |
|
3614 |
initialAnswer:'the default' |
|
3615 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3616 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3617 |
centered on the screen: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3618 |
|
2444 | 3619 |
Dialog |
3620 |
request:'enter a string:' |
|
3621 |
displayAt:nil |
|
3622 |
centered:true |
|
3623 |
action:[:result | result printNewline] |
|
3624 |
initialAnswer:'the default' |
|
3625 |
onCancel:#foo |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3626 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3627 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3628 |
"Created: 7.12.1995 / 23:14:10 / cg" |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3629 |
"Modified: 29.5.1996 / 14:24:39 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3630 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3631 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3632 |
request:aString displayAt:aPoint initialAnswer:initial |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3633 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3634 |
The boxes topLeft is placed at aPoint, or under the mouse pointer (if aPoint is nil). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3635 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3636 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3637 |
^ self |
2439 | 3638 |
request:aString |
3639 |
displayAt:aPoint |
|
3640 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3641 |
action:nil |
|
3642 |
initialAnswer:initial |
|
3643 |
onCancel:'' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3644 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3645 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3646 |
Dialog |
2439 | 3647 |
request:'enter a string:' |
3648 |
displayAt:(250 @ 250) |
|
3649 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3650 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3651 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3652 |
"Modified: 29.5.1996 / 14:29:51 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3653 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3654 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3655 |
request:aString initialAnswer:initial |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3656 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3657 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3658 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3659 |
^ self |
2439 | 3660 |
request:aString |
3661 |
displayAt:nil |
|
3662 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3663 |
action:nil |
|
2444 | 3664 |
initialAnswer:initial |
3665 |
okLabel:nil |
|
3666 |
cancelLabel:nil |
|
3667 |
title:nil |
|
2439 | 3668 |
onCancel:'' |
2444 | 3669 |
list:nil |
3670 |
initialSelection:nil |
|
3671 |
entryCompletionBlock:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3672 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3673 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3674 |
Dialog |
2439 | 3675 |
request:'enter a string:' |
3676 |
initialAnswer:'the default' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3677 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3678 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3679 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3680 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3681 |
|
2444 | 3682 |
request:aString initialAnswer:initial entryCompletionBlock:entryCompletionBlock |
3683 |
"launch a Dialog, which allows user to enter something. |
|
3684 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
|
3685 |
||
3686 |
^ self |
|
3687 |
request:aString |
|
3688 |
displayAt:nil |
|
3689 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3690 |
action:nil |
|
3691 |
initialAnswer:initial |
|
3692 |
okLabel:nil |
|
3693 |
cancelLabel:nil |
|
3694 |
title:nil |
|
3695 |
onCancel:'' |
|
3696 |
list:nil |
|
3697 |
initialSelection:nil |
|
3698 |
entryCompletionBlock:entryCompletionBlock |
|
3699 |
||
3700 |
" |
|
3701 |
Dialog |
|
3702 |
request:'enter a selector:' |
|
3703 |
initialAnswer:'at:p' |
|
3704 |
entryCompletionBlock:[:s | |completion| |
|
3705 |
||
3706 |
completion := Smalltalk selectorCompletion:s. |
|
3707 |
completion second size > 1 ifTrue:[ Screen current beep]. |
|
3708 |
completion first |
|
3709 |
]. |
|
3710 |
" |
|
3711 |
||
3712 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
|
3713 |
! |
|
3714 |
||
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3715 |
request:aString initialAnswer:initial initialSelection:anInterval |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3716 |
"launch a Dialog, which allows user to enter something. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3717 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3718 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3719 |
^ self |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3720 |
request:aString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3721 |
displayAt:nil |
2439 | 3722 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3723 |
action:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3724 |
initialAnswer:initial |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3725 |
okLabel:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3726 |
cancelLabel:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3727 |
title:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3728 |
onCancel:'' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3729 |
list:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3730 |
initialSelection:anInterval |
2444 | 3731 |
entryCompletionBlock:nil |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3732 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3733 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3734 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3735 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3736 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3737 |
initialSelection:(1 to:3) |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3738 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3739 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3740 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3741 |
! |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
3742 |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3743 |
request:aString initialAnswer:initial list:aList |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3744 |
"launch a Dialog, which allows user to enter something, |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3745 |
or select from a list of values. |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3746 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3747 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3748 |
^ self |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3749 |
request:aString |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3750 |
displayAt:nil |
2439 | 3751 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3752 |
action:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3753 |
initialAnswer:initial |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3754 |
okLabel:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3755 |
cancelLabel:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3756 |
title:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3757 |
onCancel:'' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3758 |
list:aList |
2444 | 3759 |
initialSelection:nil |
3760 |
entryCompletionBlock:nil |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3761 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3762 |
" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3763 |
Dialog |
2548 | 3764 |
request:'Enter a string:' |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3765 |
initialAnswer:'the default' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3766 |
list:#('foo' 'bar' 'baz') |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3767 |
" |
2110 | 3768 |
" |
3769 |
Dialog |
|
3770 |
request:'enter a string:' |
|
3771 |
initialAnswer:'the default' |
|
3772 |
list:((1 to:30) collect:[:i | i printString]) |
|
3773 |
" |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3774 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3775 |
"Modified: / 5.5.1999 / 10:53:45 / cg" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3776 |
! |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
3777 |
|
2550 | 3778 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString |
3779 |
"launch a Dialog, which allows user to enter something. |
|
3780 |
Return the entered string (may be empty string) |
|
3781 |
or cancelValue (if cancel was pressed)" |
|
3782 |
||
3783 |
^ self |
|
3784 |
request:aString |
|
3785 |
displayAt:nil |
|
3786 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3787 |
action:nil |
|
3788 |
initialAnswer:initial |
|
3789 |
okLabel:okLabel |
|
3790 |
cancelLabel:nil |
|
3791 |
title:titleString |
|
3792 |
onCancel:nil |
|
3793 |
list:nil |
|
3794 |
initialSelection:nil |
|
3795 |
entryCompletionBlock:nil |
|
3796 |
||
3797 |
" |
|
3798 |
Dialog |
|
3799 |
request:'Enter a string:' |
|
3800 |
initialAnswer:'the default' |
|
3801 |
okLabel:'Yes' |
|
3802 |
title:'Only a Test' |
|
3803 |
" |
|
3804 |
||
3805 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
|
3806 |
"Created: 29.5.1996 / 14:59:57 / cg" |
|
3807 |
! |
|
3808 |
||
2551 | 3809 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString list:list |
3810 |
"launch a Dialog, which allows user to enter something. |
|
3811 |
Return the entered string (may be empty string) |
|
3812 |
or cancelValue (if cancel was pressed)" |
|
3813 |
||
3814 |
^ self |
|
3815 |
request:aString |
|
3816 |
displayAt:nil |
|
3817 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3818 |
action:nil |
|
3819 |
initialAnswer:initial |
|
3820 |
okLabel:okLabel |
|
3821 |
cancelLabel:nil |
|
3822 |
title:titleString |
|
3823 |
onCancel:nil |
|
3824 |
list:list |
|
3825 |
initialSelection:nil |
|
3826 |
entryCompletionBlock:nil |
|
3827 |
||
3828 |
" |
|
3829 |
Dialog |
|
3830 |
request:'Enter or select a string:' |
|
3831 |
initialAnswer:'the default' |
|
3832 |
okLabel:'Yes' |
|
3833 |
title:'Only a Test' |
|
3834 |
list:#('a' 'b' 'c') |
|
3835 |
" |
|
3836 |
||
3837 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
|
3838 |
"Created: 29.5.1996 / 14:59:57 / cg" |
|
3839 |
! |
|
3840 |
||
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3841 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3842 |
"launch a Dialog, which allows user to enter something. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3843 |
Return the entered string (may be empty string) |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3844 |
or cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3845 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3846 |
^ self |
2439 | 3847 |
request:aString |
3848 |
displayAt:nil |
|
3849 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3850 |
action:nil |
|
3851 |
initialAnswer:initial |
|
3852 |
okLabel:okLabel |
|
3853 |
cancelLabel:nil |
|
3854 |
title:titleString |
|
3855 |
onCancel:cancelAction |
|
2444 | 3856 |
list:nil |
3857 |
initialSelection:nil |
|
3858 |
entryCompletionBlock:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3859 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3860 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3861 |
Dialog |
2548 | 3862 |
request:'Enter a string:' |
2439 | 3863 |
initialAnswer:'the default' |
3864 |
onCancel:['foooo'] |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3865 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3866 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3867 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3868 |
"Created: 29.5.1996 / 14:59:57 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3869 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
3870 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3871 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction list:listOfChoices |
2548 | 3872 |
"launch a Dialog, which allows user to enter something |
3873 |
(with a list of choices for fast input). |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3874 |
Return the entered string (may be empty string) |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3875 |
or cancelValue (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3876 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3877 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3878 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3879 |
displayAt:nil |
2439 | 3880 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3881 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3882 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3883 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3884 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3885 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3886 |
onCancel:cancelAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3887 |
list:listOfChoices |
2444 | 3888 |
initialSelection:nil |
3889 |
entryCompletionBlock:nil |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3890 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3891 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3892 |
Dialog |
2548 | 3893 |
request:'Enter a String:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3894 |
initialAnswer:'the default' |
2548 | 3895 |
okLabel:'OK' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3896 |
title:'demo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3897 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3898 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3899 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3900 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3901 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3902 |
"Created: 29.5.1996 / 14:59:57 / cg" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3903 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3904 |
|
2517 | 3905 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction list:listOfChoices entryCompletionBlock:entryCompletionBlock |
2548 | 3906 |
"launch a Dialog, which allows user to enter something |
3907 |
(with a list of choices for fast input). |
|
2517 | 3908 |
Return the entered string (may be empty string) |
3909 |
or cancelValue (if cancel was pressed)" |
|
3910 |
||
3911 |
^ self |
|
3912 |
request:aString |
|
3913 |
displayAt:nil |
|
3914 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3915 |
action:nil |
|
3916 |
initialAnswer:initial |
|
3917 |
okLabel:okLabel |
|
3918 |
cancelLabel:nil |
|
3919 |
title:titleString |
|
3920 |
onCancel:cancelAction |
|
3921 |
list:listOfChoices |
|
3922 |
initialSelection:nil |
|
3923 |
entryCompletionBlock:entryCompletionBlock |
|
3924 |
||
3925 |
" |
|
3926 |
Dialog |
|
2548 | 3927 |
request:'Enter a String:' |
2517 | 3928 |
initialAnswer:'the default' |
2548 | 3929 |
okLabel:'OK' |
2517 | 3930 |
title:'demo' |
3931 |
onCancel:nil |
|
3932 |
list:#('foo' 'bar' 'baz') |
|
3933 |
" |
|
3934 |
||
3935 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
|
3936 |
"Created: 29.5.1996 / 14:59:57 / cg" |
|
3937 |
! |
|
3938 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3939 |
request:aString initialAnswer:initial onCancel:cancelAction |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3940 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3941 |
Return the entered string (may be empty string) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3942 |
or cancelValue (if cancel was pressed)" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3943 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3944 |
^ self |
2439 | 3945 |
request:aString |
3946 |
displayAt:nil |
|
3947 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3948 |
action:nil |
|
3949 |
initialAnswer:initial |
|
2444 | 3950 |
okLabel:nil |
3951 |
cancelLabel:nil |
|
3952 |
title:nil |
|
2439 | 3953 |
onCancel:cancelAction |
2444 | 3954 |
list:nil |
3955 |
initialSelection:nil |
|
3956 |
entryCompletionBlock:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3957 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3958 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
3959 |
Dialog |
2439 | 3960 |
request:'enter a string:' |
3961 |
initialAnswer:'the default' |
|
3962 |
onCancel:['foooo'] |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3963 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3964 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3965 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3966 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3967 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3968 |
request:aString list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3969 |
"launch a Dialog, which allows user to enter something, |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3970 |
but adds a list of choices for fast input. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3971 |
Return the entered string (may be empty string) |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3972 |
or the empty string (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3973 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3974 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3975 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3976 |
displayAt:nil |
2439 | 3977 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3978 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3979 |
initialAnswer:'' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3980 |
okLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3981 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3982 |
title:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3983 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3984 |
list:listOfChoices |
2444 | 3985 |
initialSelection:nil |
3986 |
entryCompletionBlock:nil |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3987 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3988 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3989 |
Dialog |
2548 | 3990 |
request:'Enter a string:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3991 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3992 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3993 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3994 |
"Modified: 29.5.1996 / 14:26:25 / cg" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3995 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
3996 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3997 |
request:aString okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3998 |
"launch a Dialog, which allows user to enter something. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3999 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4000 |
Return the entered string (may be empty string) |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4001 |
or the empty string (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4002 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4003 |
^ self |
2439 | 4004 |
request:aString |
4005 |
displayAt:nil |
|
4006 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4007 |
action:nil |
|
4008 |
initialAnswer:'' |
|
4009 |
okLabel:okLabel |
|
4010 |
cancelLabel:nil |
|
2444 | 4011 |
title:nil |
4012 |
onCancel:nil |
|
4013 |
list:nil |
|
4014 |
initialSelection:nil |
|
4015 |
entryCompletionBlock:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4016 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4017 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4018 |
Dialog |
2548 | 4019 |
request:'Enter a string:' |
4020 |
okLabel:'Yes' |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4021 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4022 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4023 |
"Modified: 29.5.1996 / 14:26:25 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4024 |
"Created: 29.5.1996 / 14:31:10 / cg" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4025 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4026 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4027 |
request:aString okLabel:okLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4028 |
"launch a Dialog, which allows user to enter something. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4029 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4030 |
Return the entered string (may be empty string) |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4031 |
or the value from evaluating cancelValue (if cancel was pressed)" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4032 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4033 |
^ self |
2439 | 4034 |
request:aString |
4035 |
displayAt:nil |
|
4036 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4037 |
action:nil |
|
4038 |
initialAnswer:'' |
|
4039 |
okLabel:okLabel |
|
4040 |
cancelLabel:nil |
|
2444 | 4041 |
title:nil |
2439 | 4042 |
onCancel:cancelValue |
2444 | 4043 |
list:nil |
4044 |
initialSelection:nil |
|
4045 |
entryCompletionBlock:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4046 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4047 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4048 |
Dialog |
2548 | 4049 |
request:'Enter a string:' |
4050 |
okLabel:'Yes' |
|
2439 | 4051 |
onCancel:nil |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4052 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4053 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4054 |
"Modified: 29.5.1996 / 14:32:00 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4055 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4056 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4057 |
request:aString okLabel:okLabel title:titleString onCancel:cancelValue |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4058 |
"launch a Dialog, which allows user to enter something. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4059 |
The okButton is labelled as okLabel. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4060 |
Return the entered string (may be empty string) |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4061 |
or the value from evaluating cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4062 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4063 |
^ self |
2439 | 4064 |
request:aString |
4065 |
displayAt:nil |
|
4066 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4067 |
action:nil |
|
4068 |
initialAnswer:'' |
|
4069 |
okLabel:okLabel |
|
4070 |
cancelLabel:nil |
|
4071 |
title:titleString |
|
4072 |
onCancel:cancelValue |
|
2444 | 4073 |
list:nil |
4074 |
initialSelection:nil |
|
4075 |
entryCompletionBlock:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4076 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4077 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4078 |
Dialog |
2548 | 4079 |
request:'Enter a String:' |
4080 |
okLabel:'Yes' |
|
2439 | 4081 |
title:'foo' |
4082 |
onCancel:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4083 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4084 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4085 |
"Modified: 29.5.1996 / 14:32:00 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4086 |
"Created: 29.5.1996 / 14:57:02 / cg" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4087 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4088 |
|
2360 | 4089 |
request:aString onCancel:cancelActionOrValue |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4090 |
"launch a Dialog, which allows user to enter something. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4091 |
Return the entered string (may be empty string) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4092 |
or the value of cancelAction (if cancel was pressed)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4093 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4094 |
^ self |
2360 | 4095 |
request:aString |
4096 |
displayAt:nil |
|
2439 | 4097 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
2360 | 4098 |
action:nil |
4099 |
initialAnswer:'' |
|
2444 | 4100 |
okLabel:nil |
4101 |
cancelLabel:nil |
|
4102 |
title:nil |
|
2360 | 4103 |
onCancel:cancelActionOrValue |
2444 | 4104 |
list:nil |
4105 |
initialSelection:nil |
|
4106 |
entryCompletionBlock:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4107 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4108 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4109 |
Dialog |
2548 | 4110 |
request:'Enter a String:' |
2360 | 4111 |
onCancel:nil |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4112 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4113 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4114 |
"Created: 27.1.1996 / 14:31:45 / cg" |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4115 |
"Modified: 29.5.1996 / 14:28:59 / cg" |
100 | 4116 |
! |
4117 |
||
2718 | 4118 |
request:aString title:titleString initialAnswer:initial |
4119 |
"launch a Dialog, which allows user to enter something. |
|
4120 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
|
4121 |
||
4122 |
^ self |
|
4123 |
request:aString |
|
4124 |
displayAt:nil |
|
4125 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4126 |
action:nil |
|
4127 |
initialAnswer:initial |
|
4128 |
okLabel:nil |
|
4129 |
cancelLabel:nil |
|
4130 |
title:titleString |
|
4131 |
onCancel:'' |
|
4132 |
list:nil |
|
4133 |
initialSelection:nil |
|
4134 |
entryCompletionBlock:nil |
|
4135 |
||
4136 |
" |
|
4137 |
Dialog |
|
4138 |
request:'enter a string:' |
|
4139 |
initialAnswer:'the default' |
|
4140 |
" |
|
4141 |
||
4142 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
|
4143 |
! |
|
4144 |
||
3152 | 4145 |
requestNumber:aString |
4146 |
"launch a Dialog, which allows user to enter a number. |
|
4147 |
Return the numeric value or nil |
|
4148 |
(for an invalid number or if cancel was pressed)" |
|
4149 |
||
4150 |
|string| |
|
4151 |
||
4152 |
string := self request:aString. |
|
4153 |
^ Number readFrom:string onError:nil. |
|
4154 |
||
4155 |
" |
|
4156 |
Dialog requestNumber:'Enter your Age:' |
|
4157 |
" |
|
4158 |
||
4159 |
"Created: 17.11.1995 / 09:45:21 / cg" |
|
4160 |
! |
|
4161 |
||
3321 | 4162 |
requestNumber:aString initialAnswer: aNumber |
4163 |
"launch a Dialog, which allows user to enter a number. |
|
4164 |
Return the numeric value or nil |
|
4165 |
(for an invalid number or if cancel was pressed)" |
|
4166 |
||
4167 |
|string| |
|
4168 |
||
4169 |
string := self request:aString initialAnswer: aNumber. |
|
4170 |
^ Number readFrom:string onError:nil. |
|
4171 |
||
4172 |
" |
|
4173 |
Dialog requestNumber:'Enter your Age:' initialAnswer: 25 |
|
4174 |
" |
|
4175 |
||
4176 |
"Created: / 26-07-2006 / 12:22:23 / fm" |
|
4177 |
"Modified: / 07-08-2006 / 15:31:30 / fm" |
|
4178 |
! |
|
4179 |
||
197 | 4180 |
requestPassword:aString |
4181 |
"launch a Dialog, which allows user to enter something invisibly. |
|
4182 |
Return the entered string (may be empty string) |
|
4183 |
or nil (if cancel was pressed)" |
|
100 | 4184 |
|
197 | 4185 |
^ EnterBox requestPassword:aString |
133 | 4186 |
|
4187 |
" |
|
4188 |
Dialog |
|
2548 | 4189 |
requestPassword:'Enter Secret:' |
133 | 4190 |
" |
197 | 4191 |
|
4192 |
"Created: 17.11.1995 / 09:45:21 / cg" |
|
2014 | 4193 |
! |
4194 |
||
4195 |
requestText:title lines:numLines columns:numCols initialAnswer:initialText |
|
4196 |
"open a dialog asking for multiline text. |
|
4197 |
Return a stringCollection or nil if cancelled." |
|
4198 |
||
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
4199 |
|dialog textHolder| |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
4200 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
4201 |
textHolder := ValueHolder new. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
4202 |
dialog := Dialog forRequestText:title lines:numLines columns:numCols initialAnswer:initialText model:textHolder. |
2014 | 4203 |
dialog open. |
4204 |
dialog accepted ifTrue:[ |
|
2675 | 4205 |
^ textHolder value |
2014 | 4206 |
]. |
4207 |
^ nil |
|
4208 |
||
2675 | 4209 |
" |
4210 |
Dialog requestText:'Bla' lines:8 columns:40 initialAnswer:'hello world' |
|
4211 |
" |
|
4212 |
||
4213 |
"Modified: / 18.8.2000 / 21:45:41 / cg" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4214 |
! ! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4215 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
4216 |
!DialogBox class methodsFor:'multiple choice dialogs'! |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4217 |
|
3234 | 4218 |
choose:aString fromList:list lines:maxLines |
4219 |
"launch a Dialog showing the message and list. |
|
4220 |
The user can select an item and click ok; in this case, the corresponding value |
|
4221 |
from listValues is returned (doubleclick works as well). |
|
4222 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4223 |
Pressing ok without a selection is treated like cancel." |
|
4224 |
||
4225 |
^ self |
|
4226 |
choose:aString |
|
3455 | 4227 |
fromList:(list collect:[:each| each printString]) values:list |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4228 |
initialSelection:nil |
3455 | 4229 |
buttons:nil values:nil |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4230 |
default:nil |
3234 | 4231 |
lines:maxLines |
4232 |
cancel:nil |
|
4233 |
multiple:false |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4234 |
title:nil |
3234 | 4235 |
postBuildBlock:nil |
4236 |
||
4237 |
" |
|
4238 |
Transcript showCR:( |
|
4239 |
Dialog |
|
4240 |
choose:'choose any' |
|
4241 |
fromList:#(1 2 3 4 5 6 7) |
|
4242 |
lines:4 |
|
4243 |
) |
|
4244 |
" |
|
4245 |
||
3455 | 4246 |
"Modified: / 02-03-2007 / 12:08:31 / cg" |
3234 | 4247 |
! |
4248 |
||
3307 | 4249 |
choose:aString fromList:list lines:maxLines initialSelection:initialSelection |
4250 |
"launch a Dialog showing the message and list. |
|
4251 |
The user can select an item and click ok; in this case, the corresponding value |
|
4252 |
from listValues is returned (doubleclick works as well). |
|
4253 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4254 |
Pressing ok without a selection is treated like cancel." |
|
4255 |
||
4256 |
^ self |
|
4257 |
choose:aString |
|
4258 |
fromList:list values:list initialSelection:initialSelection |
|
4259 |
buttons:nil values:nil |
|
4260 |
lines:maxLines |
|
4261 |
cancel:nil |
|
4262 |
multiple:false |
|
4263 |
postBuildBlock:nil |
|
4264 |
||
4265 |
" |
|
4266 |
Transcript showCR:( |
|
4267 |
Dialog |
|
4268 |
choose:'choose any' |
|
4269 |
fromList:#(1 2 3 4 5 6 7) |
|
4270 |
lines:4 |
|
4271 |
initialSelection:4 |
|
4272 |
) |
|
4273 |
" |
|
4274 |
||
4275 |
"Modified: 27.1.1996 / 14:17:07 / cg" |
|
4276 |
! |
|
4277 |
||
3455 | 4278 |
choose:aString fromList:list lines:maxLines initialSelection:initialSelection title:windowTitle |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4279 |
"launch a Dialog showing the message and list. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4280 |
The user can select an item and click ok; in this case, the corresponding value |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4281 |
from listValues is returned (doubleclick works as well). |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4282 |
If cancel is pressed, the value of cancelBlock is returned. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4283 |
Pressing ok without a selection is treated like cancel." |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4284 |
|
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4285 |
^ self |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4286 |
choose:aString |
3455 | 4287 |
fromList:(list collect:[:each| each printString]) values:list |
4288 |
initialSelection:initialSelection |
|
4289 |
buttons:nil values:nil |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4290 |
default:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4291 |
lines:maxLines |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4292 |
cancel:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4293 |
multiple:false |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4294 |
title:windowTitle |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4295 |
postBuildBlock:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4296 |
|
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4297 |
" |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4298 |
Transcript showCR:( |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4299 |
Dialog |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4300 |
choose:'choose any' |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4301 |
fromList:#(1 2 3 4 5 6 7) |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4302 |
lines:4 |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4303 |
title:'Choose' |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4304 |
) |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4305 |
" |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4306 |
|
3455 | 4307 |
"Created: / 02-03-2007 / 12:06:39 / cg" |
4308 |
! |
|
4309 |
||
4310 |
choose:aString fromList:list lines:maxLines title:windowTitle |
|
4311 |
"launch a Dialog showing the message and list. |
|
4312 |
The user can select an item and click ok; in this case, the corresponding value |
|
4313 |
from listValues is returned (doubleclick works as well). |
|
4314 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4315 |
Pressing ok without a selection is treated like cancel." |
|
4316 |
||
4317 |
^ self |
|
4318 |
choose:aString |
|
4319 |
fromList:(list collect:[:each| each printString]) values:list |
|
4320 |
initialSelection:nil |
|
4321 |
buttons:nil values:nil |
|
4322 |
default:nil |
|
4323 |
lines:maxLines |
|
4324 |
cancel:nil |
|
4325 |
multiple:false |
|
4326 |
title:windowTitle |
|
4327 |
postBuildBlock:nil |
|
4328 |
||
4329 |
" |
|
4330 |
Transcript showCR:( |
|
4331 |
Dialog |
|
4332 |
choose:'choose any' |
|
4333 |
fromList:#(1 2 3 4 5 6 7) |
|
4334 |
lines:4 |
|
4335 |
title:'Choose' |
|
4336 |
) |
|
4337 |
" |
|
4338 |
||
4339 |
"Modified: / 02-03-2007 / 12:08:20 / cg" |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4340 |
! |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4341 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4342 |
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4343 |
"launch a Dialog showing the message and list. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4344 |
The user can select an item and click ok; in this case, the corresponding value |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4345 |
from listValues is returned (doubleclick works as well). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4346 |
The list may be suppressed (if the list arg is nil). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4347 |
Below the list, an optional row of buttons is shown, which can also be |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4348 |
clicked upon, and a corresponding value from buttonValues is returned. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4349 |
If cancel is pressed, the value of cancelBlock is returned. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4350 |
Pressing ok without a selection is treated like cancel." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4351 |
|
2111 | 4352 |
^ self |
4353 |
choose:aString |
|
3455 | 4354 |
fromList:list values:listValues |
4355 |
buttons:buttonLabels values:buttonValues |
|
2111 | 4356 |
lines:maxLines |
4357 |
cancel:cancelBlock |
|
4358 |
multiple:false |
|
4359 |
||
4360 |
" |
|
4361 |
full example: |
|
4362 |
||
4363 |
Transcript showCR:( |
|
4364 |
Dialog |
|
4365 |
choose:'choose any' |
|
4366 |
fromList:#('one' 'two' 'three' 'four') |
|
4367 |
values:#(1 2 3 4) |
|
4368 |
buttons:#('five' 'six' 'seven') |
|
4369 |
values:#(5 6 7) |
|
4370 |
lines:10 |
|
4371 |
cancel:nil |
|
4372 |
) |
|
4373 |
||
4374 |
||
4375 |
no buttons: |
|
4376 |
||
4377 |
Transcript showCR:( |
|
4378 |
Dialog |
|
4379 |
choose:'choose any' |
|
4380 |
fromList:#('one' 'two' 'three' 'four') |
|
4381 |
values:#(1 2 3 4) |
|
4382 |
buttons:nil |
|
4383 |
values:nil |
|
4384 |
lines:4 |
|
4385 |
cancel:nil |
|
4386 |
) |
|
4387 |
||
4388 |
||
4389 |
no list (lines argument is ignored): |
|
4390 |
||
4391 |
Transcript showCR:( |
|
4392 |
Dialog |
|
4393 |
choose:'choose any' |
|
4394 |
fromList:nil |
|
4395 |
values:nil |
|
4396 |
buttons:#('one' 'two' 'three' 'four') |
|
4397 |
values:#(1 2 3 4) |
|
4398 |
lines:nil |
|
4399 |
cancel:nil |
|
4400 |
) |
|
4401 |
||
4402 |
||
4403 |
full including cancel value: |
|
4404 |
||
4405 |
Transcript showCR:( |
|
4406 |
Dialog |
|
4407 |
choose:'choose example' |
|
4408 |
fromList:#('one' 'two' 'three' 'four') |
|
4409 |
values:#(1 2 3 4) |
|
4410 |
buttons:#('five' 'six' 'seven') |
|
4411 |
values:#(5 6 7) |
|
4412 |
lines:4 |
|
4413 |
cancel:[Transcript flash. #aborted] |
|
4414 |
) |
|
4415 |
||
4416 |
||
4417 |
degenerated: |
|
4418 |
||
4419 |
Transcript showCR:( |
|
4420 |
Dialog |
|
4421 |
choose:'choose any' |
|
4422 |
fromList:nil |
|
4423 |
values:nil |
|
4424 |
buttons:nil |
|
4425 |
values:nil |
|
4426 |
lines:nil |
|
4427 |
cancel:nil |
|
4428 |
) |
|
4429 |
||
4430 |
||
4431 |
" |
|
4432 |
||
3455 | 4433 |
"Modified: / 02-03-2007 / 12:08:12 / cg" |
2111 | 4434 |
! |
4435 |
||
4436 |
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock multiple:multiple |
|
4437 |
"launch a Dialog showing the message and list. |
|
4438 |
The user can select an item and click ok; in this case, the corresponding value |
|
4439 |
from listValues is returned (doubleclick works as well). |
|
4440 |
The list may be suppressed (if the list arg is nil). |
|
4441 |
If a list is present, multiple controls if multiple selections are allowed. |
|
4442 |
Below the list, an optional row of buttons is shown, which can also be |
|
4443 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
4444 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4445 |
Pressing ok without a selection is treated like cancel." |
|
4446 |
||
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4447 |
^ self |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4448 |
choose:aString |
3455 | 4449 |
fromList:list values:listValues |
4450 |
buttons:buttonLabels values:buttonValues |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4451 |
lines:maxLines |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4452 |
cancel:cancelBlock |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4453 |
multiple:multiple |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4454 |
postBuildBlock:nil |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4455 |
|
3455 | 4456 |
"Modified: / 02-03-2007 / 12:08:06 / cg" |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4457 |
! |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4458 |
|
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4459 |
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock multiple:multiple postBuildBlock:aBlockOrNil |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4460 |
"launch a Dialog showing the message and list. |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4461 |
The user can select an item and click ok; in this case, the corresponding value |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4462 |
from listValues is returned (doubleclick works as well). |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4463 |
The list may be suppressed (if the list arg is nil). |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4464 |
If a list is present, multiple controls if multiple selections are allowed. |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4465 |
Below the list, an optional row of buttons is shown, which can also be |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4466 |
clicked upon, and a corresponding value from buttonValues is returned. |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4467 |
If cancel is pressed, the value of cancelBlock is returned. |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4468 |
Pressing ok without a selection is treated like cancel." |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4469 |
|
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4470 |
^ self |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4471 |
choose:aString |
3455 | 4472 |
fromList:list values:listValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4473 |
initialSelection:nil |
3455 | 4474 |
buttons:buttonLabels values:buttonValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4475 |
default:nil |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4476 |
lines:maxLines |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4477 |
cancel:cancelBlock |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4478 |
multiple:multiple |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4479 |
title:nil |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4480 |
postBuildBlock:aBlockOrNil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4481 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4482 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4483 |
full example: |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4484 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4485 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4486 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4487 |
choose:'choose any' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4488 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4489 |
values:#(1 2 3 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4490 |
buttons:#('five' 'six' 'seven') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4491 |
values:#(5 6 7) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4492 |
lines:10 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4493 |
cancel:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4494 |
multiple:true |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4495 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4496 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4497 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4498 |
no buttons: |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4499 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4500 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4501 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4502 |
choose:'choose any' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4503 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4504 |
values:#(1 2 3 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4505 |
buttons:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4506 |
values:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4507 |
lines:4 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4508 |
cancel:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4509 |
multiple:true |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4510 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4511 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4512 |
|
3455 | 4513 |
"Modified: / 02-03-2007 / 12:08:02 / cg" |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4514 |
! |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4515 |
|
4058
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4516 |
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock postBuildBlock:postBuildBlock |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4517 |
"launch a Dialog showing the message and list. |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4518 |
The user can select an item and click ok; in this case, the corresponding value |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4519 |
from listValues is returned (doubleclick works as well). |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4520 |
The list may be suppressed (if the list arg is nil). |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4521 |
Below the list, an optional row of buttons is shown, which can also be |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4522 |
clicked upon, and a corresponding value from buttonValues is returned. |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4523 |
If cancel is pressed, the value of cancelBlock is returned. |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4524 |
Pressing ok without a selection is treated like cancel." |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4525 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4526 |
^ self |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4527 |
choose:aString |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4528 |
fromList:list values:listValues |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4529 |
buttons:buttonLabels values:buttonValues |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4530 |
lines:maxLines |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4531 |
cancel:cancelBlock |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4532 |
multiple:false |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4533 |
postBuildBlock:postBuildBlock. |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4534 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4535 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4536 |
" |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4537 |
full example: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4538 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4539 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4540 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4541 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4542 |
fromList:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4543 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4544 |
buttons:#('five' 'six' 'seven') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4545 |
values:#(5 6 7) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4546 |
lines:10 |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4547 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4548 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4549 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4550 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4551 |
no buttons: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4552 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4553 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4554 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4555 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4556 |
fromList:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4557 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4558 |
buttons:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4559 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4560 |
lines:4 |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4561 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4562 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4563 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4564 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4565 |
no list (lines argument is ignored): |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4566 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4567 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4568 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4569 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4570 |
fromList:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4571 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4572 |
buttons:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4573 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4574 |
lines:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4575 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4576 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4577 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4578 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4579 |
full including cancel value: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4580 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4581 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4582 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4583 |
choose:'choose example' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4584 |
fromList:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4585 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4586 |
buttons:#('five' 'six' 'seven') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4587 |
values:#(5 6 7) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4588 |
lines:4 |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4589 |
cancel:[Transcript flash. #aborted] |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4590 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4591 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4592 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4593 |
degenerated: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4594 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4595 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4596 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4597 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4598 |
fromList:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4599 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4600 |
buttons:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4601 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4602 |
lines:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4603 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4604 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4605 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4606 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4607 |
" |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4608 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4609 |
"Modified: / 02-03-2007 / 12:08:12 / cg" |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4610 |
! |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4611 |
|
3340 | 4612 |
choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues default:defaultValue lines:maxLines cancel:cancelBlock multiple:multiple postBuildBlock:aBlockOrNil |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4613 |
"launch a Dialog showing the message and list. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4614 |
The user can select an item and click ok; in this case, the corresponding value |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4615 |
from listValues is returned (doubleclick works as well). |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4616 |
The list may be suppressed (if the list arg is nil). |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4617 |
If a list is present, multiple controls if multiple selections are allowed. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4618 |
Below the list, an optional row of buttons is shown, which can also be |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4619 |
clicked upon, and a corresponding value from buttonValues is returned. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4620 |
If cancel is pressed, the value of cancelBlock is returned. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4621 |
Pressing ok without a selection is treated like cancel." |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4622 |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4623 |
^ self |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4624 |
choose:aString |
3455 | 4625 |
fromList:list values:listValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4626 |
initialSelection:initialListSelectionOrNil |
3455 | 4627 |
buttons:buttonLabels values:buttonValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4628 |
default:defaultValue |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4629 |
lines:maxLines |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4630 |
cancel:cancelBlock |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4631 |
multiple:multiple |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4632 |
title:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4633 |
postBuildBlock:aBlockOrNil |
3455 | 4634 |
|
4635 |
"Modified: / 02-03-2007 / 12:07:57 / cg" |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4636 |
! |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4637 |
|
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4638 |
choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues default:defaultValue lines:maxLines cancel:cancelBlock multiple:multiple title:windowTitle postBuildBlock:aBlockOrNil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4639 |
"launch a Dialog showing the message and list. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4640 |
The user can select an item and click ok; in this case, the corresponding value |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4641 |
from listValues is returned (doubleclick works as well). |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4642 |
The list may be suppressed (if the list arg is nil). |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4643 |
If a list is present, multiple controls if multiple selections are allowed. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4644 |
Below the list, an optional row of buttons is shown, which can also be |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4645 |
clicked upon, and a corresponding value from buttonValues is returned. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4646 |
If cancel is pressed, the value of cancelBlock is returned. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4647 |
Pressing ok without a selection is treated like cancel." |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4648 |
|
3469 | 4649 |
|box listView panel sel haveDefault| |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4650 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4651 |
box := Dialog new. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4652 |
(box addTextLabel:aString) adjust:#left. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4653 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4654 |
list notNil ifTrue:[ |
2299
5470ae201605
choose...fromList... : show a scrollBar if required
Claus Gittinger <cg@exept.de>
parents:
2298
diff
changeset
|
4655 |
maxLines <= list size ifTrue:[ |
2111 | 4656 |
listView := ScrollableView for:SelectionInListView. |
4657 |
] ifFalse:[ |
|
4658 |
listView := SelectionInListView new. |
|
4659 |
listView level:-1. |
|
4660 |
]. |
|
4661 |
listView list:list. |
|
2116 | 4662 |
listView doubleClickAction:[:selectionIndex | |
2111 | 4663 |
|val| |
4664 |
||
2116 | 4665 |
multiple ifTrue:[ |
4666 |
val := selectionIndex collect:[:idx | listValues at:idx]. |
|
4667 |
] ifFalse:[ |
|
4668 |
val := listValues at:selectionIndex. |
|
4669 |
]. |
|
2111 | 4670 |
box destroy. |
4671 |
^ val |
|
4672 |
]. |
|
4673 |
listView multipleSelectOk:multiple. |
|
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4674 |
initialListSelectionOrNil notNil ifTrue:[ |
3005 | 4675 |
multiple ifTrue:[ |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4676 |
listView selection:(initialListSelectionOrNil collect:[:each| listValues indexOf:each]) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4677 |
] ifFalse:[ |
3005 | 4678 |
listView selection:(listValues indexOf:initialListSelectionOrNil) |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4679 |
] |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
4680 |
]. |
2111 | 4681 |
box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines). |
4682 |
box makeTabable:listView. |
|
3340 | 4683 |
box name:listView as:#ListView. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4684 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4685 |
|
2112 | 4686 |
buttonLabels size > 0 ifTrue:[ |
2111 | 4687 |
panel := HorizontalPanelView new. |
4688 |
panel horizontalLayout:#fitSpace. |
|
3340 | 4689 |
haveDefault := false. |
2111 | 4690 |
buttonLabels keysAndValuesDo:[:index :label | |
4691 |
|b| |
|
4692 |
||
4693 |
b := Button label:label. |
|
4694 |
b action:[ |
|
4695 |
|val| |
|
4696 |
val := buttonValues at:index. |
|
3340 | 4697 |
val isBlock ifTrue:[ val := val valueWithOptionalArgument:listView selection and:box]. |
2111 | 4698 |
box destroy. |
4699 |
multiple ifTrue:[ |
|
4700 |
^ Array with:val |
|
4701 |
]. |
|
4702 |
^ val |
|
4703 |
]. |
|
3340 | 4704 |
haveDefault ifFalse:[ |
4705 |
defaultValue notNil ifTrue:[ |
|
4706 |
(buttonValues at:index) = defaultValue ifTrue:[ |
|
4707 |
b isReturnButton:true. |
|
4708 |
haveDefault := true. |
|
4709 |
]. |
|
4710 |
]. |
|
4711 |
]. |
|
2111 | 4712 |
panel add:b. |
4713 |
box makeTabable:b. |
|
4714 |
]. |
|
4715 |
box addComponent:panel indent:0. "/ panel has its own idea of indenting |
|
3340 | 4716 |
box name:panel as:#ButtonPanel2. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4717 |
]. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4718 |
box addAbortButton. |
3340 | 4719 |
list notNil ifTrue:[ |
4720 |
haveDefault ifTrue:[ |
|
4721 |
(box addOkButton) isReturnButton:false. |
|
4722 |
] ifFalse:[ |
|
4723 |
box addOkButton. |
|
4724 |
]. |
|
4725 |
]. |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4726 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4727 |
listView notNil ifTrue:[box stickAtBottomWithVariableHeight:listView]. |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4728 |
panel notNil ifTrue:[box stickAtBottomWithFixHeight:panel]. |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
4729 |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4730 |
aBlockOrNil notNil ifTrue:[ |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4731 |
aBlockOrNil value:box |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4732 |
]. |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4733 |
windowTitle notNil ifTrue:[ |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4734 |
box label:windowTitle. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4735 |
]. |
4058
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
4736 |
|
2439 | 4737 |
self showBox:box. |
2111 | 4738 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4739 |
box accepted ifTrue:[ |
2111 | 4740 |
(sel := listView selection) notNil ifTrue:[ |
4741 |
box destroy. |
|
4742 |
sel isInteger ifTrue:[ |
|
4743 |
^ listValues at:sel |
|
3340 | 4744 |
]. |
4745 |
^ sel collect:[:idx | listValues at:idx] |
|
4746 |
]. |
|
4747 |
box destroy. |
|
3536
76d3579362e4
choose:fromList.... returned true if OK was pressed without
Claus Gittinger <cg@exept.de>
parents:
3532
diff
changeset
|
4748 |
^ nil "/ ^ true. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4749 |
]. |
2111 | 4750 |
box destroy. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4751 |
^ cancelBlock value |
197 | 4752 |
|
4753 |
" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4754 |
full example: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4755 |
|
2111 | 4756 |
Transcript showCR:( |
4757 |
Dialog |
|
4758 |
choose:'choose any' |
|
3340 | 4759 |
fromList:#('one' 'two' 'three' 'four') values:#(1 2 3 4) |
4760 |
initialSelection: nil |
|
4761 |
buttons:#('five' 'six' 'seven') values:#(5 6 7) |
|
4762 |
default:6 |
|
2111 | 4763 |
lines:10 |
4764 |
cancel:nil |
|
4765 |
multiple:true |
|
3340 | 4766 |
postBuildBlock:nil |
2111 | 4767 |
) |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4768 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4769 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4770 |
no buttons: |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4771 |
|
2111 | 4772 |
Transcript showCR:( |
4773 |
Dialog |
|
4774 |
choose:'choose any' |
|
4775 |
fromList:#('one' 'two' 'three' 'four') |
|
4776 |
values:#(1 2 3 4) |
|
4777 |
buttons:nil |
|
4778 |
values:nil |
|
4779 |
lines:4 |
|
4780 |
cancel:nil |
|
4781 |
multiple:true |
|
4782 |
) |
|
133 | 4783 |
" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4784 |
|
3340 | 4785 |
"Created: / 22-08-2006 / 16:10:19 / cg" |
4786 |
! |
|
4787 |
||
4788 |
choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock multiple:multiple postBuildBlock:aBlockOrNil |
|
4789 |
"launch a Dialog showing the message and list. |
|
4790 |
The user can select an item and click ok; in this case, the corresponding value |
|
4791 |
from listValues is returned (doubleclick works as well). |
|
4792 |
The list may be suppressed (if the list arg is nil). |
|
4793 |
If a list is present, multiple controls if multiple selections are allowed. |
|
4794 |
Below the list, an optional row of buttons is shown, which can also be |
|
4795 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
4796 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4797 |
Pressing ok without a selection is treated like cancel." |
|
4798 |
||
4799 |
^ self |
|
4800 |
choose:aString |
|
3455 | 4801 |
fromList:list values:listValues |
3340 | 4802 |
initialSelection:initialListSelectionOrNil |
3455 | 4803 |
buttons:buttonLabels values:buttonValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4804 |
default:nil |
3340 | 4805 |
lines:maxLines |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4806 |
cancel:cancelBlock |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4807 |
multiple:multiple |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4808 |
title:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4809 |
postBuildBlock:aBlockOrNil |
3340 | 4810 |
|
3455 | 4811 |
"Modified: / 02-03-2007 / 12:07:47 / cg" |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4812 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4813 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4814 |
choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4815 |
"launch a Dialog showing the message and list. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4816 |
The user can select an item and click ok; in this case, the corresponding value |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4817 |
from listValues is returned (doubleclick works as well). |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4818 |
If cancel is pressed, the value of cancelBlock is returned. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4819 |
Pressing ok without a selection is treated like cancel." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4820 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4821 |
^ self |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4822 |
choose:aString |
3455 | 4823 |
fromList:list values:listValues |
4824 |
buttons:nil values:nil |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4825 |
lines:maxLines |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4826 |
cancel:cancelBlock |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4827 |
multiple:false |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4828 |
postBuildBlock:nil |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4829 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4830 |
" |
655 | 4831 |
Transcript showCR:( |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4832 |
Dialog |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4833 |
choose:'choose any' |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4834 |
fromList:#('one' 'two' 'three' 'four') |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4835 |
values:#(1 2 3 4) |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4836 |
lines:4 |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4837 |
cancel:nil |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4838 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4839 |
|
655 | 4840 |
Transcript showCR:( |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4841 |
Dialog |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4842 |
choose:'choose example' |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4843 |
fromList:#('one' 'two' 'three' 'four') |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4844 |
values:#(1 2 3 4) |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4845 |
lines:4 |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
4846 |
cancel:[Transcript flash. #aborted] |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4847 |
) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4848 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4849 |
|
3455 | 4850 |
"Modified: / 02-03-2007 / 12:07:42 / cg" |
4851 |
! |
|
4852 |
||
3630 | 4853 |
choose:aString fromList:list values:values lines:maxLines cancel:cancelBlock title:windowTitle |
4854 |
"launch a Dialog showing the message and list. |
|
4855 |
The user can select an item and click ok; in this case, the corresponding value |
|
4856 |
from listValues is returned (doubleclick works as well). |
|
4857 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4858 |
Pressing ok without a selection is treated like cancel." |
|
4859 |
||
4860 |
^ self |
|
4861 |
choose:aString |
|
4862 |
fromList:list values:values |
|
4863 |
initialSelection:nil |
|
4864 |
buttons:nil values:nil |
|
4865 |
default:nil |
|
4866 |
lines:maxLines |
|
4867 |
cancel:cancelBlock |
|
4868 |
multiple:false |
|
4869 |
title:windowTitle |
|
4870 |
postBuildBlock:nil |
|
4871 |
||
4872 |
" |
|
4873 |
Transcript showCR:( |
|
4874 |
Dialog |
|
4875 |
choose:'choose any' |
|
4876 |
fromList:#(1 2 3 4 5 6 7) |
|
4877 |
lines:4 |
|
4878 |
title:'Choose' |
|
4879 |
) |
|
4880 |
" |
|
4881 |
||
4882 |
"Created: / 02-03-2007 / 12:07:32 / cg" |
|
4883 |
! |
|
4884 |
||
3455 | 4885 |
choose:aString fromList:list values:values lines:maxLines initialSelection:initialSelection title:windowTitle |
4886 |
"launch a Dialog showing the message and list. |
|
4887 |
The user can select an item and click ok; in this case, the corresponding value |
|
4888 |
from listValues is returned (doubleclick works as well). |
|
4889 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4890 |
Pressing ok without a selection is treated like cancel." |
|
4891 |
||
4892 |
^ self |
|
4893 |
choose:aString |
|
4894 |
fromList:list values:values |
|
4895 |
initialSelection:initialSelection |
|
4896 |
buttons:nil values:nil |
|
4897 |
default:nil |
|
4898 |
lines:maxLines |
|
4899 |
cancel:nil |
|
4900 |
multiple:false |
|
4901 |
title:windowTitle |
|
4902 |
postBuildBlock:nil |
|
4903 |
||
4904 |
" |
|
4905 |
Transcript showCR:( |
|
4906 |
Dialog |
|
4907 |
choose:'choose any' |
|
4908 |
fromList:#(1 2 3 4 5 6 7) |
|
4909 |
lines:4 |
|
4910 |
title:'Choose' |
|
4911 |
) |
|
4912 |
" |
|
4913 |
||
4914 |
"Created: / 02-03-2007 / 12:07:32 / cg" |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4915 |
! |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4916 |
|
3630 | 4917 |
choose:aString fromList:list values:values lines:maxLines title:windowTitle |
4918 |
"launch a Dialog showing the message and list. |
|
4919 |
The user can select an item and click ok; in this case, the corresponding value |
|
4920 |
from listValues is returned (doubleclick works as well). |
|
4921 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4922 |
Pressing ok without a selection is treated like cancel." |
|
4923 |
||
4924 |
^ self |
|
4925 |
choose:aString |
|
4926 |
fromList:list values:values |
|
4927 |
initialSelection:nil |
|
4928 |
buttons:nil values:nil |
|
4929 |
default:nil |
|
4930 |
lines:maxLines |
|
4931 |
cancel:nil |
|
4932 |
multiple:false |
|
4933 |
title:windowTitle |
|
4934 |
postBuildBlock:nil |
|
4935 |
||
4936 |
" |
|
4937 |
Transcript showCR:( |
|
4938 |
Dialog |
|
4939 |
choose:'choose any' |
|
4940 |
fromList:#(1 2 3 4 5 6 7) |
|
4941 |
lines:4 |
|
4942 |
title:'Choose' |
|
4943 |
) |
|
4944 |
" |
|
4945 |
||
4946 |
"Created: / 02-03-2007 / 12:07:32 / cg" |
|
4947 |
! |
|
4948 |
||
2473 | 4949 |
choose:aString label:windowLabel image:imageOrNil labels:buttonLabels values:values default:default onCancel:cancelValue |
2472 | 4950 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
4951 |
Returning a corresponding value from the values-array. |
|
4952 |
The default entries button is marked as a return button and entering |
|
4953 |
return will choose that value; hitting escape returns cancelValue. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4954 |
For a good userInterface style, we recommend this being the last |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4955 |
entry (to make the right-most button the default button)." |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4956 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4957 |
|box answer idx| |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4958 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4959 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
803 | 4960 |
windowLabel notNil ifTrue:[ |
2439 | 4961 |
box label:windowLabel |
803 | 4962 |
]. |
2473 | 4963 |
imageOrNil notNil ifTrue:[ |
4964 |
box image:imageOrNil |
|
4965 |
]. |
|
4966 |
||
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4967 |
box buttonTitles:(self classResources array:buttonLabels) |
2439 | 4968 |
actions:(values collect:[:val | [answer := val]]). |
2472 | 4969 |
answer := cancelValue. |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4970 |
box buttons last isReturnButton:false. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4971 |
idx := values indexOf:default. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4972 |
idx ~~ 0 ifTrue:[box defaultButtonIndex:idx]. |
2439 | 4973 |
|
4974 |
self showAndThenDestroyBox:box. |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4975 |
box actions:nil. |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4976 |
^ answer |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4977 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4978 |
"no good style (default button is not the rightmost one) |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4979 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4980 |
Dialog |
2439 | 4981 |
choose:'choose any' |
2472 | 4982 |
label:'Foo Bar Baz' |
2439 | 4983 |
labels:#('one' 'two' 'three' 'four') |
4984 |
values:#(1 2 3 4) |
|
2472 | 4985 |
default:2 |
4986 |
onCancel:1 |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4987 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4988 |
Dialog |
2439 | 4989 |
choose:'choose any' |
4990 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
4991 |
values:#(nil foo bar baz) |
|
4992 |
default:#baz |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4993 |
|
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4994 |
Dialog |
2439 | 4995 |
choose:'choose any' |
4996 |
labels:#('one' 'two' 'three' 'four') |
|
4997 |
values:#(1 2 3 4) |
|
4998 |
default:nil |
|
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
4999 |
" |
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
5000 |
|
2473 | 5001 |
"Modified: / 16.11.2001 / 14:55:33 / cg" |
5002 |
"Created: / 16.11.2001 / 15:04:16 / cg" |
|
5003 |
! |
|
5004 |
||
5005 |
choose:aString label:windowLabel labels:buttonLabels values:values default:default |
|
5006 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
5007 |
Returning a corresponding value from the values-array. |
|
5008 |
The default entries button is marked as a return button and entering |
|
5009 |
return will choose that value; hitting escape returns nil. |
|
5010 |
For a good userInterface style, we recommend this being the last |
|
5011 |
entry (to make the right-most button the default button)." |
|
5012 |
||
5013 |
^ self |
|
5014 |
choose:aString |
|
3455 | 5015 |
label:windowLabel image:nil |
5016 |
labels:buttonLabels values:values |
|
2473 | 5017 |
default:default |
5018 |
onCancel:nil |
|
5019 |
||
5020 |
"no good style (default button is not the rightmost one) |
|
5021 |
||
5022 |
Dialog |
|
5023 |
choose:'choose any' |
|
5024 |
labels:#('one' 'two' 'three' 'four') |
|
5025 |
values:#(1 2 3 4) |
|
5026 |
default:2 |
|
5027 |
||
5028 |
Dialog |
|
5029 |
choose:'choose any' |
|
5030 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
5031 |
values:#(nil foo bar baz) |
|
5032 |
default:#baz |
|
5033 |
||
5034 |
Dialog |
|
5035 |
choose:'choose any' |
|
5036 |
labels:#('one' 'two' 'three' 'four') |
|
5037 |
values:#(1 2 3 4) |
|
5038 |
default:nil |
|
5039 |
" |
|
5040 |
||
3455 | 5041 |
"Created: / 22-07-1996 / 11:44:27 / cg" |
5042 |
"Modified: / 02-03-2007 / 12:09:01 / cg" |
|
2473 | 5043 |
! |
5044 |
||
5045 |
choose:aString label:windowLabel labels:buttonLabels values:values default:default onCancel:cancelValue |
|
5046 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
5047 |
Returning a corresponding value from the values-array. |
|
5048 |
The default entries button is marked as a return button and entering |
|
5049 |
return will choose that value; hitting escape returns cancelValue. |
|
5050 |
For a good userInterface style, we recommend this being the last |
|
5051 |
entry (to make the right-most button the default button)." |
|
5052 |
||
5053 |
^ self |
|
3455 | 5054 |
choose:aString |
5055 |
label:windowLabel image:nil |
|
2473 | 5056 |
labels:buttonLabels values:values |
5057 |
default:default onCancel:cancelValue |
|
5058 |
||
5059 |
"no good style (default button is not the rightmost one) |
|
5060 |
||
5061 |
Dialog |
|
5062 |
choose:'choose any' |
|
5063 |
label:'Foo Bar Baz' |
|
5064 |
labels:#('one' 'two' 'three' 'four') |
|
5065 |
values:#(1 2 3 4) |
|
5066 |
default:2 |
|
5067 |
onCancel:1 |
|
5068 |
||
5069 |
Dialog |
|
5070 |
choose:'choose any' |
|
5071 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
5072 |
values:#(nil foo bar baz) |
|
5073 |
default:#baz |
|
5074 |
||
5075 |
Dialog |
|
5076 |
choose:'choose any' |
|
5077 |
labels:#('one' 'two' 'three' 'four') |
|
5078 |
values:#(1 2 3 4) |
|
5079 |
default:nil |
|
5080 |
" |
|
5081 |
||
3455 | 5082 |
"Created: / 16-11-2001 / 14:53:55 / cg" |
5083 |
"Modified: / 02-03-2007 / 12:08:44 / cg" |
|
803 | 5084 |
! |
5085 |
||
5086 |
choose:aString labels:buttonLabels values:values default:default |
|
5087 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
5088 |
Returning a corresponding value from the values-array. |
|
5089 |
The default entries button is marked as a return button and entering |
|
5090 |
return will choose that value. |
|
5091 |
For a good userInterface style, we recommend this being the last |
|
5092 |
entry (to make the right-most button the default button)." |
|
5093 |
||
5094 |
^ self |
|
2473 | 5095 |
choose:aString |
3455 | 5096 |
label:nil image:nil |
5097 |
labels:buttonLabels values:values |
|
2473 | 5098 |
default:default |
5099 |
onCancel:nil |
|
803 | 5100 |
|
5101 |
||
5102 |
"no good style (default button is not the rightmost one) |
|
5103 |
||
5104 |
Dialog |
|
2473 | 5105 |
choose:'choose any' |
5106 |
labels:#('one' 'two' 'three' 'four') |
|
5107 |
values:#(1 2 3 4) |
|
5108 |
default:2 |
|
803 | 5109 |
|
5110 |
Dialog |
|
2473 | 5111 |
choose:'choose any' |
5112 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
5113 |
values:#(nil foo bar baz) |
|
5114 |
default:#baz |
|
803 | 5115 |
|
5116 |
Dialog |
|
2473 | 5117 |
choose:'choose any' |
5118 |
labels:#('one' 'two' 'three' 'four') |
|
5119 |
values:#(1 2 3 4) |
|
5120 |
default:nil |
|
5121 |
" |
|
5122 |
||
3455 | 5123 |
"Modified: / 02-03-2007 / 12:08:55 / cg" |
2111 | 5124 |
! |
5125 |
||
5126 |
chooseMultiple:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock |
|
5127 |
"launch a Dialog showing the message and list. |
|
5128 |
The user can select an item and click ok; in this case, the corresponding value |
|
5129 |
from listValues is returned (doubleclick works as well). |
|
5130 |
The list may be suppressed (if the list arg is nil). |
|
5131 |
Below the list, an optional row of buttons is shown, which can also be |
|
5132 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
5133 |
If cancel is pressed, the value of cancelBlock is returned. |
|
5134 |
Pressing ok without a selection is treated like cancel." |
|
5135 |
||
5136 |
^ self |
|
5137 |
choose:aString |
|
3455 | 5138 |
fromList:list values:listValues |
5139 |
buttons:buttonLabels values:buttonValues |
|
2111 | 5140 |
lines:maxLines |
5141 |
cancel:cancelBlock |
|
5142 |
multiple:true |
|
5143 |
||
5144 |
" |
|
5145 |
full example: |
|
5146 |
||
5147 |
Transcript showCR:( |
|
5148 |
Dialog |
|
2112 | 5149 |
chooseMultiple:'choose selected' |
2111 | 5150 |
fromList:#('one' 'two' 'three' 'four') |
5151 |
values:#(1 2 3 4) |
|
5152 |
buttons:nil |
|
5153 |
values:nil |
|
5154 |
lines:10 |
|
5155 |
cancel:nil |
|
5156 |
) |
|
2112 | 5157 |
|
5158 |
Transcript showCR:( |
|
5159 |
Dialog |
|
5160 |
chooseMultiple:'choose selected' |
|
5161 |
fromList:#('one' 'two' 'three' 'four') |
|
5162 |
values:#(1 2 3 4) |
|
5163 |
buttons:#() |
|
5164 |
values:#() |
|
5165 |
lines:10 |
|
5166 |
cancel:nil |
|
5167 |
) |
|
2111 | 5168 |
" |
5169 |
||
3455 | 5170 |
"Modified: / 02-03-2007 / 12:09:10 / cg" |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5171 |
! |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5172 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5173 |
chooseMultiple:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil lines:maxLines |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5174 |
"launch a Dialog showing the message and list. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5175 |
The user can select an item and click ok; in this case, the corresponding value |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5176 |
from listValues is returned (doubleclick works as well). |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5177 |
The list may be suppressed (if the list arg is nil). |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5178 |
Below the list, an optional row of buttons is shown, which can also be |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5179 |
clicked upon, and a corresponding value from buttonValues is returned. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5180 |
If cancel is pressed, the value of cancelBlock is returned. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5181 |
Pressing ok without a selection is treated like cancel." |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5182 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5183 |
^ self |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5184 |
choose:aString |
3455 | 5185 |
fromList:list values:listValues |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5186 |
initialSelection:initialListSelectionOrNil |
3455 | 5187 |
buttons:nil values:nil |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5188 |
lines:maxLines |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5189 |
cancel:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5190 |
multiple:true |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5191 |
postBuildBlock:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5192 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5193 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5194 |
full example: |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5195 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5196 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5197 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5198 |
chooseMultiple:'choose selected' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5199 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5200 |
values:#(1 2 3 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5201 |
initialSelection:#(2 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5202 |
lines:10 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5203 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5204 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5205 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5206 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5207 |
chooseMultiple:'choose selected' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5208 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5209 |
values:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5210 |
initialSelection:#( 'two' 'three') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5211 |
lines:10 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5212 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5213 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5214 |
|
3455 | 5215 |
"Created: / 18-08-2000 / 22:38:13 / cg" |
5216 |
"Modified: / 02-03-2007 / 12:09:15 / cg" |
|
100 | 5217 |
! ! |
5218 |
||
2439 | 5219 |
!DialogBox class methodsFor:'private'! |
5220 |
||
5221 |
showAndThenDestroyBox:aBox |
|
5222 |
self showBox:aBox. |
|
5223 |
aBox destroy |
|
5224 |
! |
|
5225 |
||
5226 |
showBox:aBox |
|
2666
4e5cf41990d6
show (some dialogs) centered
Claus Gittinger <cg@exept.de>
parents:
2640
diff
changeset
|
5227 |
|wg v| |
4e5cf41990d6
show (some dialogs) centered
Claus Gittinger <cg@exept.de>
parents:
2640
diff
changeset
|
5228 |
|
2439 | 5229 |
ForceModalBoxesToOpenAtCenter == true ifTrue:[ |
5230 |
aBox showAtCenter. |
|
3888 | 5231 |
^ self. |
5232 |
]. |
|
5233 |
ForceModalBoxesToOpenAtPointer == true ifTrue:[ |
|
5234 |
aBox showAtPointer. |
|
5235 |
^ self. |
|
5236 |
]. |
|
5237 |
||
5238 |
wg := WindowGroup activeGroup. |
|
5239 |
wg isNil ifTrue:[ |
|
5240 |
aBox showAtCenter. |
|
5241 |
^ self. |
|
5242 |
]. |
|
5243 |
wg isModal ifTrue:[ |
|
5244 |
v := wg mainView. |
|
5245 |
v notNil ifTrue:[ |
|
5246 |
aBox showCenteredIn:v. |
|
5247 |
^ self. |
|
5248 |
]. |
|
5249 |
]. |
|
5250 |
||
5251 |
v := wg mainGroup mainView. |
|
5252 |
v isNil ifTrue:[ |
|
5253 |
aBox showAtCenter. |
|
5254 |
^ self. |
|
5255 |
]. |
|
5256 |
||
5257 |
aBox showCenteredIn:v. |
|
2439 | 5258 |
! ! |
5259 |
||
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5260 |
!DialogBox class methodsFor:'queries'! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5261 |
|
2197
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5262 |
defaultOKButtonAtLeft |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5263 |
"somewhat of a kludge: |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5264 |
some viewStyles have ok at left (motif), others at right..." |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5265 |
|
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5266 |
^ (StyleSheet at:'dialogBox.okAtLeft' default:false) |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5267 |
|
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5268 |
" |
2694 | 5269 |
DialogBox defaultOKButtonAtLeft |
5270 |
" |
|
2197
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5271 |
! |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
5272 |
|
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5273 |
defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5274 |
"return a default parent (top-) window for the dialog. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5275 |
Here, the currently active view is returned, if there |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5276 |
is one; otherwise, the first encountered topView is |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5277 |
returned." |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5278 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5279 |
|activeGroup| |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5280 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5281 |
activeGroup := WindowGroup activeGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5282 |
activeGroup isNil ifTrue:[ |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5283 |
"/ mhmh - looks like I am a background process ... |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5284 |
activeGroup := Transcript windowGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5285 |
activeGroup isNil ifTrue:[^ nil]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5286 |
]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5287 |
^ activeGroup topViews first. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5288 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5289 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5290 |
self defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5291 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5292 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5293 |
"Modified: / 16.6.1998 / 12:36:15 / cg" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5294 |
! ! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
5295 |
|
2486 | 5296 |
!DialogBox class methodsFor:'smalltalk dialogs'! |
5297 |
||
3276 | 5298 |
requestClass:aString |
5299 |
"launch a Dialog, which allows user to enter an existing classes name. |
|
5300 |
Return the entered class or nil (if cancel was pressed). |
|
5301 |
The entryField does classNameCompletion on TAB." |
|
5302 |
||
5303 |
^ self requestClass:aString okLabel:'OK' initialAnswer:nil. |
|
5304 |
||
5305 |
" |
|
5306 |
Dialog |
|
5307 |
requestClass:'Enter a class:' |
|
5308 |
" |
|
5309 |
! |
|
5310 |
||
3282 | 5311 |
requestClass:aString initialAnswer:initialAnswer |
5312 |
"launch a Dialog, which allows user to enter an existing classes name. |
|
5313 |
Return the entered class or nil (if cancel was pressed). |
|
5314 |
The entryField does classNameCompletion on TAB." |
|
5315 |
||
5316 |
^ self requestClass:aString okLabel:'OK' initialAnswer:initialAnswer. |
|
5317 |
||
5318 |
" |
|
5319 |
Dialog |
|
5320 |
requestClass:'Enter a class:' |
|
5321 |
initialAnswer:'Array' |
|
5322 |
" |
|
5323 |
! |
|
5324 |
||
3532 | 5325 |
requestClass:aString list:list okLabel:okLabel initialAnswer:initial |
3276 | 5326 |
"launch a Dialog, which allows user to enter an existing classes name. |
5327 |
Return the entered class or nil (if cancel was pressed). |
|
3181 | 5328 |
The entryField does classNameCompletion on TAB." |
5329 |
||
5330 |
|className| |
|
5331 |
||
3532 | 5332 |
className := self requestClassName:aString list:list okLabel:okLabel initialAnswer:initial. |
3276 | 5333 |
className isEmptyOrNil ifTrue:[^ nil]. |
3181 | 5334 |
^ Smalltalk classNamed:className |
5335 |
||
5336 |
" |
|
5337 |
Dialog |
|
3276 | 5338 |
requestClass:'Enter a class:' |
3181 | 5339 |
okLabel:'OK' |
5340 |
initialAnswer:'Arr' |
|
5341 |
" |
|
3532 | 5342 |
|
5343 |
"Created: / 12-01-2008 / 23:02:28 / cg" |
|
5344 |
! |
|
5345 |
||
5346 |
requestClass:aString okLabel:okLabel initialAnswer:initial |
|
5347 |
"launch a Dialog, which allows user to enter an existing classes name. |
|
5348 |
Return the entered class or nil (if cancel was pressed). |
|
5349 |
The entryField does classNameCompletion on TAB." |
|
5350 |
||
5351 |
^ self requestClass:aString list:nil okLabel:okLabel initialAnswer:initial |
|
5352 |
||
5353 |
" |
|
5354 |
Dialog |
|
5355 |
requestClass:'Enter a class:' |
|
5356 |
okLabel:'OK' |
|
5357 |
initialAnswer:'Arr' |
|
5358 |
" |
|
5359 |
||
5360 |
"Modified: / 12-01-2008 / 23:02:42 / cg" |
|
5361 |
! |
|
5362 |
||
5363 |
requestClassName:aString list:list okLabel:okLabel initialAnswer:initial |
|
3181 | 5364 |
"launch a Dialog, which allows user to enter a class name. |
5365 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
5366 |
The entryField does classNameCompletion on TAB." |
|
5367 |
||
5368 |
^ self |
|
5369 |
request:aString |
|
5370 |
displayAt:nil |
|
5371 |
centered:nil |
|
5372 |
action:nil |
|
5373 |
initialAnswer:initial |
|
5374 |
okLabel:okLabel |
|
5375 |
cancelLabel:nil |
|
5376 |
title:nil |
|
5377 |
onCancel:nil |
|
3532 | 5378 |
list:list |
3181 | 5379 |
initialSelection:nil |
3182 | 5380 |
entryCompletionBlock:DoWhatIMeanSupport classNameEntryCompletionBlock |
3181 | 5381 |
|
5382 |
" |
|
5383 |
Dialog |
|
3532 | 5384 |
requestClassName:'Enter a class:' |
5385 |
list:(Array with:Array with:String with:Point) |
|
5386 |
okLabel:'OK' |
|
5387 |
initialAnswer:'Arr' |
|
5388 |
" |
|
5389 |
||
5390 |
"Created: / 12-01-2008 / 22:58:01 / cg" |
|
5391 |
! |
|
5392 |
||
5393 |
requestClassName:aString okLabel:okLabel initialAnswer:initial |
|
5394 |
"launch a Dialog, which allows user to enter a class name. |
|
5395 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
5396 |
The entryField does classNameCompletion on TAB." |
|
5397 |
||
5398 |
^ self requestClassName:aString list:nil okLabel:okLabel initialAnswer:initial |
|
5399 |
||
5400 |
" |
|
5401 |
Dialog |
|
3181 | 5402 |
requestClassName:'enter a class:' |
5403 |
okLabel:'OK' |
|
5404 |
initialAnswer:'Arr' |
|
5405 |
" |
|
3532 | 5406 |
|
5407 |
"Modified: / 12-01-2008 / 22:58:13 / cg" |
|
3181 | 5408 |
! |
5409 |
||
3538 | 5410 |
requestName:title fromList:nameList title:boxTitle initialAnswer:initialTextOrNil |
5411 |
"Ask for a name from a list (used for namespaces and sharedPools)" |
|
5412 |
||
5413 |
|newName box| |
|
5414 |
||
5415 |
box := ListSelectionBox new. |
|
5416 |
box title:title. |
|
5417 |
box list:nameList. |
|
5418 |
box okAction:[:sel | newName := sel]. |
|
5419 |
box initialText:initialTextOrNil. |
|
5420 |
boxTitle notNil ifTrue:[ box label:boxTitle ]. |
|
5421 |
box showAtPointer. |
|
5422 |
||
5423 |
newName notNil ifTrue:[ |
|
5424 |
newName := newName withoutSeparators. |
|
5425 |
]. |
|
5426 |
^ newName |
|
5427 |
||
5428 |
" |
|
5429 |
Dialog |
|
5430 |
requestName:'Select a Name' |
|
5431 |
fromList:#('foo' 'bar' 'baz') |
|
5432 |
title:'blabla' |
|
5433 |
initialAnswer:nil |
|
5434 |
" |
|
5435 |
! |
|
5436 |
||
2486 | 5437 |
requestNameSpace:title initialAnswer:initialTextOrNil |
5438 |
"Ask for a namespaces name" |
|
5439 |
||
2996 | 5440 |
^ self |
5441 |
requestNameSpace:title |
|
3538 | 5442 |
title:title |
2996 | 5443 |
initialAnswer:initialTextOrNil |
5444 |
||
5445 |
" |
|
3538 | 5446 |
Dialog |
5447 |
requestNameSpace:'Select a NameSpace' |
|
5448 |
initialAnswer:nil |
|
2996 | 5449 |
" |
5450 |
! |
|
5451 |
||
5452 |
requestNameSpace:title title:boxTitle initialAnswer:initialTextOrNil |
|
5453 |
"Ask for a namespaces name" |
|
5454 |
||
3538 | 5455 |
|allNameSpaces| |
2486 | 5456 |
|
3282 | 5457 |
allNameSpaces := NameSpace allNameSpaces collect:[:each | each name]. |
2486 | 5458 |
allNameSpaces := allNameSpaces asOrderedCollection sort. |
5459 |
||
3538 | 5460 |
^ self |
5461 |
requestName:title |
|
5462 |
fromList:allNameSpaces |
|
5463 |
title:boxTitle |
|
5464 |
initialAnswer:initialTextOrNil |
|
5465 |
||
5466 |
" |
|
5467 |
Dialog |
|
5468 |
requestNameSpace:'Select a NameSpace' |
|
5469 |
initialAnswer:nil |
|
2486 | 5470 |
" |
5471 |
! |
|
5472 |
||
3736 | 5473 |
requestProject:title from:listOfProjects initialAnswer:initialTextOrNil suggestions:suggestions |
3384 | 5474 |
"Ask for a project (package-id)" |
5475 |
||
3736 | 5476 |
|newProject box| |
3384 | 5477 |
|
5478 |
box := ListSelectionBox new. |
|
5479 |
box useComboBoxWithList:suggestions. |
|
5480 |
box title:title. |
|
3736 | 5481 |
box list:listOfProjects. |
3384 | 5482 |
box okAction:[:sel | newProject := sel]. |
5483 |
box initialText:initialTextOrNil. |
|
5484 |
box entryCompletionBlock:(DoWhatIMeanSupport packageNameEntryCompletionBlock). |
|
5485 |
box label:'Enter Project'. |
|
5486 |
box showAtPointer. |
|
5487 |
||
5488 |
newProject notNil ifTrue:[ |
|
5489 |
newProject := newProject withoutSeparators asSymbol. |
|
5490 |
]. |
|
5491 |
^ newProject |
|
5492 |
||
5493 |
" |
|
5494 |
Dialog |
|
5495 |
requestProject:'enter a project' |
|
5496 |
initialAnswer:'stx:libbasic' |
|
5497 |
suggestions:#('foo' 'bar' 'baz') |
|
5498 |
" |
|
5499 |
||
5500 |
"Created: / 07-09-2006 / 11:40:17 / cg" |
|
5501 |
! |
|
5502 |
||
3736 | 5503 |
requestProject:title initialAnswer:initialTextOrNil suggestions:suggestions |
5504 |
"Ask for a project (package-id)" |
|
5505 |
||
5506 |
|allProjects| |
|
5507 |
||
5508 |
allProjects := Smalltalk allProjectIDs. |
|
5509 |
^ self |
|
5510 |
requestProject:title |
|
5511 |
from:allProjects |
|
5512 |
initialAnswer:initialTextOrNil |
|
5513 |
suggestions:suggestions |
|
5514 |
! |
|
5515 |
||
2486 | 5516 |
requestSelector:aString initialAnswer:initial |
5517 |
"launch a Dialog, which allows user to enter a method selector. |
|
5518 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
5519 |
The entryField does selectorCompletion on TAB." |
|
5520 |
||
5521 |
^ self requestSelector:aString okLabel:nil initialAnswer:initial |
|
5522 |
||
5523 |
" |
|
5524 |
Dialog |
|
5525 |
requestSelector:'enter a selector:' |
|
5526 |
initialAnswer:'at:p' |
|
5527 |
" |
|
5528 |
! |
|
5529 |
||
5530 |
requestSelector:aString okLabel:okLabel initialAnswer:initial |
|
5531 |
"launch a Dialog, which allows user to enter a method selector. |
|
5532 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
5533 |
The entryField does selectorCompletion on TAB." |
|
5534 |
||
5535 |
^ self |
|
5536 |
request:aString |
|
5537 |
displayAt:nil |
|
5538 |
centered:nil |
|
5539 |
action:nil |
|
5540 |
initialAnswer:initial |
|
5541 |
okLabel:okLabel |
|
5542 |
cancelLabel:nil |
|
5543 |
title:nil |
|
5544 |
onCancel:nil |
|
5545 |
list:nil |
|
5546 |
initialSelection:nil |
|
2629 | 5547 |
entryCompletionBlock:[:s :field| |
5548 |
|completion| |
|
2486 | 5549 |
|
5550 |
completion := Smalltalk selectorCompletion:s. |
|
3881 | 5551 |
completion second size > 1 ifTrue:[ |
5552 |
UserPreferences current beepInEditor ifTrue:[ |
|
5553 |
Screen current beep |
|
5554 |
]. |
|
5555 |
]. |
|
2629 | 5556 |
field contents:(completion first) |
2486 | 5557 |
] |
5558 |
||
5559 |
" |
|
5560 |
Dialog |
|
5561 |
requestSelector:'enter a selector:' |
|
5562 |
initialAnswer:'at:p' |
|
5563 |
" |
|
3538 | 5564 |
! |
5565 |
||
5566 |
requestSharedPool:title title:boxTitle initialAnswer:initialTextOrNil |
|
5567 |
"Ask for a sharedPools name" |
|
5568 |
||
5569 |
|allPools| |
|
5570 |
||
5571 |
allPools := SharedPool allSubclasses collect:[:each | each name]. |
|
5572 |
allPools := allPools asOrderedCollection sort. |
|
5573 |
||
5574 |
^ self |
|
5575 |
requestName:title |
|
5576 |
fromList:allPools |
|
5577 |
title:boxTitle |
|
5578 |
initialAnswer:initialTextOrNil |
|
5579 |
||
5580 |
" |
|
5581 |
Dialog |
|
5582 |
requestSharedPool:'Select a SharedPool' |
|
5583 |
title:nil |
|
5584 |
initialAnswer:nil |
|
5585 |
" |
|
2486 | 5586 |
! ! |
5587 |
||
197 | 5588 |
!DialogBox methodsFor:'accessing-behavior'! |
5589 |
||
5590 |
abortAction:aBlock |
|
5591 |
"define the action to be performed when abort is pressed" |
|
5592 |
||
5593 |
abortAction := aBlock |
|
125 | 5594 |
! |
5595 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5596 |
acceptCheck:aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5597 |
"if nonNil, the acceptCheck-block is evaluated when the dialog is |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5598 |
accepted (ok-button or Return-key). If it returns true, the box is closed, |
2106 | 5599 |
otherwise not. Of course, you may also use a valueHolder instead of a block |
5600 |
to provide the check value." |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5601 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5602 |
acceptCheck := aBlock |
2106 | 5603 |
|
5604 |
"Modified: / 25.1.2000 / 20:56:04 / cg" |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5605 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5606 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5607 |
acceptOnLeave:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5608 |
"define the behavior when the last input field is left via cursor keys. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5609 |
The default is to accept & close the dialog (i.e. true)." |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5610 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5611 |
acceptOnLeave := aBoolean. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5612 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5613 |
"Modified: 19.4.1996 / 17:05:12 / cg" |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5614 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5615 |
|
197 | 5616 |
acceptReturnAsOK:aBoolean |
5617 |
"turn on/off interpretation of return-key as ok. |
|
5618 |
Default is on" |
|
5619 |
||
5620 |
acceptReturnAsOK := aBoolean. |
|
5621 |
okButton notNil ifTrue:[ |
|
5622 |
okButton isReturnButton:aBoolean. |
|
5623 |
] |
|
5624 |
! |
|
5625 |
||
5626 |
action:aBlock |
|
5627 |
"set the action to be performed when user presses ok-button; |
|
5628 |
aBlock must be nil or a block. This method simply |
|
5629 |
reuses okAction: and has been added for a consistent action-setting |
|
5630 |
protocol." |
|
76 | 5631 |
|
197 | 5632 |
self okAction:aBlock |
5633 |
! |
|
5634 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5635 |
focusOnField:anInputField |
1646 | 5636 |
"arrange for the argument to get the focus (initially)" |
5637 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5638 |
inputFieldGroup makeActive:anInputField |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5639 |
|
1646 | 5640 |
"Modified: / 13.8.1998 / 21:23:17 / cg" |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5641 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5642 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5643 |
focusToOKOnLeave:aBoolean |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5644 |
"define the behavior when the last input field is left via a return |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5645 |
or cursor key. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5646 |
The default is to shift the focus to the OK button (i.e. true). |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5647 |
If turned off, the OK is immediately performed, i.e. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5648 |
the dialog is accepted & closed." |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5649 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5650 |
focusToOKOnLeave := aBoolean. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5651 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5652 |
"Modified: 19.4.1996 / 17:05:12 / cg" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5653 |
"Created: 19.4.1996 / 17:13:36 / cg" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5654 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
5655 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5656 |
hideOnAccept:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5657 |
"control if the dialog should close when accepted. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5658 |
The default is true" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5659 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5660 |
hideOnAccept := aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5661 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5662 |
|
593 | 5663 |
makeTabable:aComponentOrSubcomponent |
5664 |
"add a component (usually a subcomponent, of which the dialog |
|
5665 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
5666 |
stepped through via FocusNext/FocusPrevious). |
|
5667 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
5668 |
||
3467 | 5669 |
aComponentOrSubcomponent canTab:true. |
5670 |
||
5671 |
"/ tabableElements isNil ifTrue:[ |
|
5672 |
"/ tabableElements := OrderedCollection new |
|
5673 |
"/ ]. |
|
5674 |
"/ (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
|
5675 |
"/ tabableElements add:aComponentOrSubcomponent. |
|
5676 |
"/ ]. |
|
5677 |
||
5678 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
5679 |
self addToInputFieldGroup:aComponentOrSubcomponent |
|
593 | 5680 |
]. |
5681 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
5682 |
"Modified: 31.5.1996 / 21:22:13 / cg" |
593 | 5683 |
! |
5684 |
||
1843 | 5685 |
makeTabable:aComponentOrSubcomponent after:anotherComponent |
5686 |
"add a component (usually a subcomponent, of which the dialog |
|
5687 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
5688 |
stepped through via FocusNext/FocusPrevious). |
|
5689 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
5690 |
||
3467 | 5691 |
<resource: #obsolete> |
5692 |
self obsoleteMethodWarning. "/ focusSequence has been eliminated |
|
5693 |
||
5694 |
aComponentOrSubcomponent canTab:true. |
|
5695 |
||
5696 |
"/ tabableElements isNil ifTrue:[ |
|
5697 |
"/ tabableElements := OrderedCollection new |
|
5698 |
"/ ]. |
|
5699 |
"/ tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil. |
|
5700 |
"/ |
|
5701 |
"/ anotherComponent isNil ifTrue:[ |
|
5702 |
"/ tabableElements addLast:aComponentOrSubcomponent |
|
5703 |
"/ ] ifFalse:[ |
|
5704 |
"/ tabableElements add:aComponentOrSubcomponent after:anotherComponent. |
|
5705 |
"/ ]. |
|
5706 |
"/ |
|
1843 | 5707 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
5708 |
self addToInputFieldGroup:aComponentOrSubcomponent after:anotherComponent |
|
5709 |
]. |
|
5710 |
||
5711 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
|
5712 |
! |
|
5713 |
||
1355 | 5714 |
makeUntabable:aComponentOrSubcomponent |
3467 | 5715 |
aComponentOrSubcomponent canTab:false. |
5716 |
||
5717 |
"/ (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
|
5718 |
"/ tabableElements removeIdentical:aComponentOrSubcomponent. |
|
5719 |
"/ ]. |
|
5720 |
||
5721 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
5722 |
self removeFromInputFieldGroup:aComponentOrSubcomponent |
|
1355 | 5723 |
]. |
5724 |
||
5725 |
"Modified: 18.10.1997 / 02:50:05 / cg" |
|
593 | 5726 |
! |
5727 |
||
2361 | 5728 |
noAction:aBlock |
5729 |
"define the action to be performed when 'no' is pressed" |
|
5730 |
||
5731 |
abortAction := aBlock |
|
5732 |
||
5733 |
"Modified: 16.1.1997 / 11:29:18 / cg" |
|
5734 |
! |
|
5735 |
||
197 | 5736 |
okAction:aBlock |
5737 |
"define the action to be performed when ok is pressed" |
|
133 | 5738 |
|
197 | 5739 |
okAction := aBlock |
2361 | 5740 |
! |
5741 |
||
5742 |
title:aString yesAction:yesBlock noAction:noBlock |
|
5743 |
"define title and actions" |
|
5744 |
||
5745 |
self title:aString. |
|
5746 |
okAction := yesBlock. |
|
5747 |
abortAction := noBlock |
|
5748 |
! |
|
5749 |
||
5750 |
yesAction:aBlock |
|
5751 |
"define the action to be performed when 'yes' is pressed" |
|
5752 |
||
5753 |
okAction := aBlock |
|
5754 |
||
5755 |
"Modified: 16.1.1997 / 11:31:21 / cg" |
|
5756 |
! |
|
5757 |
||
5758 |
yesAction:yesBlock noAction:noBlock |
|
5759 |
"define both actions" |
|
5760 |
||
5761 |
okAction := yesBlock. |
|
5762 |
abortAction := noBlock |
|
197 | 5763 |
! ! |
5764 |
||
5765 |
!DialogBox methodsFor:'accessing-components'! |
|
5766 |
||
5767 |
abortButton |
|
5768 |
"return the abortButton - this access is provided to allow |
|
5769 |
setting the buttons look (for example: colors or font)" |
|
5770 |
||
5771 |
^ abortButton |
|
76 | 5772 |
! |
5773 |
||
2327 | 5774 |
buttonPanel |
5775 |
"return the buttonPanel - this access is provided to allow |
|
5776 |
setting the buttons look (for example: colors or font)" |
|
5777 |
||
5778 |
^ buttonPanel |
|
5779 |
! |
|
5780 |
||
2147
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5781 |
cancelButton |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5782 |
"same as #abortButton; |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5783 |
return the abortButton - this access is provided to allow |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5784 |
setting the buttons look (for example: colors or font)" |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5785 |
|
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5786 |
^ self abortButton |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5787 |
! |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
5788 |
|
2361 | 5789 |
noButton |
5790 |
"return the no-button" |
|
5791 |
||
5792 |
^ abortButton |
|
5793 |
! |
|
5794 |
||
197 | 5795 |
okButton |
5796 |
"return the okButton - this access is provided to allow |
|
5797 |
setting the buttons look (for example: colors or font)" |
|
76 | 5798 |
|
197 | 5799 |
^ okButton |
2361 | 5800 |
! |
5801 |
||
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5802 |
verticalPanel |
3944
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
5803 |
"if there is none yet, create and add a vertical panel. |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
5804 |
This can be used to additional components in an aboutToOpen hook callback." |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5805 |
|
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5806 |
|savedY| |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5807 |
|
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5808 |
verticalPanel isNil ifTrue:[ |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5809 |
savedY := yPosition. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5810 |
self addComponent:(verticalPanel := VerticalPanelView new). |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5811 |
verticalPanel horizontalLayout:#fit. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5812 |
verticalPanel verticalLayout:#top. |
3944
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
5813 |
verticalPanel height:25. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5814 |
yPosition := savedY. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5815 |
]. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5816 |
^ verticalPanel |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5817 |
! |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
5818 |
|
2361 | 5819 |
yesButton |
5820 |
"return the 'yes'-button" |
|
5821 |
||
5822 |
^ okButton |
|
5823 |
||
5824 |
"Modified: 16.1.1997 / 11:31:27 / cg" |
|
197 | 5825 |
! ! |
155 | 5826 |
|
197 | 5827 |
!DialogBox methodsFor:'accessing-elements'! |
5828 |
||
5829 |
componentAt:name |
|
680 | 5830 |
"retrieve a component by name - to access it, it must have been |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5831 |
named previously with #name:as:" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5832 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5833 |
namedComponents isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5834 |
^ namedComponents at:name ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5835 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5836 |
"Modified: 16.1.1997 / 11:40:50 / cg" |
76 | 5837 |
! |
5838 |
||
197 | 5839 |
name:element as:name |
680 | 5840 |
"assign a name to a component. This can be done during construction, |
5841 |
to allow later access to the components (i.e. without a need to |
|
5842 |
remember them in some instVars)" |
|
5843 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5844 |
namedComponents isNil ifTrue:[ |
1401 | 5845 |
namedComponents := Dictionary new. |
197 | 5846 |
]. |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5847 |
namedComponents at:name put:element |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5848 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5849 |
"Modified: 16.1.1997 / 11:41:03 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5850 |
! ! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5851 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5852 |
!DialogBox methodsFor:'accessing-look'! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5853 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5854 |
abortText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5855 |
"define the label in the abort-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5856 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5857 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5858 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5859 |
aString ~= abortButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5860 |
oldSize := abortButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5861 |
abortButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5862 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5863 |
abortButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5864 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5865 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5866 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5867 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5868 |
|
1702 | 5869 |
hideButtons |
5870 |
"hides the buttonPanel (i.e. the ok and cancel buttons if any)" |
|
5871 |
||
5872 |
buttonPanel notNil ifTrue:[buttonPanel beInvisible] |
|
5873 |
! |
|
5874 |
||
2361 | 5875 |
noLabel:aString |
5876 |
"define the label of the 'no'-button. |
|
5877 |
And alias for #noText: - for backward compatibility" |
|
5878 |
||
5879 |
self noText:aString. |
|
5880 |
||
5881 |
"Created: 13.12.1995 / 16:21:57 / cg" |
|
5882 |
"Modified: 16.1.1997 / 11:30:25 / cg" |
|
5883 |
! |
|
5884 |
||
5885 |
noText:aString |
|
5886 |
"define the label of the no-button. |
|
5887 |
If not set, it defaults to the resource-string for 'no'." |
|
5888 |
||
5889 |
aString ~= abortButton label ifTrue:[ |
|
5890 |
abortButton label:aString. |
|
5891 |
abortButton resize. |
|
5892 |
shown ifTrue:[self resize] |
|
5893 |
] |
|
5894 |
! |
|
5895 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5896 |
okText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5897 |
"define the text in the ok-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5898 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5899 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5900 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5901 |
aString ~= okButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5902 |
oldSize := okButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5903 |
okButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5904 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5905 |
okButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5906 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5907 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5908 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5909 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5910 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5911 |
okText:okString abortText:abortString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5912 |
"set both texts displayed in the buttons" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5913 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5914 |
(abortString ~= abortButton label |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5915 |
or:[okString ~= okButton label]) ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5916 |
okButton label:okString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5917 |
abortButton label:abortString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5918 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5919 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5920 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
5921 |
] |
2361 | 5922 |
! |
5923 |
||
5924 |
okText:yesString noText:noString |
|
5925 |
"define the labels of both buttons. |
|
5926 |
Alias for yesText:noText: for backward compatibility." |
|
5927 |
||
5928 |
^ self yesText:yesString noText:noString |
|
5929 |
||
5930 |
"Modified: 16.1.1997 / 11:30:58 / cg" |
|
5931 |
! |
|
5932 |
||
5933 |
title:aString yesText:yesString noText:noString |
|
5934 |
"define title and button labels" |
|
5935 |
||
5936 |
self title:aString. |
|
5937 |
self yesText:yesString noText:noString |
|
5938 |
! |
|
5939 |
||
5940 |
yesLabel:aString |
|
5941 |
"define the label of the 'yes'-button. |
|
5942 |
An alias for #yesText: for backward compatibility." |
|
5943 |
||
5944 |
self yesText:aString. |
|
5945 |
||
5946 |
"Created: 13.12.1995 / 16:22:05 / cg" |
|
5947 |
"Modified: 16.1.1997 / 11:31:58 / cg" |
|
5948 |
! |
|
5949 |
||
5950 |
yesText:aString |
|
5951 |
"define the label of the 'yes'-button" |
|
5952 |
||
5953 |
self okText:aString |
|
5954 |
||
5955 |
"Modified: 16.1.1997 / 11:31:39 / cg" |
|
5956 |
! |
|
5957 |
||
5958 |
yesText:yesString noText:noString |
|
5959 |
"define the labels of both buttons" |
|
5960 |
||
5961 |
((yesString ~= okButton label) or:[noString ~= abortButton label]) ifTrue:[ |
|
5962 |
okButton label:yesString. |
|
5963 |
abortButton label:noString. |
|
5964 |
okButton resize. |
|
5965 |
abortButton resize. |
|
5966 |
shown ifTrue:[self resize] |
|
5967 |
] |
|
5968 |
||
5969 |
"Modified: 21.2.1996 / 00:58:38 / cg" |
|
197 | 5970 |
! ! |
5971 |
||
5972 |
!DialogBox methodsFor:'accessing-models'! |
|
76 | 5973 |
|
197 | 5974 |
accept |
5975 |
"return the valueHolder holding true when the box |
|
5976 |
is accepted, false if closed via the windowManager or |
|
5977 |
the cancel button. |
|
5978 |
This is confusing: this method was originally called #acceptValue, |
|
5979 |
but renamed for compatibility with ST-80. |
|
5980 |
This looks like a bad name to me, since in most other situations, #accept |
|
5981 |
is used to force an accept, not to return some valueHolder ...)." |
|
5982 |
||
5983 |
^ acceptValue |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5984 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5985 |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5986 |
acceptChannel |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5987 |
"same as #accept: return the valueHolder which is set to true when the box |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5988 |
is accepted" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5989 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5990 |
^ acceptValue |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5991 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5992 |
"Created: / 18.8.2000 / 21:44:24 / cg" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5993 |
! |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5994 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5995 |
acceptChannel:aValueHolder |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5996 |
"set the valueHolder which is set to true when the box |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5997 |
is accepted" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5998 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
5999 |
acceptValue := aValueHolder |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6000 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6001 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6002 |
aspectAt:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6003 |
"return the dataModel for some aspect, nil if no such dataModel was defined; |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6004 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6005 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6006 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6007 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6008 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6009 |
bindings isNil ifTrue:[bindings := IdentityDictionary new]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6010 |
bindings at:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6011 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6012 |
"Created: 16.1.1997 / 11:38:46 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6013 |
"Modified: 16.1.1997 / 11:41:28 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6014 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6015 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6016 |
aspectFor:anAspectSymbol |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6017 |
"return the dataModel for some aspect, nil if no such dataModel was defined; |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6018 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6019 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6020 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6021 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6022 |
|
3404
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
6023 |
"/ subclasses may redefine some aspects... |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
6024 |
(self respondsTo:anAspectSymbol) ifTrue:[ |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
6025 |
^ self perform:anAspectSymbol |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
6026 |
]. |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
6027 |
|
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6028 |
bindings isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6029 |
^ bindings at:anAspectSymbol ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
6030 |
|
3404
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
6031 |
"Modified: / 11-10-2006 / 21:48:14 / cg" |
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6032 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6033 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6034 |
cancel |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6035 |
^ BlockValue forLogicalNot:(acceptValue) |
76 | 6036 |
! ! |
6037 |
||
120 | 6038 |
!DialogBox methodsFor:'construction-adding'! |
6039 |
||
593 | 6040 |
addComponent:aComponent |
6041 |
"add any component with its preferred height and full width. |
|
6042 |
Returns the component." |
|
6043 |
||
6044 |
^ self addComponent:aComponent indent:nil tabable:false |
|
6045 |
||
6046 |
"Modified: 9.2.1996 / 22:22:41 / cg" |
|
6047 |
! |
|
6048 |
||
6049 |
addComponent:aComponent indent:indent |
|
6050 |
"add any component with its preferred height and full width. |
|
6051 |
The indent is temporarily changed to indent. |
|
6052 |
Returns the component." |
|
6053 |
||
6054 |
^ self addComponent:aComponent indent:indent tabable:false |
|
6055 |
||
6056 |
"Modified: 9.2.1996 / 22:22:44 / cg" |
|
6057 |
! |
|
6058 |
||
6059 |
addComponent:aComponent indent:indent tabable:tabable |
|
6060 |
"add any component with its preferred height and full width. |
|
6061 |
The indent is temporarily changed to indent. |
|
6062 |
Returns the component." |
|
6063 |
||
6064 |
|oldLeft oldRight result| |
|
6065 |
||
6066 |
oldLeft := leftIndent. |
|
6067 |
oldRight := rightIndent. |
|
6068 |
indent notNil ifTrue:[ |
|
1401 | 6069 |
leftIndent := rightIndent := indent. |
593 | 6070 |
]. |
6071 |
result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent. |
|
6072 |
leftIndent := oldLeft. |
|
6073 |
rightIndent := oldRight. |
|
6074 |
^ result |
|
6075 |
||
6076 |
"Modified: 9.2.1996 / 22:22:50 / cg" |
|
6077 |
! |
|
6078 |
||
6079 |
addComponent:aComponent indent:indent withExtent:ext |
|
6080 |
"add any component with some given extent. |
|
6081 |
Returns the component." |
|
6082 |
||
6083 |
|fullSize lI rI| |
|
6084 |
||
6085 |
indent isNil ifTrue:[ |
|
2801 | 6086 |
lI := leftIndent. |
6087 |
rI := rightIndent. |
|
593 | 6088 |
] ifFalse:[ |
2801 | 6089 |
lI := rI := indent |
593 | 6090 |
]. |
6091 |
||
6092 |
self basicAddComponent:aComponent. |
|
6093 |
fullSize := ext + (lI + rI @ 0). |
|
6094 |
aComponent extent:fullSize. |
|
2801 | 6095 |
aComponent origin:(0.0 @ yPosition); |
6096 |
leftInset:lI; |
|
6097 |
rightInset:rI. |
|
593 | 6098 |
yPosition := yPosition + aComponent height + ViewSpacing. |
6099 |
width := fullSize x max:width. |
|
6100 |
needResize := true. |
|
6101 |
^ aComponent |
|
6102 |
||
6103 |
"Modified: 9.2.1996 / 22:22:54 / cg" |
|
6104 |
! |
|
6105 |
||
6106 |
addComponent:aComponent indent:indent withHeight:height |
|
6107 |
"add any component with some given height and full width. |
|
6108 |
Returns the component." |
|
6109 |
||
6110 |
|lI rI| |
|
6111 |
||
6112 |
indent isNil ifTrue:[ |
|
2801 | 6113 |
lI := leftIndent. |
6114 |
rI := rightIndent. |
|
593 | 6115 |
] ifFalse:[ |
2801 | 6116 |
lI := rI := indent |
593 | 6117 |
]. |
6118 |
self basicAddComponent:aComponent. |
|
3283 | 6119 |
aComponent |
6120 |
height:height; |
|
6121 |
origin:0.0@yPosition; |
|
6122 |
width:1.0; |
|
6123 |
leftInset:lI; |
|
6124 |
rightInset:rI. |
|
2801 | 6125 |
yPosition := yPosition + height + ViewSpacing. |
593 | 6126 |
^ aComponent |
6127 |
||
6128 |
"Modified: 9.2.1996 / 22:22:58 / cg" |
|
6129 |
! |
|
6130 |
||
6131 |
addComponent:aComponent tabable:tabable |
|
6132 |
"add any component with its preferred height and full width. |
|
6133 |
Returns the component." |
|
6134 |
||
6135 |
^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent |
|
6136 |
||
6137 |
"Modified: 9.2.1996 / 22:23:04 / cg" |
|
6138 |
! |
|
6139 |
||
6140 |
addComponent:aComponent tabable:tabable tabbedComponent:subComponent |
|
6141 |
"add any component with its preferred height and full width. |
|
6142 |
Returns the component." |
|
6143 |
||
6144 |
tabable ifTrue:[ |
|
3467 | 6145 |
aComponent canTab:true. |
6146 |
||
6147 |
"/ tabableElements isNil ifTrue:[ |
|
6148 |
"/ tabableElements := OrderedCollection new |
|
6149 |
"/ ]. |
|
6150 |
"/ tabableElements add:subComponent |
|
593 | 6151 |
]. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
6152 |
^ self addComponent:aComponent withHeight:(aComponent preferredHeight). |
593 | 6153 |
|
6154 |
"Modified: 9.2.1996 / 22:23:07 / cg" |
|
6155 |
! |
|
6156 |
||
6157 |
addComponent:aComponent withExtent:ext |
|
6158 |
"add any component with some given extent. |
|
6159 |
Returns the component." |
|
6160 |
||
6161 |
^ self addComponent:aComponent indent:nil withExtent:ext |
|
6162 |
||
6163 |
"Modified: 9.2.1996 / 22:23:11 / cg" |
|
6164 |
! |
|
6165 |
||
6166 |
addComponent:aComponent withHeight:height |
|
6167 |
"add any component with some given height and full width. |
|
6168 |
Returns the component." |
|
6169 |
||
6170 |
^ self addComponent:aComponent indent:nil withHeight:height |
|
6171 |
||
6172 |
"Modified: 9.2.1996 / 22:23:15 / cg" |
|
6173 |
! |
|
6174 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6175 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6176 |
"add a label and some view side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6177 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6178 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6179 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6180 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6181 |
|
795 | 6182 |
^ self |
1401 | 6183 |
addLabelledField:aView |
6184 |
label:labelString |
|
6185 |
adjust:labelAdjust |
|
6186 |
tabable:tabable |
|
6187 |
from:leftX to:rightX separateAtX:relativeX |
|
6188 |
nameAs:nil |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6189 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6190 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6191 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6192 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6193 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6194 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6195 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6196 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6197 |
field := dialog |
1401 | 6198 |
addLabelledField:(EditField on:model) label:'input here:' |
6199 |
adjust:#left |
|
6200 |
tabable:true |
|
6201 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6202 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6203 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6204 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6205 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6206 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6207 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6208 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6209 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6210 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6211 |
model := SelectionInList new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6212 |
model list:#('foo' 'bar' 'baz'). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6213 |
model selectionIndex:2. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6214 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6215 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6216 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6217 |
field := dialog |
1401 | 6218 |
addLabelledField:(PopUpList on:model) label:'select here:' |
6219 |
adjust:#left |
|
6220 |
tabable:true |
|
6221 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6222 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6223 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6224 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6225 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6226 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6227 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6228 |
"Created: 3.6.1996 / 11:03:24 / cg" |
795 | 6229 |
"Modified: 17.7.1996 / 15:04:07 / cg" |
6230 |
! |
|
6231 |
||
6232 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable from:leftX to:rightX separateAtX:relativeX nameAs:aName |
|
6233 |
"add a label and some view side-by-side. |
|
6234 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
6235 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
6236 |
The inputField gets model as its model. |
|
6237 |
Return the inputField." |
|
6238 |
||
6239 |
|y lbl max relW| |
|
6240 |
||
6241 |
y := self yPosition. |
|
6242 |
lbl := Label label:labelString. |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6243 |
max := lbl preferredHeight max:(aView preferredHeight). |
795 | 6244 |
|
6245 |
relW := rightX - leftX. |
|
6246 |
||
6247 |
self addComponent:lbl indent:leftIndent withHeight:max. |
|
6248 |
lbl rightInset:0. |
|
6249 |
lbl |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6250 |
width:(relW*relativeX); |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6251 |
left:leftX; |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6252 |
adjust:labelAdjust; borderWidth:0. |
795 | 6253 |
|
6254 |
self yPosition:y. |
|
6255 |
self addComponent:aView tabable:tabable. |
|
6256 |
aView |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6257 |
leftInset:ViewSpacing; |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6258 |
rightInset:ViewSpacing. |
795 | 6259 |
|
6260 |
aView |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6261 |
width:relW*(1.0 - relativeX); |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6262 |
left:leftX+(relW*relativeX). |
795 | 6263 |
|
6264 |
aView isInputField ifTrue:[ |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6265 |
self addToInputFieldGroup:aView |
795 | 6266 |
]. |
6267 |
||
6268 |
aName notNil ifTrue:[ |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6269 |
self name:lbl as:(aName , '.label'). |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6270 |
self name:aView as:aName |
795 | 6271 |
]. |
6272 |
^ aView |
|
6273 |
||
6274 |
" |
|
6275 |
|dialog model field| |
|
6276 |
||
6277 |
model := '' asValue. |
|
6278 |
||
6279 |
dialog := DialogBox new. |
|
6280 |
||
6281 |
field := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6282 |
addLabelledField:(EditField on:model) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6283 |
label:'input here:' |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6284 |
adjust:#left |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6285 |
tabable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6286 |
separateAtX:0.3. |
807 | 6287 |
|
6288 |
dialog addAbortButton; addOkButton. |
|
6289 |
dialog open. |
|
6290 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
6291 |
" |
|
6292 |
||
6293 |
" |
|
6294 |
|dialog model field| |
|
6295 |
||
6296 |
model := '' asValue. |
|
6297 |
||
6298 |
dialog := DialogBox new. |
|
6299 |
||
6300 |
field := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6301 |
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz')) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6302 |
label:'select foo:' |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6303 |
adjust:#left |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6304 |
tabable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6305 |
separateAtX:0.3. |
795 | 6306 |
|
6307 |
dialog addAbortButton; addOkButton. |
|
6308 |
dialog open. |
|
6309 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
6310 |
" |
|
6311 |
||
6312 |
" |
|
6313 |
|dialog model field| |
|
6314 |
||
6315 |
model := SelectionInList new. |
|
6316 |
model list:#('foo' 'bar' 'baz'). |
|
6317 |
model selectionIndex:2. |
|
6318 |
||
6319 |
dialog := DialogBox new. |
|
6320 |
||
6321 |
field := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6322 |
addLabelledField:(PopUpList on:model) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6323 |
label:'select here:' |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6324 |
adjust:#left |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6325 |
tabable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
6326 |
separateAtX:0.3. |
795 | 6327 |
|
6328 |
dialog addAbortButton; addOkButton. |
|
6329 |
dialog open. |
|
6330 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
6331 |
" |
|
6332 |
||
6333 |
"Created: 17.7.1996 / 15:03:32 / cg" |
|
807 | 6334 |
"Modified: 26.7.1996 / 18:11:12 / cg" |
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6335 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6336 |
|
593 | 6337 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX |
6338 |
"add a label and some view side-by-side. |
|
6339 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
6340 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
6341 |
The inputField gets model as its model. |
|
6342 |
Return the inputField." |
|
6343 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6344 |
^ self |
1401 | 6345 |
addLabelledField:aView |
6346 |
label:labelString |
|
6347 |
adjust:labelAdjust |
|
6348 |
tabable:tabable |
|
6349 |
from:0.0 to:1.0 |
|
6350 |
separateAtX:relativeX |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6351 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6352 |
"/ |y lbl max| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6353 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6354 |
"/ y := self yPosition. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6355 |
"/ lbl := Label label:labelString. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6356 |
"/ max := lbl preferredExtent y max:(aView preferredExtent y). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6357 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6358 |
"/ self addComponent:lbl indent:leftIndent withHeight:max. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6359 |
"/ lbl rightInset:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6360 |
"/ lbl width:relativeX; adjust:labelAdjust; borderWidth:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6361 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6362 |
"/ self yPosition:y. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6363 |
"/ self addComponent:aView tabable:tabable. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6364 |
"/ aView leftInset:ViewSpacing; rightInset:ViewSpacing. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6365 |
"/ aView width:(1.0 - relativeX); left:relativeX. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6366 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6367 |
"/ aView isInputField ifTrue:[ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6368 |
"/ self addToInputFieldGroup:aView |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6369 |
"/ ]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6370 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6371 |
"/ ^ aView |
593 | 6372 |
|
6373 |
" |
|
6374 |
|dialog model field| |
|
6375 |
||
6376 |
model := '' asValue. |
|
6377 |
||
6378 |
dialog := DialogBox new. |
|
6379 |
||
6380 |
field := dialog |
|
1401 | 6381 |
addLabelledField:(EditField on:model) label:'input here:' |
6382 |
adjust:#left |
|
6383 |
tabable:true |
|
6384 |
separateAtX:0.3. |
|
593 | 6385 |
|
6386 |
dialog addAbortButton; addOkButton. |
|
6387 |
dialog open. |
|
655 | 6388 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 6389 |
" |
6390 |
||
6391 |
" |
|
6392 |
|dialog model field| |
|
6393 |
||
6394 |
model := SelectionInList new. |
|
6395 |
model list:#('foo' 'bar' 'baz'). |
|
6396 |
model selectionIndex:2. |
|
6397 |
||
6398 |
dialog := DialogBox new. |
|
6399 |
||
6400 |
field := dialog |
|
1401 | 6401 |
addLabelledField:(PopUpList on:model) label:'select here:' |
6402 |
adjust:#left |
|
6403 |
tabable:true |
|
6404 |
separateAtX:0.3. |
|
593 | 6405 |
|
6406 |
dialog addAbortButton; addOkButton. |
|
6407 |
dialog open. |
|
655 | 6408 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 6409 |
" |
6410 |
||
6411 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
6412 |
"Modified: 3.6.1996 / 18:48:49 / cg" |
593 | 6413 |
! |
6414 |
||
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6415 |
addMessage:labelString centered:centered |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6416 |
^ self addTextLabel:labelString |
2116 | 6417 |
|
6418 |
"Created: / 4.2.2000 / 00:03:24 / cg" |
|
6419 |
! |
|
6420 |
||
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6421 |
addMessage:labelString textLine:valueHolder boundary:fraction |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6422 |
^ self |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6423 |
addMessage:labelString |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6424 |
textLine:valueHolder |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6425 |
type:nil |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6426 |
boundary:fraction |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6427 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6428 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6429 |
addMessage:labelString textLine:valueHolder type:typeSymbolOrNil boundary:fraction |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6430 |
|pos lbl field| |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6431 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6432 |
pos := self yPosition. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6433 |
lbl := self addTextLabel:labelString. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6434 |
lbl width:fraction. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6435 |
self yPosition:pos. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6436 |
field := self addInputFieldOn:valueHolder tabable:true. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6437 |
field left:fraction; width:(1.0-fraction). |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6438 |
typeSymbolOrNil == #password ifTrue:[ |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6439 |
field bePassword |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6440 |
]. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6441 |
^ field |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6442 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
6443 |
|
593 | 6444 |
addTextLabel:aString |
6445 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
6446 |
however, ST/X labels allow image labels too. |
|
6447 |
Returns the label." |
|
6448 |
||
6449 |
|l| |
|
6450 |
||
6451 |
l := Label new label:aString. |
|
6452 |
l borderWidth:0. |
|
6453 |
self addComponent:l. |
|
6454 |
^ l |
|
6455 |
||
6456 |
" |
|
6457 |
|b| |
|
6458 |
||
6459 |
b := DialogBox new. |
|
6460 |
b addTextLabel:'hello'. |
|
6461 |
b showAtPointer |
|
6462 |
" |
|
6463 |
" |
|
6464 |
|b| |
|
6465 |
||
6466 |
b := DialogBox new. |
|
6467 |
b leftIndent:100. |
|
6468 |
b addTextLabel:'hello'. |
|
6469 |
b leftIndent:0. |
|
6470 |
b addTextLabel:'world'. |
|
6471 |
b showAtPointer |
|
6472 |
" |
|
6473 |
" |
|
6474 |
|b| |
|
6475 |
||
6476 |
b := DialogBox new. |
|
6477 |
b addTextLabel:'hello'. |
|
6478 |
b addTextLabel:'world'. |
|
6479 |
b addOkButton. |
|
6480 |
b showAtPointer |
|
6481 |
" |
|
6482 |
" |
|
6483 |
|b| |
|
6484 |
||
6485 |
b := DialogBox new. |
|
6486 |
b addTextLabel:'hello'. |
|
6487 |
(b addTextLabel:'world') foregroundColor:Color red. |
|
6488 |
b addOkButton. |
|
6489 |
b showAtPointer |
|
6490 |
" |
|
6491 |
" |
|
6492 |
|b| |
|
6493 |
||
6494 |
b := DialogBox new. |
|
6495 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
6496 |
b addOkButton. |
|
6497 |
b showAtPointer |
|
6498 |
" |
|
6499 |
" |
|
6500 |
|b| |
|
6501 |
||
6502 |
b := DialogBox new. |
|
6503 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
6504 |
b addTextLabel:'not bad'. |
|
6505 |
b addAbortButton. |
|
6506 |
b addOkButton. |
|
6507 |
b showAtPointer |
|
6508 |
" |
|
6509 |
! |
|
6510 |
||
3908 | 6511 |
addTextLabelOn:aValueHolder |
6512 |
"create a text label showing the contents of a valueHolder. |
|
6513 |
Returns the label." |
|
6514 |
||
6515 |
|l| |
|
6516 |
||
6517 |
l := Label new labelChannel:aValueHolder. |
|
6518 |
l borderWidth:0. |
|
6519 |
self addComponent:l. |
|
6520 |
^ l |
|
6521 |
||
6522 |
" |
|
6523 |
|b| |
|
6524 |
||
6525 |
b := DialogBox new. |
|
6526 |
b addTextLabelOn:'hello' asValue. |
|
6527 |
b showAtPointer |
|
6528 |
" |
|
6529 |
" |
|
6530 |
|b| |
|
6531 |
||
6532 |
b := DialogBox new. |
|
6533 |
b leftIndent:100. |
|
6534 |
b addTextLabelOn:'hello' asValue. |
|
6535 |
b leftIndent:0. |
|
6536 |
b addTextLabelOn:'world' asValue. |
|
6537 |
b showAtPointer |
|
6538 |
" |
|
6539 |
! |
|
6540 |
||
593 | 6541 |
addToInputFieldGroup:aComponentOrSubcomponent |
6542 |
"add a component to the input group. |
|
6543 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
6544 |
a topLevel component." |
|
6545 |
||
1355 | 6546 |
self |
1401 | 6547 |
addToInputFieldGroup:aComponentOrSubcomponent before:nil |
1355 | 6548 |
|
6549 |
"Modified: 18.10.1997 / 03:09:17 / cg" |
|
6550 |
! |
|
6551 |
||
6552 |
addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
|
6553 |
"add a component to the input group. |
|
6554 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
6555 |
a topLevel component." |
|
6556 |
||
593 | 6557 |
inputFieldGroup isNil ifTrue:[ |
1759 | 6558 |
inputFieldGroup := EnterFieldGroup new. |
6559 |
inputFieldGroup leaveAction:[self lastFieldLeft]. |
|
6560 |
"/ |
|
6561 |
"/ the first inputField gets the focus initially |
|
6562 |
"/ |
|
6563 |
aComponentOrSubcomponent hasKeyboardFocus:true. |
|
593 | 6564 |
]. |
1355 | 6565 |
inputFieldGroup add:aComponentOrSubcomponent before:anotherComponent. |
593 | 6566 |
self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus). |
6567 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6568 |
"/ inputFields isNil ifTrue:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6569 |
"/ inputFields := OrderedCollection new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6570 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6571 |
"/ "/ the very first field gets the focus initially |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6572 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6573 |
"/ aComponentOrSubcomponent showCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6574 |
"/ aComponentOrSubcomponent hasKeyboardFocus:true. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6575 |
"/ ] ifFalse:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6576 |
"/ aComponentOrSubcomponent hideCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6577 |
"/ aComponentOrSubcomponent hasKeyboardFocus:false. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6578 |
"/ ]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6579 |
"/ inputFields add:aComponentOrSubcomponent |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6580 |
|
1355 | 6581 |
"Modified: 18.10.1997 / 02:47:20 / cg" |
6582 |
"Created: 18.10.1997 / 03:08:51 / cg" |
|
6583 |
! |
|
6584 |
||
6585 |
removeFromInputFieldGroup:aComponentOrSubcomponent |
|
6586 |
"remove a component from the input group. |
|
6587 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
6588 |
a topLevel component." |
|
6589 |
||
6590 |
inputFieldGroup isNil ifTrue:[^ self]. |
|
6591 |
inputFieldGroup remove:aComponentOrSubcomponent. |
|
6592 |
||
6593 |
"Created: 18.10.1997 / 02:51:30 / cg" |
|
593 | 6594 |
! ! |
6595 |
||
6596 |
!DialogBox methodsFor:'construction-buttons'! |
|
6597 |
||
1763 | 6598 |
addAbortAndOkButtons |
6599 |
"create both abort- and Ok Buttons" |
|
6600 |
||
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
6601 |
self |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
6602 |
addAbortButtonLabelled:nil; |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
6603 |
addOkButtonLabelled:nil |
1763 | 6604 |
! |
6605 |
||
197 | 6606 |
addAbortButton |
6607 |
"create an abortButton - to be sent from redefined initialize |
|
162 | 6608 |
methods in subclasses or when creating a box programmatically. |
6609 |
Returns the button." |
|
6610 |
||
197 | 6611 |
^ self addAbortButtonLabelled:nil |
122 | 6612 |
! |
120 | 6613 |
|
162 | 6614 |
addAbortButton:aButton |
6615 |
"add an already created abortButton - to be sent from redefined initialize |
|
6616 |
methods in subclasses or when creating a box programmatically. |
|
6617 |
Returns the button." |
|
6618 |
||
6619 |
abortButton := aButton. |
|
6620 |
aButton model:self; change:#abortPressed. |
|
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6621 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6622 |
"/ changed: |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6623 |
"/ now exclusively done by the buttonPanel itself |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6624 |
|
2698 | 6625 |
"/ (Dialog defaultOKButtonAtLeft) ifTrue:[ |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6626 |
"/ self addButton:aButton after:nil. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6627 |
"/ ] ifFalse:[ |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6628 |
"/ self addButton:aButton before:nil. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6629 |
"/ ]. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6630 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6631 |
self addButton:aButton before:nil. |
1763 | 6632 |
^ aButton. |
162 | 6633 |
|
6634 |
"Created: 17.9.1995 / 20:17:26 / claus" |
|
6635 |
! |
|
6636 |
||
122 | 6637 |
addAbortButtonLabelled:buttonLabel |
6638 |
"create an abortButton with a label - to be sent from redefined initialize |
|
6639 |
methods in subclasses or when creating a box programmatically. |
|
6640 |
A nil argument creates one with the default label. |
|
6641 |
Returns the button." |
|
6642 |
||
162 | 6643 |
|aButton| |
6644 |
||
6645 |
aButton := Button abortButton. |
|
6646 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
6647 |
^ self addAbortButton:aButton |
|
6648 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6649 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6650 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6651 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6652 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6653 |
dialog addAbortButtonLabelled:'get out of here'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6654 |
dialog addOkButtonLabelled:'yes thats ok'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6655 |
dialog open. |
655 | 6656 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6657 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6658 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6659 |
"Modified: 9.2.1996 / 22:09:40 / cg" |
120 | 6660 |
! |
76 | 6661 |
|
197 | 6662 |
addButton:aButton |
6663 |
"add a button into the buttonPanel. |
|
122 | 6664 |
Returns the button." |
120 | 6665 |
|
3050 | 6666 |
"/ ^ self addButton:aButton after:nil |
6667 |
(self class defaultOKButtonAtLeft) ifFalse:[ |
|
6668 |
^ self addButton:aButton before:nil |
|
6669 |
] ifTrue:[ |
|
6670 |
^ self addButton:aButton after:nil |
|
6671 |
]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6672 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6673 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6674 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6675 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6676 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6677 |
dialog addAbortButton. |
655 | 6678 |
dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6679 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6680 |
dialog open. |
655 | 6681 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6682 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6683 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6684 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6685 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6686 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6687 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6688 |
dialog addAbortButton. |
655 | 6689 |
dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6690 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6691 |
dialog open. |
655 | 6692 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6693 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6694 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6695 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6696 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6697 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6698 |
dialog := DialogBox new. |
655 | 6699 |
dialog addButton:(Button label:'foo' action:[dialog hide. Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6700 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6701 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6702 |
dialog open. |
655 | 6703 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6704 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6705 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6706 |
"Modified: 9.2.1996 / 22:14:17 / cg" |
197 | 6707 |
! |
6708 |
||
6709 |
addButton:aButton after:someOtherButtonOrNil |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6710 |
"add a button into the buttonPanel. |
197 | 6711 |
If the argument someOtherButtonOrNil is nil, the button is |
6712 |
added at the end." |
|
6713 |
||
6714 |
|h| |
|
6715 |
||
6716 |
buttonPanel addSubView:aButton after:someOtherButtonOrNil. |
|
6717 |
buttonPanel subViews size > 1 ifTrue:[ |
|
1843 | 6718 |
buttonPanel horizontalLayout:#fitSpace. |
197 | 6719 |
]. |
6720 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
|
1843 | 6721 |
buttonPanel topInset:h negated |
197 | 6722 |
]. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6723 |
needResize := true. |
197 | 6724 |
^ aButton |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
6725 |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6726 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6727 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6728 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6729 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6730 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6731 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6732 |
dialog addButton:(Button |
1843 | 6733 |
label:'foo' |
6734 |
action:[dialog hide. Transcript showCR:'foo']) |
|
6735 |
after:(dialog okButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6736 |
dialog open. |
655 | 6737 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6738 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6739 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6740 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6741 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6742 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6743 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6744 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6745 |
dialog addButton:(Button |
1843 | 6746 |
label:'foo' |
6747 |
action:[dialog hide. Transcript showCR:'foo']) |
|
6748 |
after:(dialog abortButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6749 |
dialog open. |
655 | 6750 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6751 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6752 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6753 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6754 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6755 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6756 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6757 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6758 |
dialog addButton:(Button |
1843 | 6759 |
label:'foo' |
6760 |
action:[dialog hide. Transcript showCR:'foo']) |
|
6761 |
after:nil. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6762 |
dialog open. |
655 | 6763 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6764 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6765 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6766 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
197 | 6767 |
! |
6768 |
||
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6769 |
addButton:aButton before:someOtherButtonOrNil |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6770 |
"add a button into the buttonPanel. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6771 |
If the argument someOtherButtonOrNil is nil, the button is |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6772 |
added upFront." |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6773 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6774 |
|h| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6775 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6776 |
buttonPanel addSubView:aButton before:someOtherButtonOrNil. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6777 |
buttonPanel subViews size > 1 ifTrue:[ |
1843 | 6778 |
buttonPanel horizontalLayout:#fitSpace. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6779 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6780 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
1843 | 6781 |
buttonPanel topInset:h negated |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6782 |
]. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
6783 |
preferredExtent := nil. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6784 |
needResize := true. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6785 |
^ aButton |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6786 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6787 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6788 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6789 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6790 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6791 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6792 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6793 |
dialog addButton:(Button |
1843 | 6794 |
label:'foo' |
6795 |
action:[dialog hide. Transcript showCR:'foo']) |
|
6796 |
before:(dialog okButton). |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6797 |
dialog open. |
655 | 6798 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6799 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6800 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6801 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6802 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6803 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6804 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6805 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6806 |
dialog addButton:(Button |
1843 | 6807 |
label:'foo' |
6808 |
action:[dialog hide. Transcript showCR:'foo']) |
|
6809 |
before:nil. |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6810 |
dialog open. |
655 | 6811 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6812 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6813 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6814 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6815 |
"Created: 10.2.1996 / 16:04:35 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6816 |
! |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
6817 |
|
593 | 6818 |
addHelpButtonFor:pathToHelpText |
6819 |
"add a help button to the buttonPanel. |
|
6820 |
The argument, pathToHelpText should specify the path to the help |
|
6821 |
text under either the doc/online/<language> or the help/<language> |
|
6822 |
directory." |
|
6823 |
||
6824 |
|helpButton| |
|
6825 |
||
2478 | 6826 |
helpButton := Button label:(resources string:'Help'). |
593 | 6827 |
helpButton action:[ |
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
6828 |
self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:pathToHelpText] |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
6829 |
]. |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6830 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6831 |
"/ changed: |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6832 |
"/ now exclusively done by the buttonPanel itself |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6833 |
|
2698 | 6834 |
"/ (Dialog defaultOKButtonAtLeft) ifTrue:[ |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6835 |
"/ self addButton:helpButton after:nil. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6836 |
"/ ] ifFalse:[ |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6837 |
"/ self addButton:helpButton before:nil. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6838 |
"/ ]. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6839 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6840 |
self addButton:helpButton before:nil. |
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
6841 |
^ helpButton |
593 | 6842 |
|
6843 |
" |
|
6844 |
|box| |
|
6845 |
||
6846 |
box := DialogBox new. |
|
6847 |
box |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
6848 |
addHelpButtonFor:'Launcher/compilerSettings.html'; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
6849 |
addAbortButton; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
6850 |
addOkButton. |
593 | 6851 |
|
6852 |
box open |
|
6853 |
" |
|
6854 |
||
2478 | 6855 |
"Modified: / 9.9.1996 / 22:40:21 / stefan" |
6856 |
"Modified: / 17.11.2001 / 09:42:50 / cg" |
|
593 | 6857 |
! |
6858 |
||
2116 | 6859 |
addOK:checkBlock |
6860 |
|butt| |
|
6861 |
||
6862 |
butt := self addOkButton. |
|
6863 |
"/ what is checkBlock ? |
|
6864 |
^ butt |
|
6865 |
||
6866 |
"Modified: / 4.2.2000 / 00:09:15 / cg" |
|
6867 |
! |
|
6868 |
||
593 | 6869 |
addOkButton |
6870 |
"create an okButton - to be sent from redefined initialize |
|
6871 |
methods in subclasses or when creating a box programmatically. |
|
6872 |
Returns the button." |
|
6873 |
||
6874 |
^ self addOkButtonLabelled:nil |
|
6875 |
||
6876 |
" |
|
6877 |
|dialog| |
|
6878 |
||
6879 |
dialog := DialogBox new. |
|
6880 |
dialog addOkButton. |
|
6881 |
dialog open. |
|
655 | 6882 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 6883 |
" |
6884 |
||
6885 |
"Modified: 9.2.1996 / 21:37:02 / cg" |
|
6886 |
! |
|
6887 |
||
6888 |
addOkButton:aButton |
|
6889 |
"add an already created okButton - to be sent from redefined initialize |
|
6890 |
methods in subclasses or when creating a box programmatically. |
|
6891 |
Returns the button." |
|
6892 |
||
1764 | 6893 |
"/ okButton isNil ifTrue:[ |
6894 |
okButton := aButton. |
|
6895 |
"/ ]. |
|
593 | 6896 |
aButton model:self; change:#okPressed. |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6897 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6898 |
"/ changed: |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6899 |
"/ now exclusively done by the buttonPanel itself |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6900 |
|
2698 | 6901 |
"/ (Dialog defaultOKButtonAtLeft) ifTrue:[ |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6902 |
"/ self addButton:aButton before:nil. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6903 |
"/ ] ifFalse:[ |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6904 |
"/ self addButton:aButton after:nil. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6905 |
"/ ]. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6906 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6907 |
self addButton:aButton after:nil. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
6908 |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
6909 |
^ aButton. |
593 | 6910 |
|
6911 |
" |
|
6912 |
|dialog b| |
|
6913 |
||
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
6914 |
b := Button label:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedBy:0.5). |
593 | 6915 |
|
6916 |
dialog := DialogBox new. |
|
6917 |
dialog addOkButton:b. |
|
6918 |
dialog open. |
|
655 | 6919 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 6920 |
" |
6921 |
||
6922 |
"Modified: 17.9.1995 / 20:20:41 / claus" |
|
6923 |
"Modified: 9.2.1996 / 21:38:48 / cg" |
|
6924 |
! |
|
6925 |
||
6926 |
addOkButtonLabelled:buttonLabel |
|
6927 |
"create an okButton with a label - to be sent from redefined initialize |
|
6928 |
methods in subclasses or when creating a box programmatically. |
|
6929 |
A nil argument creates one with the default text. |
|
6930 |
Returns the button." |
|
6931 |
||
6932 |
|aButton| |
|
6933 |
||
6934 |
aButton := Button okButton. |
|
6935 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
6936 |
aButton isReturnButton:acceptReturnAsOK. |
|
6937 |
^ self addOkButton:aButton. |
|
6938 |
||
6939 |
" |
|
6940 |
|dialog| |
|
6941 |
||
6942 |
dialog := DialogBox new. |
|
6943 |
dialog addOkButtonLabelled:'get out of here'. |
|
6944 |
dialog open. |
|
655 | 6945 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 6946 |
" |
6947 |
||
6948 |
"Modified: 9.2.1996 / 21:39:34 / cg" |
|
6949 |
! ! |
|
6950 |
||
6951 |
!DialogBox methodsFor:'construction-check & comboboxes'! |
|
6952 |
||
197 | 6953 |
addCheckBox:label on:aModel |
6954 |
"create a checkBox with label on aModel and add it. |
|
6955 |
Returns the box." |
|
6956 |
||
6957 |
^ self addCheckBox:label on:aModel tabable:true |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6958 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6959 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6960 |
|dialog check| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6961 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6962 |
check := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6963 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6964 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6965 |
dialog addCheckBox:'on or off' on:check. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6966 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6967 |
dialog open. |
655 | 6968 |
dialog accepted ifTrue:[Transcript showCR:check value]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6969 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6970 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
6971 |
"Modified: 9.2.1996 / 22:15:38 / cg" |
197 | 6972 |
! |
6973 |
||
600 | 6974 |
addCheckBox:label on:aModel tabable:tabable |
6975 |
"create a checkBox with label on aModel and add it. |
|
6976 |
Returns the box." |
|
6977 |
||
6978 |
|b| |
|
6979 |
||
6980 |
b := CheckBox on:aModel. |
|
6981 |
b label:label. |
|
6982 |
self addComponent:b tabable:tabable. |
|
6983 |
^ b |
|
6984 |
||
6985 |
" |
|
6986 |
|dialog check1 check2 check3| |
|
6987 |
||
6988 |
check1 := true asValue. |
|
6989 |
check2 := false asValue. |
|
6990 |
check3 := true asValue. |
|
6991 |
||
6992 |
dialog := DialogBox new. |
|
6993 |
dialog addCheckBox:'on or off' on:check1 tabable:false. |
|
6994 |
dialog addHorizontalLine. |
|
6995 |
||
6996 |
dialog addCheckBox:'on or off' on:check2 tabable:true. |
|
6997 |
dialog addCheckBox:'on or off' on:check3 tabable:true. |
|
6998 |
dialog addOkButton. |
|
6999 |
dialog open. |
|
7000 |
" |
|
7001 |
||
7002 |
"Modified: 9.2.1996 / 22:16:49 / cg" |
|
7003 |
! |
|
7004 |
||
593 | 7005 |
addComboBoxOn:aModel |
7006 |
"create a comboBoxView on aModel and add it. |
|
7007 |
Returns the comboBoxView." |
|
7008 |
||
7009 |
^ self addComboBoxOn:aModel tabable:true |
|
7010 |
||
7011 |
" |
|
7012 |
without a list, the comboBox is disabled: |
|
7013 |
||
7014 |
|box val| |
|
7015 |
||
7016 |
val := 'some input' asValue. |
|
7017 |
||
7018 |
box := Dialog new. |
|
7019 |
||
7020 |
(box addTextLabel:'combo box example') adjust:#left. |
|
7021 |
box addVerticalSpace. |
|
7022 |
(box addComboBoxOn:val). |
|
7023 |
box addOkButton. |
|
7024 |
box open. |
|
7025 |
box accepted ifTrue:[ |
|
1401 | 7026 |
Transcript showCR:val value |
593 | 7027 |
]. |
7028 |
" |
|
7029 |
||
7030 |
"with a list, it can be pulled: |
|
7031 |
||
7032 |
|box val| |
|
7033 |
||
7034 |
val := '' asValue. |
|
7035 |
||
7036 |
box := Dialog new. |
|
7037 |
||
7038 |
(box addTextLabel:'combo box example') adjust:#left. |
|
7039 |
box addVerticalSpace. |
|
7040 |
(box addComboBoxOn:val) list:#('one' 'two' 'three' 'four'). |
|
7041 |
box addOkButton. |
|
7042 |
box open. |
|
7043 |
box accepted ifTrue:[ |
|
1401 | 7044 |
Transcript showCR:val value |
593 | 7045 |
]. |
7046 |
" |
|
7047 |
||
7048 |
"Modified: 28.2.1996 / 15:17:39 / cg" |
|
7049 |
"Created: 4.3.1996 / 17:21:45 / cg" |
|
7050 |
! |
|
7051 |
||
7052 |
addComboBoxOn:aModel tabable:tabable |
|
7053 |
"create a comboBoxView on aModel and add it. |
|
7054 |
Returns the comboBoxView." |
|
7055 |
||
7056 |
|f| |
|
7057 |
||
7058 |
f := ComboBoxView new. |
|
7059 |
f model:aModel. |
|
7060 |
self addComponent:f tabable:tabable. |
|
7061 |
tabable ifTrue:[ |
|
1401 | 7062 |
self addToInputFieldGroup:f editor. |
593 | 7063 |
]. |
7064 |
^ f |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7065 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7066 |
" |
593 | 7067 |
without a list, the comboBox is disabled: |
7068 |
||
7069 |
|box val| |
|
7070 |
||
7071 |
val := 'some input' asValue. |
|
7072 |
||
7073 |
box := Dialog new. |
|
7074 |
||
7075 |
(box addTextLabel:'combo box example') adjust:#left. |
|
7076 |
box addVerticalSpace. |
|
7077 |
(box addComboBoxOn:val tabable:true). |
|
7078 |
box addOkButton. |
|
7079 |
box open. |
|
7080 |
box accepted ifTrue:[ |
|
1401 | 7081 |
Transcript showCR:val value |
593 | 7082 |
]. |
7083 |
" |
|
7084 |
||
7085 |
"with a list, it can be pulled: |
|
7086 |
||
7087 |
|box val| |
|
7088 |
||
7089 |
val := '' asValue. |
|
7090 |
||
7091 |
box := Dialog new. |
|
7092 |
||
7093 |
(box addTextLabel:'combo box example') adjust:#left. |
|
7094 |
box addVerticalSpace. |
|
7095 |
(box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
7096 |
box addOkButton. |
|
7097 |
box open. |
|
7098 |
box accepted ifTrue:[ |
|
1401 | 7099 |
Transcript showCR:val value |
593 | 7100 |
]. |
7101 |
" |
|
7102 |
||
7103 |
"Modified: 4.3.1996 / 17:21:57 / cg" |
|
7104 |
! |
|
7105 |
||
7106 |
addComboListOn:aModel |
|
7107 |
"create a comboListView on aModel and add it. |
|
7108 |
Returns the comboListView." |
|
7109 |
||
7110 |
^ self addComboListOn:aModel tabable:true |
|
7111 |
||
7112 |
"without a list, the comboList is disabled: |
|
7113 |
||
7114 |
|box val| |
|
7115 |
||
7116 |
val := 'some input' asValue. |
|
7117 |
||
7118 |
box := Dialog new. |
|
7119 |
||
7120 |
(box addTextLabel:'combo list example') adjust:#left. |
|
7121 |
box addVerticalSpace. |
|
7122 |
(box addComboListOn:val). |
|
7123 |
box addOkButton. |
|
7124 |
box open. |
|
7125 |
box accepted ifTrue:[ |
|
1401 | 7126 |
Transcript showCR:val value |
593 | 7127 |
]. |
7128 |
" |
|
7129 |
||
7130 |
"with a list, it can be pulled: |
|
7131 |
||
7132 |
|box val| |
|
7133 |
||
7134 |
val := '' asValue. |
|
7135 |
||
7136 |
box := Dialog new. |
|
7137 |
||
7138 |
(box addTextLabel:'combo box example') adjust:#left. |
|
7139 |
box addVerticalSpace. |
|
7140 |
(box addComboListOn:val) list:#('one' 'two' 'three' 'four'). |
|
7141 |
box addOkButton. |
|
7142 |
box open. |
|
7143 |
box accepted ifTrue:[ |
|
1401 | 7144 |
Transcript showCR:val value |
593 | 7145 |
]. |
7146 |
" |
|
7147 |
||
7148 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
7149 |
"Modified: 4.3.1996 / 17:22:59 / cg" |
|
7150 |
! |
|
7151 |
||
7152 |
addComboListOn:aModel tabable:tabable |
|
7153 |
"create a comboListView on aModel and add it. |
|
7154 |
Returns the comboListView." |
|
7155 |
||
7156 |
|f| |
|
7157 |
||
7158 |
f := ComboListView new. |
|
7159 |
f model:aModel. |
|
7160 |
self addComponent:f tabable:tabable. |
|
7161 |
^ f |
|
7162 |
||
7163 |
"without a list, the comboList is disabled: |
|
7164 |
||
7165 |
|box val| |
|
7166 |
||
7167 |
val := 'some input' asValue. |
|
7168 |
||
7169 |
box := Dialog new. |
|
7170 |
||
7171 |
(box addTextLabel:'combo list example') adjust:#left. |
|
7172 |
box addVerticalSpace. |
|
7173 |
(box addComboListOn:val tabable:true). |
|
7174 |
box addOkButton. |
|
7175 |
box open. |
|
7176 |
box accepted ifTrue:[ |
|
1401 | 7177 |
Transcript showCR:val value |
593 | 7178 |
]. |
7179 |
" |
|
7180 |
||
7181 |
"with a list, it can be pulled: |
|
7182 |
||
7183 |
|box val| |
|
7184 |
||
7185 |
val := '' asValue. |
|
7186 |
||
7187 |
box := Dialog new. |
|
7188 |
||
7189 |
(box addTextLabel:'combo box example') adjust:#left. |
|
7190 |
box addVerticalSpace. |
|
7191 |
(box addComboListOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
7192 |
box addOkButton. |
|
7193 |
box open. |
|
7194 |
box accepted ifTrue:[ |
|
1401 | 7195 |
Transcript showCR:val value |
593 | 7196 |
]. |
7197 |
" |
|
7198 |
||
7199 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
7200 |
"Modified: 4.3.1996 / 17:23:38 / cg" |
|
7201 |
! ! |
|
7202 |
||
7203 |
!DialogBox methodsFor:'construction-inputfields'! |
|
7204 |
||
7205 |
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable |
|
7206 |
"create a fileName input field on aModel and add it. |
|
7207 |
Returns the field. This is much like a normal input field, |
|
7208 |
but supports filename completion." |
|
7209 |
||
7210 |
|f| |
|
7211 |
||
7212 |
f := FilenameEditField new. |
|
7213 |
aDirectory notNil ifTrue:[f directory:aDirectory]. |
|
7214 |
f model:aModel. |
|
7215 |
self addInputField:f tabable:tabable. |
|
7216 |
^ f |
|
7217 |
! |
|
7218 |
||
7219 |
addInputField:aField |
|
7220 |
"add an already created input field. |
|
7221 |
Returns the field." |
|
7222 |
||
7223 |
^ self addInputField:aField tabable:true |
|
7224 |
||
7225 |
"Modified: 9.2.1996 / 20:46:16 / cg" |
|
7226 |
! |
|
7227 |
||
7228 |
addInputField:aField tabable:tabable |
|
7229 |
"add an already created input field. |
|
7230 |
If tabable is true, the field is put into a group, to allow |
|
7231 |
stepping through the fields with #Cursor/#Return keys. |
|
7232 |
Returns the field." |
|
7233 |
||
7234 |
self addComponent:aField tabable:tabable. |
|
7235 |
tabable ifTrue:[ |
|
1401 | 7236 |
self addToInputFieldGroup:aField. |
593 | 7237 |
]. |
7238 |
^ aField |
|
7239 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
7240 |
"Modified: 31.5.1996 / 21:22:29 / cg" |
593 | 7241 |
! |
7242 |
||
7243 |
addInputFieldOn:aModel |
|
7244 |
"create an input field on aModel and add it. |
|
7245 |
Returns the field." |
|
7246 |
||
7247 |
^ self addInputFieldOn:aModel tabable:true |
|
7248 |
||
7249 |
" |
|
7250 |
|dialog model field| |
|
7251 |
||
7252 |
model := '' asValue. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7253 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7254 |
dialog := DialogBox new. |
593 | 7255 |
(dialog addTextLabel:'enter a string') adjust:#left. |
7256 |
||
7257 |
field := dialog addInputFieldOn:model. |
|
7258 |
||
7259 |
dialog addAbortButton; addOkButton. |
|
7260 |
dialog open. |
|
655 | 7261 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 7262 |
" |
7263 |
||
7264 |
"Modified: 9.2.1996 / 21:34:14 / cg" |
|
7265 |
! |
|
7266 |
||
7267 |
addInputFieldOn:aModel tabable:tabable |
|
7268 |
"create an input field on aModel and add it. |
|
7269 |
If tabable is false, the field cannot be tabbed into |
|
7270 |
and return does not close the box. |
|
7271 |
(pointer must be moved into it). |
|
7272 |
Returns the field." |
|
7273 |
||
7274 |
|f| |
|
7275 |
||
913 | 7276 |
f := EditField model:aModel. |
593 | 7277 |
self addInputField:f tabable:tabable. |
7278 |
^ f |
|
7279 |
||
7280 |
" a non-tabable field: |
|
7281 |
||
7282 |
|dialog model field| |
|
7283 |
||
7284 |
model := '' asValue. |
|
7285 |
||
7286 |
dialog := DialogBox new. |
|
7287 |
(dialog addTextLabel:'enter a string') adjust:#left. |
|
7288 |
||
7289 |
field := dialog addInputFieldOn:model tabable:false. |
|
7290 |
||
7291 |
dialog addAbortButton; addOkButton. |
|
7292 |
dialog open. |
|
655 | 7293 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 7294 |
" |
7295 |
||
7296 |
"Modified: 9.2.1996 / 21:36:16 / cg" |
|
913 | 7297 |
"Modified: 3.1.1997 / 10:24:04 / stefan" |
593 | 7298 |
! |
7299 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7300 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable from:leftX to:rightX separateAtX:relativeX |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7301 |
"add a label and an inputField side-by-side. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7302 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7303 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7304 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7305 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7306 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7307 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7308 |
^ self |
1401 | 7309 |
addLabelledField:(EditField on:model) label:labelString |
7310 |
adjust:labelAdjust |
|
7311 |
tabable:tabable |
|
7312 |
from:leftX to:rightX |
|
7313 |
separateAtX:relativeX. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7314 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7315 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7316 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7317 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7318 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7319 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7320 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7321 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7322 |
field := dialog |
1401 | 7323 |
addLabelledInputField:'enter a string' |
7324 |
adjust:#left |
|
7325 |
on:model |
|
7326 |
tabable:true |
|
7327 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7328 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7329 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7330 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7331 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7332 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7333 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7334 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7335 |
|dialog model1 model2 field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7336 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7337 |
model1 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7338 |
model2 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7339 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7340 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7341 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7342 |
dialog addTextLabel:'a two-input box'. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7343 |
dialog addHorizontalLine. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7344 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7345 |
field := dialog |
1401 | 7346 |
addLabelledInputField:'string1:' |
7347 |
adjust:#right |
|
7348 |
on:model1 |
|
7349 |
tabable:true |
|
7350 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7351 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7352 |
field := dialog |
1401 | 7353 |
addLabelledInputField:'string2:' |
7354 |
adjust:#right |
|
7355 |
on:model2 |
|
7356 |
tabable:true |
|
7357 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7358 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7359 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7360 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7361 |
dialog accepted ifTrue:[ |
1401 | 7362 |
Transcript showCR:model1 value. |
7363 |
Transcript showCR:model2 value. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7364 |
]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7365 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7366 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7367 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7368 |
"Created: 3.6.1996 / 11:04:23 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7369 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7370 |
|
593 | 7371 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX |
7372 |
"add a label and an inputField side-by-side. |
|
7373 |
The labels goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
|
7374 |
The labels string is defined by labelString and adjusted according to labelAdjust. |
|
7375 |
The inputField gets model as its model. |
|
7376 |
Return the inputField." |
|
7377 |
||
7378 |
||
7379 |
^ self |
|
1401 | 7380 |
addLabelledField:(EditField on:model) label:labelString |
7381 |
adjust:labelAdjust |
|
7382 |
tabable:tabable |
|
7383 |
separateAtX:relativeX. |
|
593 | 7384 |
|
7385 |
" |
|
7386 |
|dialog model field| |
|
7387 |
||
7388 |
model := '' asValue. |
|
7389 |
||
7390 |
dialog := DialogBox new. |
|
7391 |
||
7392 |
field := dialog |
|
1401 | 7393 |
addLabelledInputField:'enter a string' |
7394 |
adjust:#left |
|
7395 |
on:model |
|
7396 |
tabable:true |
|
7397 |
separateAtX:0.3. |
|
593 | 7398 |
|
7399 |
dialog addAbortButton; addOkButton. |
|
7400 |
dialog open. |
|
655 | 7401 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 7402 |
" |
7403 |
||
7404 |
" |
|
7405 |
|dialog model1 model2 field| |
|
7406 |
||
7407 |
model1 := '' asValue. |
|
7408 |
model2 := '' asValue. |
|
7409 |
||
7410 |
dialog := DialogBox new. |
|
7411 |
||
7412 |
dialog addTextLabel:'a two-input box'. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7413 |
dialog addHorizontalLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7414 |
|
593 | 7415 |
field := dialog |
1401 | 7416 |
addLabelledInputField:'string1:' |
7417 |
adjust:#right |
|
7418 |
on:model1 |
|
7419 |
tabable:true |
|
7420 |
separateAtX:0.4. |
|
593 | 7421 |
|
7422 |
field := dialog |
|
1401 | 7423 |
addLabelledInputField:'string2:' |
7424 |
adjust:#right |
|
7425 |
on:model2 |
|
7426 |
tabable:true |
|
7427 |
separateAtX:0.4. |
|
593 | 7428 |
|
7429 |
dialog addAbortButton; addOkButton. |
|
7430 |
dialog open. |
|
7431 |
dialog accepted ifTrue:[ |
|
1401 | 7432 |
Transcript showCR:model1 value. |
7433 |
Transcript showCR:model2 value. |
|
593 | 7434 |
]. |
7435 |
" |
|
7436 |
||
7437 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
7438 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
|
7439 |
! ! |
|
7440 |
||
7441 |
!DialogBox methodsFor:'construction-layout'! |
|
7442 |
||
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7443 |
addGap |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7444 |
"VW compatibility" |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7445 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7446 |
self addGap:4 |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7447 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7448 |
|
2116 | 7449 |
addGap:pixels |
7450 |
"VW compatibility" |
|
7451 |
||
7452 |
self addVerticalSpace:pixels |
|
7453 |
||
7454 |
"Created: / 4.2.2000 / 00:03:58 / cg" |
|
7455 |
"Modified: / 5.2.2000 / 15:30:26 / cg" |
|
7456 |
! |
|
7457 |
||
593 | 7458 |
addHorizontalLine |
7459 |
"add a horizontal line as separator" |
|
7460 |
||
7461 |
^ self addComponent:(Separator new extent:1.0 @ 5). |
|
7462 |
||
7463 |
" |
|
7464 |
|dialog| |
|
7465 |
||
7466 |
dialog := DialogBox new. |
|
7467 |
dialog |
|
1401 | 7468 |
addTextLabel:'some title string'; |
7469 |
addHorizontalLine; |
|
7470 |
addTextLabel:'more text'; |
|
7471 |
addOkButton; |
|
7472 |
open. |
|
593 | 7473 |
" |
7474 |
||
7475 |
" |
|
7476 |
|dialog| |
|
7477 |
||
7478 |
dialog := DialogBox new. |
|
7479 |
dialog |
|
1401 | 7480 |
addTextLabel:'some title string'; |
7481 |
addHorizontalLine; |
|
7482 |
addTextLabel:'more text'. |
|
593 | 7483 |
(dialog addHorizontalLine) width:20. |
7484 |
dialog addTextLabel:'more text'. |
|
7485 |
(dialog addHorizontalLine) width:20. |
|
7486 |
dialog |
|
1401 | 7487 |
addTextLabel:'more text'; |
7488 |
addHorizontalLine; |
|
7489 |
addOkButton; |
|
7490 |
open. |
|
593 | 7491 |
" |
7492 |
||
7493 |
"Modified: 19.4.1996 / 15:11:30 / cg" |
|
7494 |
! |
|
7495 |
||
7496 |
addVerticalSpace |
|
7497 |
"add a default vertical space (1 mm)" |
|
7498 |
||
7499 |
self addVerticalSpace:(ViewSpacing). |
|
7500 |
||
7501 |
" |
|
7502 |
|dialog| |
|
7503 |
||
7504 |
dialog := DialogBox new. |
|
7505 |
dialog addTextLabel:'some title string'. |
|
7506 |
dialog addVerticalSpace. |
|
7507 |
dialog addTextLabel:'more text'. |
|
7508 |
||
7509 |
dialog addOkButton. |
|
7510 |
dialog open. |
|
7511 |
" |
|
7512 |
||
7513 |
"Modified: 9.2.1996 / 21:41:10 / cg" |
|
7514 |
! |
|
7515 |
||
7516 |
addVerticalSpace:nPixel |
|
7517 |
"add some pixels of space to the next component" |
|
7518 |
||
7519 |
yPosition := yPosition + nPixel. |
|
7520 |
needResize := true. |
|
7521 |
||
7522 |
" |
|
7523 |
|dialog| |
|
7524 |
||
7525 |
dialog := DialogBox new. |
|
7526 |
dialog addTextLabel:'some title string'. |
|
7527 |
dialog addVerticalSpace:50. |
|
7528 |
dialog addTextLabel:'more text'. |
|
7529 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7530 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7531 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7532 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
7533 |
|
593 | 7534 |
"Modified: 9.2.1996 / 21:41:23 / cg" |
7535 |
! |
|
7536 |
||
2116 | 7537 |
bottomAlign:widgets |
7538 |
"mhmh - seems similar to out stickAtBottom functionality - to be checked" |
|
7539 |
||
2145 | 7540 |
'DialogBox [warning]: unimplemented VW feature: #bottomAlign' infoPrintCR. |
7541 |
"/ self halt:'unimplemented VW functionality'. |
|
2116 | 7542 |
|
7543 |
"Created: / 4.2.2000 / 00:10:21 / cg" |
|
7544 |
"Modified: / 5.2.2000 / 15:31:23 / cg" |
|
7545 |
! |
|
7546 |
||
7547 |
bottomAlignLowerEdge:widget |
|
7548 |
"mhmh - seems similar to out stickAtBottom functionality - to be checked" |
|
7549 |
||
2145 | 7550 |
"/ self halt:'unimplemented VW functionality'. |
7551 |
self stickAtBottomWithVariableHeight:widget |
|
2116 | 7552 |
|
7553 |
"Modified: / 5.2.2000 / 15:31:15 / cg" |
|
7554 |
! |
|
7555 |
||
593 | 7556 |
leftIndent |
7557 |
"return the current indent |
|
7558 |
(current x position - thats where the next component will be located)." |
|
7559 |
||
7560 |
^ leftIndent |
|
7561 |
||
7562 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
7563 |
! |
|
7564 |
||
7565 |
leftIndent:aNumber |
|
7566 |
"set the left indent (current x position - thats where the next component |
|
7567 |
will be located)." |
|
7568 |
||
7569 |
leftIndent := aNumber. |
|
7570 |
needResize := true. |
|
7571 |
||
7572 |
" |
|
7573 |
|dialog| |
|
7574 |
||
7575 |
dialog := DialogBox new. |
|
7576 |
(dialog addTextLabel:'label1') adjust:#left. |
|
7577 |
dialog leftIndent:20. |
|
7578 |
(dialog addTextLabel:'label2') adjust:#left. |
|
7579 |
dialog leftIndent:40. |
|
7580 |
(dialog addTextLabel:'label3') adjust:#left. |
|
7581 |
dialog leftIndent:60. |
|
7582 |
(dialog addTextLabel:'label4') adjust:#left. |
|
7583 |
||
7584 |
dialog addOkButton. |
|
7585 |
dialog open. |
|
7586 |
" |
|
7587 |
||
7588 |
"Modified: 9.2.1996 / 21:42:20 / cg" |
|
7589 |
! |
|
7590 |
||
7591 |
rightIndent |
|
7592 |
"return the current right indent." |
|
7593 |
||
7594 |
^ rightIndent |
|
7595 |
||
7596 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
7597 |
! |
|
7598 |
||
7599 |
rightIndent:aNumber |
|
7600 |
"set the right indent" |
|
7601 |
||
7602 |
rightIndent := aNumber. |
|
7603 |
needResize := true. |
|
7604 |
||
7605 |
" |
|
7606 |
|dialog| |
|
7607 |
||
7608 |
dialog := DialogBox new. |
|
7609 |
(dialog addTextLabel:'label1') adjust:#right. |
|
7610 |
dialog rightIndent:20. |
|
7611 |
(dialog addTextLabel:'label2') adjust:#right. |
|
7612 |
dialog rightIndent:40. |
|
7613 |
(dialog addTextLabel:'label3') adjust:#right. |
|
7614 |
dialog rightIndent:60. |
|
7615 |
(dialog addTextLabel:'label4') adjust:#right. |
|
7616 |
||
7617 |
dialog addOkButton. |
|
7618 |
dialog open. |
|
7619 |
" |
|
7620 |
||
7621 |
"Modified: 9.2.1996 / 21:42:46 / cg" |
|
7622 |
! |
|
7623 |
||
2116 | 7624 |
setInitialGap |
7625 |
||
7626 |
"Created: / 4.2.2000 / 00:01:44 / cg" |
|
7627 |
! |
|
7628 |
||
593 | 7629 |
stickAtBottomWithFixHeight:aComponent |
7630 |
"arrange for a component to be positioned at a constant offset |
|
7631 |
from the bottom of the box and its height to remain the same. |
|
7632 |
This will keep the component at a constant distance from the bottom |
|
2220 | 7633 |
(without this setup, it would stay at a constant offset from the top). |
7634 |
ATTENTION: use this as a last step, after all components have been added." |
|
593 | 7635 |
|
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7636 |
self stickAtBottomWithFixHeight:aComponent left:0.0 right:1.0 |
593 | 7637 |
|
7638 |
" |
|
7639 |
compare the resizing behavior of: |
|
7640 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7641 |
|box| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7642 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7643 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7644 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7645 |
box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7646 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7647 |
box show |
593 | 7648 |
|
7649 |
with: |
|
7650 |
||
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7651 |
|box l2| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7652 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7653 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7654 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7655 |
l2 := box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7656 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7657 |
box stickAtBottomWithFixHeight:l2. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7658 |
box show |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7659 |
" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7660 |
|
2220 | 7661 |
"Created: / 27.1.1996 / 17:17:41 / cg" |
7662 |
"Modified: / 18.8.2000 / 21:38:21 / cg" |
|
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7663 |
! |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7664 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7665 |
stickAtBottomWithFixHeight:aComponent left:left right:right |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7666 |
"arrange for a component to be positioned at a constant offset |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7667 |
from the bottom of the box and its height to remain the same. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7668 |
This will keep the component at a constant distance from the bottom |
2220 | 7669 |
(without this setup, it would stay at a constant offset from the top). |
7670 |
ATTENTION: use this as a last step, after all components have been added." |
|
1949
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7671 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7672 |
self resize. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7673 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7674 |
aComponent |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7675 |
topInset:(self height - aComponent top) negated; |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7676 |
bottomInset:(self height - aComponent bottom); |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7677 |
origin:left @ 1.0; corner:right @ 1.0. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7678 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7679 |
" |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7680 |
compare the resizing behavior of: |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7681 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7682 |
|box| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7683 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7684 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7685 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7686 |
box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7687 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7688 |
box show |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7689 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7690 |
with: |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7691 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7692 |
|box l2| |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7693 |
|
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7694 |
box := Dialog new. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7695 |
box addTextLabel:'hello'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7696 |
l2 := box addTextLabel:'hello2'. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7697 |
box addOkButton. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7698 |
box stickAtBottomWithFixHeight:l2. |
f8a1dfee9935
another stick method (allowing for left/right to be specified)
Claus Gittinger <cg@exept.de>
parents:
1898
diff
changeset
|
7699 |
box show |
593 | 7700 |
" |
7701 |
||
2220 | 7702 |
"Created: / 27.1.1996 / 17:17:41 / cg" |
7703 |
"Modified: / 18.8.2000 / 21:38:26 / cg" |
|
593 | 7704 |
! |
7705 |
||
7706 |
stickAtBottomWithVariableHeight:aComponent |
|
7707 |
"arrange for a component to be positioned at a constant offset |
|
7708 |
from the bottom of the box and its height to be adjusted. |
|
7709 |
This will resize the component for a constant distance from the top, |
|
7710 |
and the bottom. |
|
2220 | 7711 |
(without this setup, its height would remain constant). |
7712 |
ATTENTION: use this as a last step, after all components have been added." |
|
593 | 7713 |
|
7714 |
self resize. |
|
7715 |
||
7716 |
aComponent |
|
2220 | 7717 |
bottomInset:(self height - aComponent bottom); |
7718 |
corner:1.0@1.0. |
|
593 | 7719 |
|
7720 |
" |
|
7721 |
compare the resizing behavior of: |
|
7722 |
||
2220 | 7723 |
|box| |
7724 |
||
7725 |
box := Dialog new. |
|
7726 |
box addTextLabel:'hello'. |
|
7727 |
(box addComponent:(SelectionInListView new)) level:-1. |
|
7728 |
box addOkButton. |
|
7729 |
box show |
|
593 | 7730 |
|
7731 |
with: |
|
7732 |
||
2220 | 7733 |
|box list| |
7734 |
||
7735 |
box := Dialog new. |
|
7736 |
box addTextLabel:'hello'. |
|
7737 |
list := (box addComponent:(SelectionInListView new)) level:-1. |
|
7738 |
box addOkButton. |
|
7739 |
box stickAtBottomWithVariableHeight:list. |
|
7740 |
box show |
|
593 | 7741 |
" |
7742 |
||
2220 | 7743 |
"Modified: / 18.8.2000 / 21:38:35 / cg" |
593 | 7744 |
! |
7745 |
||
7746 |
yPosition |
|
7747 |
"return the current y position (thats where the next component |
|
7748 |
will be located)." |
|
7749 |
||
7750 |
^ yPosition |
|
120 | 7751 |
! |
7752 |
||
593 | 7753 |
yPosition:aNumber |
7754 |
"set the current y position (thats where the next component |
|
7755 |
will be located)." |
|
7756 |
||
7757 |
yPosition := aNumber. |
|
7758 |
needResize := true. |
|
7759 |
||
7760 |
" |
|
7761 |
|dialog pos| |
|
7762 |
||
7763 |
dialog := DialogBox new. |
|
7764 |
pos := dialog yPosition. |
|
7765 |
(dialog addTextLabel:'label1') width:0.5. |
|
7766 |
dialog yPosition:pos. |
|
7767 |
(dialog addTextLabel:'label2') width:0.5; left:0.5. |
|
7768 |
||
7769 |
dialog addOkButton. |
|
7770 |
dialog open. |
|
7771 |
" |
|
7772 |
||
7773 |
" |
|
7774 |
|dialog pos| |
|
7775 |
||
7776 |
dialog := DialogBox new. |
|
7777 |
pos := dialog yPosition. |
|
7778 |
#('one' 'two' 'three' 'four') |
|
7779 |
with:#(0.0 0.25 0.5 0.75) do:[:lbl :x | |
|
1401 | 7780 |
dialog yPosition:pos. |
7781 |
(dialog addComponent:(Button label:lbl) tabable:true) |
|
7782 |
width:0.25; left:x. |
|
593 | 7783 |
]. |
7784 |
||
7785 |
dialog addOkButton. |
|
7786 |
dialog open. |
|
7787 |
" |
|
7788 |
||
7789 |
"Modified: 9.2.1996 / 21:46:40 / cg" |
|
7790 |
! ! |
|
7791 |
||
7792 |
!DialogBox methodsFor:'construction-lists'! |
|
7793 |
||
2116 | 7794 |
addList:listHolder lines:nLines validation:validateionBlock |
7795 |
^ self |
|
7796 |
addListBoxOn:listHolder |
|
7797 |
withNumberOfLines:nLines |
|
7798 |
hScrollable:true |
|
7799 |
vScrollable:true |
|
7800 |
||
7801 |
"Created: / 4.2.2000 / 00:04:49 / cg" |
|
7802 |
"Modified: / 4.2.2000 / 00:06:06 / cg" |
|
7803 |
! |
|
7804 |
||
593 | 7805 |
addListBoxOn:aModel |
7806 |
"add a selectionInListView to the box. |
|
7807 |
The listViews ScrollWrapper is returned" |
|
7808 |
||
7809 |
^ self |
|
1401 | 7810 |
addListBoxOn:aModel |
7811 |
withNumberOfLines:nil |
|
7812 |
hScrollable:false |
|
7813 |
vScrollable:true. |
|
593 | 7814 |
|
7815 |
" |
|
7816 |
|dialog model listView| |
|
7817 |
||
7818 |
model := SelectionInList new. |
|
7819 |
model list:#('one' 'two' 'three' 'four'). |
|
7820 |
model selectionIndex:2. |
|
7821 |
||
7822 |
dialog := DialogBox new. |
|
7823 |
(dialog addTextLabel:'select any') adjust:#left. |
|
7824 |
||
7825 |
listView := dialog addListBoxOn:model. |
|
7826 |
||
7827 |
dialog addAbortButton; addOkButton. |
|
7828 |
dialog open. |
|
7829 |
||
655 | 7830 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 7831 |
" |
7832 |
||
7833 |
"Modified: 27.4.1996 / 18:27:58 / cg" |
|
7834 |
! |
|
7835 |
||
7836 |
addListBoxOn:aModel class:aListViewClass |
|
7837 |
"create & add an instance of aListViewClass to the box. |
|
7838 |
The listViews ScrollWrapper is returned" |
|
7839 |
||
7840 |
^ self |
|
1401 | 7841 |
addListBoxOn:aModel |
7842 |
class:aListViewClass |
|
7843 |
withNumberOfLines:nil |
|
7844 |
hScrollable:false |
|
7845 |
vScrollable:true. |
|
593 | 7846 |
|
7847 |
"Created: 19.4.1996 / 13:06:14 / cg" |
|
7848 |
"Modified: 27.4.1996 / 18:27:53 / cg" |
|
7849 |
! |
|
7850 |
||
7851 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines |
|
7852 |
"create and add an instance of aListViewClass to the box. |
|
7853 |
The list has numLines (if nonNil) number of lines shown. |
|
7854 |
The listViews ScrollWrapper is returned" |
|
7855 |
||
7856 |
^ self |
|
1401 | 7857 |
addListBoxOn:aModel |
7858 |
class:aListViewClass |
|
7859 |
withNumberOfLines:numLines |
|
7860 |
hScrollable:false |
|
7861 |
vScrollable:true. |
|
593 | 7862 |
|
7863 |
"Created: 19.4.1996 / 13:05:05 / cg" |
|
7864 |
"Modified: 27.4.1996 / 18:27:48 / cg" |
|
7865 |
! |
|
7866 |
||
7867 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
766 | 7868 |
"add an instance of aListViewClass (selectionInListView) to the box. |
593 | 7869 |
The list has numLines (if nonNil) number of lines shown. |
7870 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
7871 |
||
766 | 7872 |
|l| |
7873 |
||
7874 |
l := self addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs. |
|
3812
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7875 |
(aListViewClass canUnderstand:#doubleClickAction:) ifTrue:[ |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7876 |
l doubleClickAction:[:name | self okPressed]. |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7877 |
]. |
766 | 7878 |
^ l |
593 | 7879 |
|
7880 |
" |
|
7881 |
|dialog listView| |
|
7882 |
||
7883 |
dialog := DialogBox new. |
|
7884 |
(dialog addTextLabel:'select any') adjust:#left. |
|
7885 |
||
7886 |
listView := dialog |
|
3812
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7887 |
addListBoxOn:nil |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7888 |
class:FileSelectionList |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7889 |
withNumberOfLines:10 |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7890 |
hScrollable:false |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
7891 |
vScrollable:false. |
593 | 7892 |
|
7893 |
listView directory:'/etc'. |
|
7894 |
||
7895 |
dialog addAbortButton; addOkButton. |
|
7896 |
dialog open. |
|
7897 |
||
655 | 7898 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue]. |
593 | 7899 |
" |
7900 |
||
7901 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
7902 |
"Modified: 27.4.1996 / 18:26:15 / cg" |
|
766 | 7903 |
"Modified: 15.6.1996 / 00:31:20 / stefan" |
593 | 7904 |
! |
7905 |
||
7906 |
addListBoxOn:aModel withNumberOfLines:numLines |
|
7907 |
"add a selectionInListView to the box. |
|
7908 |
The list has numLines (if nonNil) number of lines shown. |
|
7909 |
The listViews ScrollWrapper is returned" |
|
7910 |
||
7911 |
^ self |
|
1401 | 7912 |
addListBoxOn:aModel |
7913 |
withNumberOfLines:numLines |
|
7914 |
hScrollable:false |
|
7915 |
vScrollable:true. |
|
593 | 7916 |
|
7917 |
" |
|
7918 |
|dialog model listView| |
|
7919 |
||
7920 |
model := SelectionInList new. |
|
7921 |
model list:#('one' 'two' 'three' 'four'). |
|
7922 |
model selectionIndex:2. |
|
7923 |
||
7924 |
dialog := DialogBox new. |
|
7925 |
(dialog addTextLabel:'select any') adjust:#left. |
|
7926 |
||
7927 |
listView := dialog addListBoxOn:model withNumberOfLines:3. |
|
7928 |
||
7929 |
dialog addAbortButton; addOkButton. |
|
7930 |
dialog open. |
|
7931 |
||
655 | 7932 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 7933 |
" |
7934 |
||
7935 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
7936 |
"Modified: 27.4.1996 / 18:27:42 / cg" |
|
7937 |
! |
|
7938 |
||
7939 |
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
7940 |
"add a selectionInListView to the box. |
|
7941 |
The list has numLines (if nonNil) number of lines shown. |
|
7942 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
7943 |
||
7944 |
^ self |
|
1401 | 7945 |
addListBoxOn:aModel |
7946 |
class:SelectionInListView |
|
7947 |
withNumberOfLines:numLines |
|
7948 |
hScrollable:hs |
|
7949 |
vScrollable:vs |
|
593 | 7950 |
|
7951 |
" |
|
7952 |
|dialog model listView| |
|
7953 |
||
7954 |
model := SelectionInList new. |
|
7955 |
model list:#('one' 'two' 'three' 'four'). |
|
7956 |
model selectionIndex:2. |
|
7957 |
||
7958 |
dialog := DialogBox new. |
|
7959 |
(dialog addTextLabel:'select any') adjust:#left. |
|
7960 |
||
7961 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true. |
|
7962 |
||
7963 |
dialog addAbortButton; addOkButton. |
|
7964 |
dialog open. |
|
7965 |
||
655 | 7966 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 7967 |
" |
7968 |
||
7969 |
" |
|
7970 |
|dialog model listView| |
|
7971 |
||
7972 |
model := SelectionInList new. |
|
7973 |
model list:#('one' 'two' 'three' 'four'). |
|
7974 |
model selectionIndex:2. |
|
7975 |
||
7976 |
dialog := DialogBox new. |
|
7977 |
(dialog addTextLabel:'select any') adjust:#left. |
|
7978 |
||
7979 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false. |
|
7980 |
||
7981 |
dialog addAbortButton; addOkButton. |
|
7982 |
dialog open. |
|
7983 |
||
655 | 7984 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 7985 |
" |
7986 |
||
7987 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
7988 |
"Modified: 27.4.1996 / 18:26:36 / cg" |
|
7989 |
! |
|
7990 |
||
7991 |
addPopUpList:labelString on:aModel |
|
7992 |
"create a popUpList with a label on aModel and add it. |
|
7993 |
Returns the box." |
|
7994 |
||
7995 |
^ self addPopUpList:labelString on:aModel tabable:true |
|
7996 |
! |
|
7997 |
||
7998 |
addPopUpList:labelString on:aModel tabable:tabable |
|
7999 |
"create a popUpList on aModel and add it. |
|
8000 |
Returns the popUpList." |
|
8001 |
||
8002 |
|p box l| |
|
8003 |
||
8004 |
p := PopUpList on:aModel. |
|
8005 |
p resize; sizeFixed:true. |
|
8006 |
labelString notNil ifTrue:[ |
|
1401 | 8007 |
box := HorizontalPanelView new. |
8008 |
box borderWidth:0; horizontalLayout:#rightSpace. |
|
8009 |
box add:(l := Label label:labelString). |
|
8010 |
l borderWidth:0. |
|
8011 |
box add:p. |
|
593 | 8012 |
] ifFalse:[ |
1401 | 8013 |
box := p. |
593 | 8014 |
]. |
8015 |
self addComponent:box tabable:tabable tabbedComponent:p. |
|
8016 |
^ p |
|
735
2552463a8f34
place popUp at right (without extra space)
Claus Gittinger <cg@exept.de>
parents:
719
diff
changeset
|
8017 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8018 |
"Modified: 31.5.1996 / 21:25:17 / cg" |
593 | 8019 |
! |
8020 |
||
8021 |
addPopUpListOn:aModel |
|
8022 |
"create a popUpList on aModel and add it. |
|
8023 |
Returns the box." |
|
8024 |
||
8025 |
^ self addPopUpList:nil on:aModel tabable:true |
|
8026 |
! |
|
8027 |
||
8028 |
addPopUpListOn:aModel tabable:tabable |
|
8029 |
"create a popUpList on aModel and add it. |
|
8030 |
Returns the popUpList." |
|
8031 |
||
8032 |
^ self addPopUpList:nil on:aModel tabable:tabable |
|
766 | 8033 |
! |
8034 |
||
8035 |
addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
8036 |
"add an instance of aListViewClass to the box. |
|
8037 |
The list has numLines (if nonNil) number of lines shown. |
|
8038 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
8039 |
||
8040 |
|l scr h dH| |
|
8041 |
||
8042 |
l := aListViewClass new. |
|
8043 |
l model:aModel. |
|
8044 |
||
877 | 8045 |
(vs or:[hs]) ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8046 |
hs ifTrue:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8047 |
scr := HVScrollableView forView:l miniScrollerH:true . |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8048 |
] ifFalse:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8049 |
scr := ScrollableView forView:l |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8050 |
]. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8051 |
scr resize. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8052 |
"/ Transcript show:scr height; show:' '; showCR:l height. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8053 |
dH := scr height - l height. |
766 | 8054 |
] ifFalse:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8055 |
l level:-1. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8056 |
scr := l. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8057 |
dH := 0. |
766 | 8058 |
]. |
8059 |
||
8060 |
numLines notNil ifTrue:[ |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8061 |
h := l heightForLines:numLines. |
766 | 8062 |
] ifFalse:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8063 |
h := l preferredHeight |
766 | 8064 |
]. |
8065 |
self addComponent:scr withHeight:(h + dH). |
|
8066 |
^ scr |
|
8067 |
||
8068 |
" |
|
8069 |
|dialog listView| |
|
8070 |
||
8071 |
dialog := DialogBox new. |
|
8072 |
(dialog addTextLabel:'select any') adjust:#left. |
|
8073 |
||
8074 |
listView := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8075 |
addTextBoxOn:nil |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8076 |
class:EditTextView |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8077 |
withNumberOfLines:10 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8078 |
hScrollable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8079 |
vScrollable:true. |
766 | 8080 |
|
8081 |
||
8082 |
dialog addAbortButton; addOkButton. |
|
8083 |
dialog open. |
|
8084 |
||
8085 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView contents]. |
|
8086 |
" |
|
8087 |
||
8088 |
"Created: 14.6.1996 / 23:33:47 / stefan" |
|
877 | 8089 |
"Modified: 8.11.1996 / 15:31:15 / cg" |
593 | 8090 |
! ! |
8091 |
||
8092 |
!DialogBox methodsFor:'construction-rows & columns'! |
|
8093 |
||
130 | 8094 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock |
8095 |
"add some elements in a vertical column. |
|
8096 |
Equally space elements as returned from aBlock." |
|
8097 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8098 |
self |
1401 | 8099 |
addColumn:aRow |
8100 |
fromX:leftX toX:rightX |
|
8101 |
collect:aBlock |
|
8102 |
tabable:false |
|
130 | 8103 |
|
8104 |
" |
|
8105 |
|dialog| |
|
8106 |
||
8107 |
dialog := Dialog new. |
|
8108 |
dialog |
|
1401 | 8109 |
addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5') |
8110 |
fromX:0.0 |
|
8111 |
toX:1.0 |
|
8112 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8113 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8114 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8115 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8116 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8117 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8118 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8119 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8120 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8121 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8122 |
dialog |
1401 | 8123 |
addColumn:#('label1' 'label2' 'label3' 'label4' 'label5') |
8124 |
fromX:0.25 |
|
8125 |
toX:0.75 |
|
8126 |
collect:[:label | (Label label:label) adjust:#left]. |
|
130 | 8127 |
|
8128 |
dialog addOkButton. |
|
8129 |
dialog open. |
|
8130 |
" |
|
8131 |
||
8132 |
" |
|
8133 |
|dialog y| |
|
8134 |
||
8135 |
dialog := Dialog new. |
|
8136 |
y := dialog yPosition. |
|
8137 |
dialog |
|
1401 | 8138 |
addColumn:#('a1' 'b1' 'c1' 'd1') |
8139 |
fromX:0 |
|
8140 |
toX:(1/3) |
|
8141 |
collect:[:label | Label label:label]. |
|
130 | 8142 |
|
8143 |
dialog yPosition:y. |
|
8144 |
dialog |
|
1401 | 8145 |
addColumn:#('a2' 'b2' 'c2' 'd2') |
8146 |
fromX:(1/3) |
|
8147 |
toX:(2/3) |
|
8148 |
collect:[:label | Label label:label]. |
|
130 | 8149 |
|
8150 |
dialog yPosition:y. |
|
8151 |
dialog |
|
1401 | 8152 |
addColumn:#('a3' 'b3' 'c3' 'd3') |
8153 |
fromX:(2/3) |
|
8154 |
toX:1 |
|
8155 |
collect:[:label | Label label:label]. |
|
130 | 8156 |
|
8157 |
dialog addOkButton. |
|
8158 |
dialog open. |
|
8159 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8160 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8161 |
"Modified: 9.2.1996 / 22:22:12 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8162 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8163 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8164 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8165 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8166 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8167 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8168 |
self |
1401 | 8169 |
addColumn:aRow |
8170 |
fromX:leftX toX:rightX |
|
8171 |
collect:aBlock |
|
8172 |
tabable:tabable |
|
8173 |
horizontalLayout:#fitSpace |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8174 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8175 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8176 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8177 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8178 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8179 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8180 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8181 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8182 |
dialog |
1401 | 8183 |
addColumn:#('one' 'two' 'three' 'four') |
8184 |
fromX:0 |
|
8185 |
toX:0.3 |
|
8186 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8187 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8188 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8189 |
dialog |
1401 | 8190 |
addColumn:values |
8191 |
fromX:0.3 |
|
8192 |
toX:1.0 |
|
8193 |
collect:[:value | EditField on:value] |
|
8194 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8195 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8196 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8197 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8198 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8199 |
dialog accepted ifTrue:[ |
1401 | 8200 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8201 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8202 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8203 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8204 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8205 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8206 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8207 |
values := #(true true false false false true false true) collect:[:val | val asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8208 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8209 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8210 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8211 |
dialog |
1401 | 8212 |
addColumn:(1 to:4) |
8213 |
fromX:0 |
|
8214 |
toX:0.5 |
|
8215 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
8216 |
tabable:true |
|
8217 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8218 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8219 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8220 |
dialog |
1401 | 8221 |
addColumn:(5 to:8) |
8222 |
fromX:0.5 |
|
8223 |
toX:1.0 |
|
8224 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
8225 |
tabable:true |
|
8226 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8227 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8228 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8229 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8230 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8231 |
dialog accepted ifTrue:[ |
1401 | 8232 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8233 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8234 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8235 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8236 |
"Created: 9.2.1996 / 21:51:47 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8237 |
"Modified: 9.2.1996 / 22:22:02 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8238 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8239 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8240 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8241 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8242 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8243 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8244 |
|helper component| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8245 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8246 |
helper := VerticalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8247 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8248 |
aRow do:[:el | |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8249 |
component := aBlock value:el. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8250 |
helper add:component. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8251 |
component resize. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8252 |
tabable ifTrue:[self makeTabable:component]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8253 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8254 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8255 |
helper resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8256 |
self addComponent:helper. |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8257 |
width < helper preferredWidth ifTrue:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8258 |
self width:helper preferredWidth. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8259 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8260 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8261 |
helper horizontalLayout:hLayout. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8262 |
helper left:leftX asFloat; |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8263 |
right:rightX asFloat; |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8264 |
leftInset:leftIndent; |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8265 |
rightInset:rightIndent. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8266 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8267 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8268 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8269 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8270 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8271 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8272 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8273 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8274 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8275 |
addColumn:#('one' 'two' 'three' 'four') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8276 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8277 |
toX:0.3 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8278 |
collect:[:label | Label label:label]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8279 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8280 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8281 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8282 |
addColumn:values |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8283 |
fromX:0.3 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8284 |
toX:1.0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8285 |
collect:[:value | EditField on:value] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8286 |
tabable:true. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8287 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8288 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8289 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8290 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8291 |
dialog accepted ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8292 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8293 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8294 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8295 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8296 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8297 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8298 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8299 |
values := #(true true false false false true false true) collect:[:val | val asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8300 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8301 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8302 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8303 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8304 |
addColumn:(1 to:4) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8305 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8306 |
toX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8307 |
collect:[:idx | CheckToggle on:(values at:idx)]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8308 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8309 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8310 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8311 |
addColumn:(5 to:8) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8312 |
fromX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8313 |
toX:1.0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8314 |
collect:[:idx | CheckToggle on:(values at:idx)] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8315 |
tabable:true. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8316 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8317 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8318 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8319 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8320 |
dialog accepted ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8321 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8322 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8323 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8324 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8325 |
"Modified: 9.2.1996 / 22:02:22 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8326 |
"Created: 9.2.1996 / 22:20:31 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8327 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8328 |
|
130 | 8329 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock |
8330 |
"add some elements in a horizontal row. |
|
8331 |
Equally space elements as returned from aBlock. |
|
8332 |
Advance y." |
|
8333 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8334 |
self |
1401 | 8335 |
addRow:aCol |
8336 |
fromX:leftX toX:rightX |
|
8337 |
collect:aBlock |
|
8338 |
tabable:true |
|
8339 |
horizontalLayout:#spread |
|
130 | 8340 |
|
8341 |
" |
|
8342 |
|dialog| |
|
8343 |
||
8344 |
dialog := Dialog new. |
|
8345 |
dialog |
|
1401 | 8346 |
addRow:#('a' 'b' 'c' 'd') |
8347 |
fromX:0 |
|
8348 |
toX:1 |
|
8349 |
collect:[:label | Label label:label]. |
|
130 | 8350 |
|
8351 |
dialog addOkButton. |
|
8352 |
dialog open. |
|
8353 |
" |
|
8354 |
||
8355 |
" |
|
8356 |
|dialog| |
|
8357 |
||
8358 |
dialog := Dialog new. |
|
8359 |
dialog |
|
1401 | 8360 |
addRow:#('a1' 'b1' 'c1' 'd1') |
8361 |
fromX:0 |
|
8362 |
toX:1 |
|
8363 |
collect:[:label | Label label:label]. |
|
130 | 8364 |
|
8365 |
dialog |
|
1401 | 8366 |
addRow:#('a2' 'b2' 'c2' 'd2') |
8367 |
fromX:0 |
|
8368 |
toX:0.5 |
|
8369 |
collect:[:label | Label label:label]. |
|
130 | 8370 |
|
8371 |
dialog |
|
1401 | 8372 |
addRow:#('a3' 'b3' 'c3' 'd3') |
8373 |
fromX:0.5 |
|
8374 |
toX:1 |
|
8375 |
collect:[:label | Label label:label]. |
|
130 | 8376 |
|
8377 |
dialog addOkButton. |
|
8378 |
dialog open. |
|
8379 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8380 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8381 |
"Modified: 9.2.1996 / 22:25:16 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8382 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8383 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8384 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8385 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8386 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8387 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8388 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8389 |
self |
1401 | 8390 |
addRow:aCol |
8391 |
fromX:leftX toX:rightX |
|
8392 |
collect:aBlock |
|
8393 |
tabable:tabable |
|
8394 |
horizontalLayout:#spread |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8395 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8396 |
"Created: 9.2.1996 / 22:25:35 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8397 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8398 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8399 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8400 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8401 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8402 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8403 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8404 |
^ self |
1401 | 8405 |
addRow:aCol |
8406 |
fromX:leftX toX:rightX |
|
8407 |
collect:aBlock |
|
8408 |
tabable:tabable |
|
8409 |
horizontalLayout:hLayout |
|
8410 |
verticalLayout:#fit |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8411 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8412 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8413 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8414 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8415 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8416 |
dialog |
1401 | 8417 |
addRow:#('a' 'b' 'c' 'd') |
8418 |
fromX:0 |
|
8419 |
toX:1 |
|
8420 |
collect:[:label | Label label:label] |
|
8421 |
tabable:false |
|
8422 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8423 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8424 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8425 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8426 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8427 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8428 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8429 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8430 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8431 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8432 |
dialog |
1401 | 8433 |
addRow:#('one' 'two' 'three' 'four') |
8434 |
fromX:0 |
|
8435 |
toX:1 |
|
8436 |
collect:[:label | Button label:label] |
|
8437 |
tabable:false |
|
8438 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8439 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8440 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8441 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8442 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8443 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8444 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8445 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8446 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8447 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8448 |
dialog |
1401 | 8449 |
addRow:#('a1' 'b1' 'c1' 'd1') |
8450 |
fromX:0 |
|
8451 |
toX:1 |
|
8452 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8453 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8454 |
dialog |
1401 | 8455 |
addRow:#('a2' 'b2' 'c2' 'd2') |
8456 |
fromX:0 |
|
8457 |
toX:0.5 |
|
8458 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8459 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8460 |
dialog |
1401 | 8461 |
addRow:#('a3' 'b3' 'c3' 'd3') |
8462 |
fromX:0.5 |
|
8463 |
toX:1 |
|
8464 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8465 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8466 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8467 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8468 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8469 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8470 |
"Created: 9.2.1996 / 22:24:31 / cg" |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8471 |
"Modified: 31.5.1996 / 20:46:00 / cg" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8472 |
! |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8473 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8474 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable horizontalLayout:hLayout verticalLayout:vLayout |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8475 |
"add some elements in a horizontal row. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8476 |
Equally space elements as returned from aBlock. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8477 |
Advance y." |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8478 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8479 |
|helper component| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8480 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8481 |
helper := HorizontalPanelView new. |
792 | 8482 |
helper borderWidth:0. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8483 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8484 |
aCol do:[:el | |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8485 |
component := aBlock value:el. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8486 |
component resize. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8487 |
helper add:component. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8488 |
tabable ifTrue:[self makeTabable:component] |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8489 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8490 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8491 |
helper resize. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8492 |
self addComponent:helper. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8493 |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8494 |
width < helper preferredWidth ifTrue:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8495 |
self width:helper preferredWidth. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8496 |
"/ Transcript show:'w now: '; showCR:helper preferredWidth |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8497 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8498 |
hLayout notNil ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8499 |
helper horizontalLayout:hLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8500 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8501 |
vLayout notNil ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8502 |
helper verticalLayout:vLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8503 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8504 |
helper left:leftX asFloat; |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8505 |
right:rightX asFloat. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8506 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8507 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8508 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8509 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8510 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8511 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8512 |
addRow:#('a' 'b' 'c' 'd') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8513 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8514 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8515 |
collect:[:label | Label label:label] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8516 |
tabable:false |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8517 |
horizontalLayout:#fit. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8518 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8519 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8520 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8521 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8522 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8523 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8524 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8525 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8526 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8527 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8528 |
addRow:#('one' 'two' 'three' 'four') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8529 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8530 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8531 |
collect:[:label | Button label:label] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8532 |
tabable:false |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8533 |
horizontalLayout:#fit. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8534 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8535 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8536 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8537 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8538 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8539 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8540 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8541 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8542 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8543 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8544 |
addRow:#('a1' 'b1' 'c1' 'd1') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8545 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8546 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8547 |
collect:[:label | Label label:label]. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8548 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8549 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8550 |
addRow:#('a2' 'b2' 'c2' 'd2') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8551 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8552 |
toX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8553 |
collect:[:label | Label label:label]. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8554 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8555 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8556 |
addRow:#('a3' 'b3' 'c3' 'd3') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8557 |
fromX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8558 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8559 |
collect:[:label | Label label:label]. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8560 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8561 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8562 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8563 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8564 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8565 |
"Created: 31.5.1996 / 20:45:31 / cg" |
792 | 8566 |
"Modified: 17.7.1996 / 12:06:08 / cg" |
76 | 8567 |
! ! |
8568 |
||
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8569 |
!DialogBox methodsFor:'explicit focus control'! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8570 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8571 |
focusOnOk |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8572 |
windowGroup focusView:okButton |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8573 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8574 |
"Modified: 19.4.1996 / 16:57:58 / cg" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8575 |
! ! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8576 |
|
76 | 8577 |
!DialogBox methodsFor:'initialization'! |
8578 |
||
8579 |
initialize |
|
8580 |
super initialize. |
|
8581 |
||
573 | 8582 |
"/ label := 'Dialog'. |
948 | 8583 |
acceptValue := ValueHolder newBoolean. |
76 | 8584 |
|
8585 |
acceptReturnAsOK := true. |
|
125 | 8586 |
acceptOnLeave := true. |
1757 | 8587 |
focusToOKOnLeave := DefaultFocusToOKOnLeave. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8588 |
hideOnAccept := true. |
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
8589 |
autoAccept := true. |
76 | 8590 |
|
8591 |
buttonPanel := HorizontalPanelView in:self. |
|
118 | 8592 |
buttonPanel |
1757 | 8593 |
origin:(0.0 @ 1.0) corner:(1.0 @ 1.0); |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8594 |
bottomInset:ViewSpacing; |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8595 |
topInset:((font height + ViewSpacing) * 2) negated; |
1757 | 8596 |
borderWidth:0; |
8597 |
horizontalLayout:#spread. |
|
118 | 8598 |
|
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8599 |
"/ some viewStyles want ok to be the leftMost button. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8600 |
buttonPanel reverseOrderIfOKAtLeft:true. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8601 |
|
122 | 8602 |
yPosition := ViewSpacing. |
312
008267b920d9
allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
8603 |
leftIndent := rightIndent := (ViewSpacing // 2). |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8604 |
needResize := true. |
76 | 8605 |
|
8606 |
" |
|
8607 |
|b| |
|
8608 |
b := DialogBox new. |
|
118 | 8609 |
b addAbortButton; |
8610 |
addOkButton; |
|
8611 |
showAtPointer |
|
76 | 8612 |
" |
8613 |
" |
|
8614 |
|b| |
|
8615 |
b := DialogBox new. |
|
118 | 8616 |
b addOkButton; |
8617 |
showAtPointer |
|
8618 |
" |
|
76 | 8619 |
" |
118 | 8620 |
|b| |
8621 |
b := DialogBox new. |
|
8622 |
b addTextLabel:'hello world'; |
|
8623 |
addOkButton; |
|
8624 |
showAtPointer |
|
8625 |
" |
|
8626 |
" |
|
8627 |
|b| |
|
8628 |
b := DialogBox new. |
|
8629 |
b addTextLabel:'hello world'; |
|
8630 |
addVerticalSpace:50; |
|
8631 |
addOkButton; |
|
8632 |
showAtPointer |
|
8633 |
" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8634 |
|
1614 | 8635 |
"Modified: / 23.12.1997 / 10:05:24 / md" |
8636 |
"Modified: / 27.7.1998 / 20:16:37 / cg" |
|
76 | 8637 |
! |
8638 |
||
8639 |
reAdjustGeometry |
|
8640 |
"sent late in snapin processing - gives me a chance |
|
8641 |
to resize for changed font dimensions." |
|
8642 |
||
8643 |
super reAdjustGeometry. |
|
8644 |
okButton notNil ifTrue:[okButton resize]. |
|
8645 |
abortButton notNil ifTrue:[abortButton resize]. |
|
8646 |
self resize |
|
8647 |
! ! |
|
8648 |
||
197 | 8649 |
!DialogBox methodsFor:'private'! |
8650 |
||
8651 |
basicAddComponent:aComponent |
|
8652 |
"add a component, dont change its size" |
|
8653 |
||
8654 |
addedComponents isNil ifTrue:[ |
|
2126 | 8655 |
addedComponents := OrderedCollection new. |
197 | 8656 |
]. |
8657 |
addedComponents add:aComponent. |
|
8658 |
self addSubView:aComponent. |
|
3932
fa0f5fcfc64b
changed: #basicAddComponent:
Claus Gittinger <cg@exept.de>
parents:
3908
diff
changeset
|
8659 |
|
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8660 |
needResize := true. |
3932
fa0f5fcfc64b
changed: #basicAddComponent:
Claus Gittinger <cg@exept.de>
parents:
3908
diff
changeset
|
8661 |
"/ must flush any cached preferredExtent, when a component is added (for example, in an aboutToOpen callBack) |
fa0f5fcfc64b
changed: #basicAddComponent:
Claus Gittinger <cg@exept.de>
parents:
3908
diff
changeset
|
8662 |
preferredExtent := nil. |
197 | 8663 |
! |
8664 |
||
8665 |
hideAndEvaluate:aBlock |
|
8666 |
"if I am modal, make myself invisible and evaluate aBlock. |
|
8667 |
If nonModal, stay up, but also evaluate the block." |
|
8668 |
||
8669 |
(windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
|
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8670 |
self hide. |
197 | 8671 |
]. |
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8672 |
aBlock notNil ifTrue:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8673 |
aBlock numArgs == 0 ifTrue:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8674 |
aBlock value |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8675 |
] ifFalse:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8676 |
aBlock value:(self actionArgument) |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8677 |
] |
2673
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
8678 |
]. |
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
8679 |
|
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
8680 |
(windowGroup isNil or:[windowGroup isModal not]) ifTrue:[ |
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
8681 |
self destroy. |
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
8682 |
]. |
197 | 8683 |
|
8684 |
"Modified: 5.9.1995 / 19:06:33 / claus" |
|
8685 |
! |
|
8686 |
||
2116 | 8687 |
preOpen |
8688 |
||
8689 |
"Created: / 4.2.2000 / 00:10:48 / cg" |
|
8690 |
! |
|
8691 |
||
197 | 8692 |
realize |
8693 |
"if any inputFields where added, activate the first one" |
|
8694 |
||
3944
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
8695 |
verticalPanel notNil ifTrue:[ |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
8696 |
verticalPanel extent:verticalPanel preferredExtent. |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
8697 |
preferredExtent := nil. |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
8698 |
self extent:(self preferredExtent). |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
8699 |
]. |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
8700 |
|
1877
a46bf520f9c6
realize first, then assign focus
Claus Gittinger <cg@exept.de>
parents:
1843
diff
changeset
|
8701 |
super realize. |
3467 | 8702 |
|
8703 |
buttonPanel notNil ifTrue:[ |
|
8704 |
buttonPanel subViews do:[:eachButton | |
|
8705 |
eachButton canTab:true. |
|
8706 |
] |
|
8707 |
]. |
|
8708 |
||
197 | 8709 |
inputFieldGroup notNil ifTrue:[ |
1646 | 8710 |
inputFieldGroup activateFirstIfNoCurrent |
197 | 8711 |
]. |
1646 | 8712 |
|
8713 |
"Modified: / 13.8.1998 / 21:22:40 / cg" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8714 |
! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8715 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8716 |
resize |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8717 |
needResize ifTrue:[ |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8718 |
"/ verticalPanel notNil ifTrue:[ |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8719 |
"/ verticalPanel extent:verticalPanel preferredExtent. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8720 |
"/ preferredExtent := nil. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8721 |
"/ self extent:(self preferredExtent). |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8722 |
"/ ]. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8723 |
needResize := false. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8724 |
super resize |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8725 |
] |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8726 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8727 |
"Created: 27.1.1996 / 17:22:33 / cg" |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8728 |
"Modified: 27.1.1996 / 18:25:40 / cg" |
197 | 8729 |
! ! |
8730 |
||
120 | 8731 |
!DialogBox methodsFor:'queries'! |
118 | 8732 |
|
121 | 8733 |
accepted |
128 | 8734 |
"after the box has closed: |
8735 |
return true if accepted, false if canceled" |
|
125 | 8736 |
|
128 | 8737 |
^ acceptValue value |
121 | 8738 |
! |
8739 |
||
2116 | 8740 |
interfaceSpecFor:aSelector |
8741 |
"return an interface spec. |
|
8742 |
Notice - Dialog should be moved under AppModel so this becomes obsolete." |
|
8743 |
||
2379
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
8744 |
^ UISpecification from:(self specificationFor:aSelector) |
2116 | 8745 |
! |
8746 |
||
2803
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8747 |
maxPreferredWidthOfAddedComponents |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8748 |
"helper for computing my preferred extent. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8749 |
That is the max component width" |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8750 |
|
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8751 |
^ (addedComponents ? #()) |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8752 |
inject:0 |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8753 |
into:[:max :element | |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8754 |
|eExt prefWidth scale rel relX| |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8755 |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
8756 |
prefWidth := element preferredWidth. |
2803
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8757 |
|
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8758 |
"/ special (for your convenience) |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8759 |
"/ if the element has been added with a relative width, |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8760 |
"/ scale it to get at least its preferred width |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8761 |
|
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8762 |
(rel := element relativeExtent) notNil ifTrue:[ |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8763 |
relX := rel x. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8764 |
(relX isNil or:[relX isInteger]) ifFalse:[ |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8765 |
prefWidth := (prefWidth * (1 / relX)) rounded |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8766 |
]. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8767 |
]. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8768 |
eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8769 |
max max:(eExt + element leftInset + element rightInset)]. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8770 |
! |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8771 |
|
120 | 8772 |
positionOffset |
8773 |
"return the delta, by which the box should be displayed |
|
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8774 |
from the mouse pointer. Here, an offset is returned, which |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8775 |
makes the center of the first return-Button in the panel |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8776 |
appear under the cursor. If there is no such button, |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8777 |
use my superclasses offset." |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8778 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8779 |
|idx butt buttons| |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8780 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8781 |
buttonPanel notNil ifTrue:[ |
2332 | 8782 |
buttons := buttonPanel subViews. |
8783 |
buttons size > 0 ifTrue:[ |
|
2732
9a96cfc123c0
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
2718
diff
changeset
|
8784 |
idx := buttons findFirst:[:b | b isDefault]. |
2332 | 8785 |
idx ~~ 0 ifTrue:[ |
8786 |
butt := buttons at:idx. |
|
8787 |
||
8788 |
"get our size (preferredExtent) and compute |
|
8789 |
origin and extent of buttonPanel and okButton. |
|
8790 |
This is normally done on view realization." |
|
8791 |
||
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8792 |
needResize ifTrue:[ self resize ]. |
2332 | 8793 |
buttonPanel |
8794 |
pixelOrigin:buttonPanel computeOrigin |
|
8795 |
extent:buttonPanel computeExtent. |
|
8796 |
buttonPanel setChildPositionsIfChanged. |
|
2732
9a96cfc123c0
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
2718
diff
changeset
|
8797 |
^ (butt originRelativeTo:self) + (butt extent // 2). |
2332 | 8798 |
] |
8799 |
] |
|
118 | 8800 |
]. |
913 | 8801 |
|
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8802 |
^ super positionOffset |
912
310c4970e613
Fix #positionOffset to show 'senders' box with cursor on ok-button.
Stefan Vogel <sv@exept.de>
parents:
884
diff
changeset
|
8803 |
|
913 | 8804 |
"Modified: 3.1.1997 / 10:41:58 / stefan" |
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
8805 |
"Modified: 16.1.1997 / 22:00:23 / cg" |
118 | 8806 |
! |
8807 |
||
130 | 8808 |
preferredExtent |
132 | 8809 |
"return my preferred extent. |
8810 |
That is the max component width, or my current width (default); |
|
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8811 |
whichever is larger, by the sum of the component's heights." |
118 | 8812 |
|
120 | 8813 |
|w h p| |
118 | 8814 |
|
3756
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
8815 |
"/ If I have an explicit preferredExtent.. |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
8816 |
explicitExtent notNil ifTrue:[ |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
8817 |
^ explicitExtent |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
8818 |
]. |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
8819 |
|
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
8820 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
8821 |
preferredExtent notNil ifTrue:[ |
2801 | 8822 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
8823 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
8824 |
|
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8825 |
h := yPosition + ViewSpacing. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8826 |
verticalPanel notNil ifTrue:[ |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8827 |
"/ because the vertical panels size was not known until now, |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8828 |
"/ it was not counted in the y-position yet. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8829 |
"/ do this now. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8830 |
verticalPanel extent:(verticalPanel computePreferredExtent). |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8831 |
h := h + verticalPanel height. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8832 |
]. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8833 |
|
120 | 8834 |
addedComponents notNil ifTrue:[ |
2803
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
8835 |
w := self maxPreferredWidthOfAddedComponents. |
120 | 8836 |
] ifFalse:[ |
3618 | 8837 |
w := super preferredExtent x. |
120 | 8838 |
]. |
132 | 8839 |
w := w max:width. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8840 |
|
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8841 |
subViews size ~~ 0 ifTrue:[ |
2801 | 8842 |
p := buttonPanel preferredExtent. |
8843 |
w := w max:p x. |
|
8844 |
h := h |
|
8845 |
+ p y |
|
8846 |
+ ViewSpacing. |
|
120 | 8847 |
]. |
118 | 8848 |
|
120 | 8849 |
"/ okButton isNil ifTrue:[ |
130 | 8850 |
"/ ^ super preferredExtent |
120 | 8851 |
"/ ]. |
130 | 8852 |
"/ p := buttonPanel preferredExtent. |
120 | 8853 |
"/ w := p x. |
8854 |
"/ h := ViewSpacing |
|
8855 |
"/ + p y |
|
8856 |
"/ + ViewSpacing. |
|
8857 |
"/ |
|
8858 |
^ w @ h |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8859 |
|
797 | 8860 |
"Modified: 19.7.1996 / 20:43:52 / cg" |
2379
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
8861 |
! |
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
8862 |
|
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
8863 |
specificationFor:aKey |
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
8864 |
"return an interface specs literal encoding. |
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
8865 |
Notice - Dialog should be moved under AppModel so this becomes obsolete." |
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
8866 |
|
2568 | 8867 |
^ ApplicationModel |
8868 |
specificationFor:aKey |
|
8869 |
application:self |
|
8870 |
onDevice:(self graphicsDevice) |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8871 |
! ! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8872 |
|
197 | 8873 |
!DialogBox methodsFor:'user actions'! |
76 | 8874 |
|
197 | 8875 |
abortPressed |
8876 |
"sent by the cancel button; user pressed abort button |
|
8877 |
- hide myself and evaluate okAction" |
|
121 | 8878 |
|
197 | 8879 |
abortButton turnOffWithoutRedraw. |
8880 |
acceptValue value:false. |
|
121 | 8881 |
|
197 | 8882 |
"/ actually, only hides if I have been opened modal |
8883 |
self hideAndEvaluate:abortAction |
|
121 | 8884 |
! |
8885 |
||
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8886 |
actionArgument |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8887 |
^ nil |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8888 |
! |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
8889 |
|
2392
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8890 |
closeCancel |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8891 |
"closed via escape" |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8892 |
|
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8893 |
acceptValue value:false. |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8894 |
|
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8895 |
"/ actually, only hides if I have been opened modal |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8896 |
self hideAndEvaluate:abortAction |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8897 |
! |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8898 |
|
197 | 8899 |
doAccept |
8900 |
"let all components accept (i.e. update their model from the values), |
|
8901 |
then set my accept value to true. |
|
8902 |
This is confusing: this method was originally called #accept, |
|
8903 |
but renamed for compatibility with ST-80, where #accept returns the |
|
8904 |
accept-valueHolder (which looks like a bad name to me ...)." |
|
76 | 8905 |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
8906 |
autoAccept ifTrue:[ |
1401 | 8907 |
addedComponents notNil ifTrue:[ |
8908 |
addedComponents do:[:aComponent | |
|
8909 |
(aComponent respondsTo:#accept) ifTrue:[ |
|
8910 |
aComponent accept |
|
8911 |
] |
|
8912 |
] |
|
8913 |
]. |
|
197 | 8914 |
]. |
8915 |
acceptValue value:true. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
8916 |
|
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
8917 |
"Modified: 4.3.1996 / 12:14:56 / cg" |
128 | 8918 |
! |
8919 |
||
197 | 8920 |
keyPress:aKey x:x y:y |
2700 | 8921 |
"return-key duplicates ok-function if acceptReturnAsOK is true" |
76 | 8922 |
|
490 | 8923 |
<resource: #keyboard (#Return)> |
8924 |
||
2392
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8925 |
|b| |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
8926 |
|
3809 | 8927 |
"/ oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has |
8928 |
"/ no one to inform about RETURN/ESCAPE. So the procesing here is still needed. |
|
8929 |
||
3808
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8930 |
(aKey == #Return) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8931 |
(okButton notNil and:[okButton isReturnButton]) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8932 |
^ self okPressed |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8933 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8934 |
(abortButton notNil and:[abortButton isReturnButton]) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8935 |
^ self abortPressed |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8936 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8937 |
(buttonPanel notNil and:[(b := buttonPanel subViews detect:[:b | b isReturnButton] ifNone:nil) notNil]) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8938 |
b turnOnWithAction. b turnOffWithAction. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8939 |
^ self. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8940 |
] |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8941 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8942 |
|
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8943 |
(aKey == #Escape) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8944 |
(abortButton notNil) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8945 |
^ self abortPressed |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8946 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8947 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
8948 |
|
197 | 8949 |
super keyPress:aKey x:x y:y |
307
d3fe810390cb
changed cancel-value to '' (ST-80 compat.); added xxx:onCancel: methods; added more choose methods
Claus Gittinger <cg@exept.de>
parents:
302
diff
changeset
|
8950 |
|
490 | 8951 |
"Modified: 7.3.1996 / 13:15:09 / cg" |
76 | 8952 |
! |
8953 |
||
197 | 8954 |
lastFieldLeft |
8955 |
"if the dialog involves input fields, this is called |
|
8956 |
when the last field is left by Return-key or NextField-key" |
|
120 | 8957 |
|
197 | 8958 |
acceptOnLeave ifTrue:[ |
1401 | 8959 |
acceptReturnAsOK ifTrue:[ |
8960 |
focusToOKOnLeave ifTrue:[ |
|
8961 |
self focusOnOk. |
|
8962 |
^ self. |
|
8963 |
]. |
|
8964 |
self okPressed |
|
8965 |
] |
|
197 | 8966 |
]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8967 |
inputFieldGroup activateFirst |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
8968 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
8969 |
"Modified: 19.4.1996 / 17:09:02 / cg" |
76 | 8970 |
! |
8971 |
||
197 | 8972 |
okPressed |
8973 |
"sent by the okButton; user pressed ok-button |
|
8974 |
- make myself invisible and if an action was specified do it" |
|
128 | 8975 |
|
197 | 8976 |
okButton notNil ifTrue:[okButton turnOffWithoutRedraw]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8977 |
|
197 | 8978 |
self doAccept. |
8979 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8980 |
acceptCheck notNil ifTrue:[ |
302 | 8981 |
acceptCheck value ifFalse:[^ self] |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8982 |
]. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8983 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8984 |
hideOnAccept ifTrue:[ |
302 | 8985 |
"/ actually, only hides if I have been opened modal |
8986 |
self hideAndEvaluate:okAction. |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8987 |
] ifFalse:[ |
302 | 8988 |
okAction value |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
8989 |
] |
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
8990 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
8991 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
8992 |
openDialog |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
8993 |
self showAtPointer. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
8994 |
^ self accepted |
128 | 8995 |
! ! |
240 | 8996 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
8997 |
!DialogBox class methodsFor:'documentation'! |
240 | 8998 |
|
8999 |
version |
|
4058
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
9000 |
^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.291 2009-11-02 11:25:05 cg Exp $' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
9001 |
! |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
9002 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
9003 |
version_CVS |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
9004 |
^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.291 2009-11-02 11:25:05 cg Exp $' |
240 | 9005 |
! ! |
2618 | 9006 |
|
498 | 9007 |
DialogBox initialize! |