author | Claus Gittinger <cg@exept.de> |
Sat, 04 Mar 2017 10:25:26 +0100 | |
changeset 6115 | b2a6f6a08d2f |
parent 6080 | 185379fc3791 |
child 6188 | b9dea3816ae6 |
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 |
|
5242 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
76 | 16 |
ModalBox subclass:#DialogBox |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
17 |
instanceVariableNames:'buttonPanel okButton okAction abortButton abortAction |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
18 |
acceptReturnAsOK yPosition leftIndent rightIndent addedComponents |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
19 |
inputFieldGroup acceptOnLeave acceptValue tabableElements |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
20 |
hideOnAccept acceptCheck needResize autoAccept focusToOKOnLeave |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
21 |
bindings namedComponents verticalPanel' |
2439 | 22 |
classVariableNames:'DefaultFocusToOKOnLeave AboutToOpenBoxNotificationSignal' |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
23 |
poolDictionaries:'' |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
24 |
category:'Views-DialogBoxes' |
76 | 25 |
! |
26 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
27 |
!DialogBox class methodsFor:'documentation'! |
76 | 28 |
|
197 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
76 | 41 |
! |
42 |
||
43 |
documentation |
|
44 |
" |
|
45 |
this class implements the common behavior of dialogboxes. |
|
46 |
||
647 | 47 |
DialogBox is also a superclass of many other boxes - see InfoBox, |
76 | 48 |
WarningBox, YesNoBox etc. for concrete examples. |
49 |
Most of them simply add buttons or other elements. |
|
50 |
||
121 | 51 |
For programmatically created boxes, instances support adding of components |
52 |
in a top-to-bottom fashion, and also keep track of added text-fields and, |
|
53 |
since they are most common, automatically create an EnterFieldGroup for |
|
54 |
them. |
|
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
55 |
|
5883 | 56 |
Caveat: |
3935 | 57 |
more adding support is required - especially for row-wise construction. |
58 |
The programmatic interface is best suited for row-wise |
|
59 |
arranged components; laying out elements in columns is a bit |
|
60 |
complicate - for complicated dialogs, it may be better to not use |
|
61 |
the automatic arrangement, but instead give explicit layouts to |
|
62 |
the components (in a subclass) or better use the UIPainter. |
|
122 | 63 |
|
600 | 64 |
Compatibility note: |
5573 | 65 |
For ST-80 compatibility, DialogBox is also accessible under |
3935 | 66 |
the global named 'Dialog' (which is the name of an ST-80 class, |
67 |
providing a very similar protocol). |
|
68 |
This may lead to confusion, if DialogBox is recompiled - you have |
|
69 |
to manually assign Dialog again to refer to the new DialogBox class. |
|
70 |
In future versions of ST/X, DialogBox may be renamed to Dialog. |
|
600 | 71 |
|
183 | 72 |
Historic note: |
3935 | 73 |
originally, ST/X had separate classes for the various entry methods; |
74 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
75 |
ST-80 has all this defined in the common Dialog. |
|
5883 | 76 |
Therefore, for compatibility, many ST/X methods defined here in Dialogs |
3935 | 77 |
class protocol simply dispatch to some other boxes class method. |
78 |
In the future, those existing subclasses' functionality is going to |
|
79 |
be moved full into Dialog, and the subclasses will be replaced by dummy |
|
80 |
delegators. (They will be kept for backward compatibility, though). |
|
183 | 81 |
|
121 | 82 |
|
585 | 83 |
[instance variables:] |
76 | 84 |
|
3935 | 85 |
buttonPanel <PanelView> contains the button(s) |
86 |
||
87 |
okButton <Button> the ok-Button |
|
88 |
||
89 |
okAction <Block> the action to be performed when ok is pressed, |
|
90 |
or return is pressed. |
|
91 |
||
92 |
acceptReturnAsOK <Boolean> if true, pressing the return-key counts |
|
93 |
as if ok was pressed. Default is true. |
|
94 |
||
95 |
abortButton <Button> the cancel-Button |
|
96 |
||
97 |
abortAction <Block> the action to be performed when cancel is |
|
98 |
pressed. |
|
99 |
||
5883 | 100 |
yPosition <Integer> current y position when adding components |
3935 | 101 |
|
102 |
leftIndent <Integer> left inset to use when adding components |
|
103 |
||
104 |
rightIndent <Integer> right inset to use when adding components |
|
105 |
||
106 |
addedComponents <Collection> programmatically added components |
|
107 |
||
5883 | 108 |
inputFieldGroup <EnterFieldGroup> |
3935 | 109 |
for added input fields |
110 |
||
5883 | 111 |
acceptOnLeave <Boolean> if true (the default) and there are |
3935 | 112 |
tabable inputFields, accept and close when |
113 |
the last field is left. If false, the ok |
|
114 |
button must be pressed to close the box. |
|
115 |
||
116 |
acceptedValue v(<Boolean>) valueHolder on a boolean |
|
117 |
after close: holds true if box was accepted |
|
118 |
(i.e. ok-Button was pressed), false if box was |
|
119 |
closed via cancel or window manager. |
|
120 |
||
121 |
autoAccept Boolean if true, pressing ok (or return) |
|
122 |
sends #accept to all subcomponents. |
|
123 |
I.e. all subfields update their models |
|
124 |
first. The default is true. |
|
125 |
||
126 |
variablePanel nil|VPanel an optional additional panel to be filled dynamically |
|
127 |
in an aboutToOpenNotification hook. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
128 |
|
100 | 129 |
For compatibility with ST-80, this class is also available under |
130 |
the global names DialogView and Dialog (see patches file). |
|
585 | 131 |
|
132 |
[author:] |
|
3935 | 133 |
Claus Gittinger |
593 | 134 |
|
135 |
[see also:] |
|
3935 | 136 |
Button CheckToggle Toggle |
137 |
EditField SelectionInListView FileSelectionList |
|
138 |
FramedBox Separator |
|
139 |
( introduction to view programming :html: programming/viewintro.html ) |
|
76 | 140 |
" |
141 |
! |
|
142 |
||
143 |
examples |
|
144 |
" |
|
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
|
145 |
historically, DialogBox was used as an abstract class as a base for InfoBox, |
600 | 146 |
YesNoBox etc. |
147 |
However, the programmatic construction protocol (#addComponent:) |
|
148 |
now allows those classes to be easily replaced and future versions of |
|
149 |
ST/X may do this and make those subclasses obsolete. |
|
150 |
However, dummy stubs will remain to exist for backward compatibility |
|
151 |
(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
|
152 |
|
125 | 153 |
For most simple standard dialogs, there are ready to use |
154 |
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
|
155 |
|
125 | 156 |
For example: |
157 |
||
158 |
info & warnings: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
159 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
160 |
Dialog information:'hi there' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
161 |
[exEnd] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
162 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
163 |
Dialog warn:'oops' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
164 |
[exEnd] |
125 | 165 |
|
166 |
||
167 |
yes/no questions: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
168 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
169 |
(Dialog confirm:'is this simple ?') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
170 |
ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
171 |
Transcript showCR:'thats what I expected' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
172 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
173 |
Transcript showCR:'read more examples and documentation' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
174 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
175 |
[exEnd] |
125 | 176 |
|
177 |
||
178 |
yes/no question with cancel option: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
179 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
180 |
|answer| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
181 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
182 |
answer := Dialog confirmWithCancel:'is this simple ?'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
183 |
answer isNil ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
184 |
Transcript showCR:'no easy decision' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
185 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
186 |
answer ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
187 |
Transcript showCR:'thats what I expected' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
188 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
189 |
Transcript showCR:'read more examples and documentation' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
190 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
191 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
192 |
[exEnd] |
125 | 193 |
|
194 |
||
195 |
asking for a string: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
196 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
197 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
198 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
199 |
s := Dialog request:'enter your name, please:'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
200 |
s notEmpty ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
201 |
Transcript showCR:'you entered: ' , s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
202 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
203 |
[exEnd] |
125 | 204 |
|
205 |
||
206 |
asking for a string with given default: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
207 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
208 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
209 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
210 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
211 |
request:'enter your name, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
212 |
initialAnswer:(OperatingSystem getLoginName). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
213 |
s notEmpty ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
214 |
Transcript showCR:'you entered: ' , s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
215 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
216 |
[exEnd] |
125 | 217 |
|
218 |
||
219 |
asking for a filename: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
220 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
221 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
222 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
223 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
224 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
225 |
default:''. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
226 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
227 |
[exEnd] |
125 | 228 |
|
229 |
||
1030 | 230 |
with a namefiler pattern: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
231 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
232 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
233 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
234 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
235 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
236 |
default:'' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
237 |
pattern:'*.rc'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
238 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
239 |
[exEnd] |
1030 | 240 |
|
241 |
||
242 |
another namefiler pattern: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
243 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
244 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
245 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
246 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
247 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
248 |
default:'' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
249 |
pattern:'*.rc;*.st;*.h'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
250 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
251 |
[exEnd] |
1030 | 252 |
|
253 |
||
125 | 254 |
with changed button label and pattern: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
255 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
256 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
257 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
258 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
259 |
requestFileName:'select a file, please:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
260 |
default:'' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
261 |
ok:'show' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
262 |
abort:'cancel' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
263 |
pattern:'*.rc'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
264 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
265 |
[exEnd] |
125 | 266 |
|
302 | 267 |
|
268 |
asking for a password: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
269 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
270 |
|s| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
271 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
272 |
s := Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
273 |
requestPassword:'enter your secret, please:'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
274 |
Transcript show:'you entered: '; showCR:s. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
275 |
[exEnd] |
302 | 276 |
|
645 | 277 |
multiple choice dialogs: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
278 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
279 |
Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
280 |
choose:'choose any' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
281 |
fromList:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
282 |
values:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
283 |
buttons:#('one' 'two' 'three' 'four') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
284 |
values:#(1 2 3 4) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
285 |
lines:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
286 |
cancel:nil |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
287 |
[exEnd] |
645 | 288 |
|
289 |
multiple choice dialog, with list & buttons: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
290 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
291 |
Transcript showCR:( |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
292 |
Dialog |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
293 |
choose:'choose example' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
294 |
fromList:#('one' 'two' 'three' 'four') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
295 |
values:#(1 2 3 4) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
296 |
buttons:#('five' 'six' 'seven') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
297 |
values:#(5 6 7) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
298 |
lines:4 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
299 |
cancel:[Transcript flash. #aborted] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
300 |
) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
301 |
[exEnd] |
645 | 302 |
|
303 |
You can (and often have to) construct custom dialogs programmatically, |
|
304 |
from individual components. As shown in the following examples: |
|
91 | 305 |
|
121 | 306 |
basic (unusable) example: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
307 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
308 |
DialogBox new open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
309 |
[exEnd] |
76 | 310 |
|
121 | 311 |
still unusable - only an ok-button: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
312 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
313 |
DialogBox new addOkButton; open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
314 |
[exEnd] |
121 | 315 |
|
316 |
both ok- and abortButtons: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
317 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
318 |
DialogBox new addAbortButton; addOkButton; open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
319 |
[exEnd] |
121 | 320 |
|
122 | 321 |
with different ok-label: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
322 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
323 |
DialogBox new addAbortButton; addOkButtonLabelled:'yeah'; open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
324 |
[exEnd] |
122 | 325 |
|
645 | 326 |
adding a (centered by default) textlabel gives an infoBox: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
327 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
328 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
329 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
330 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
331 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
332 |
[exEnd] |
121 | 333 |
|
334 |
a textlabel with abort- and okButton gives a yesNoBox: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
335 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
336 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
337 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
338 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
339 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
340 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
341 |
[exEnd] |
121 | 342 |
|
343 |
the same, adjusting the labels contents to the left: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
344 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
345 |
|box| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
346 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
347 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
348 |
(box addTextLabel:'hello') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
349 |
box addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
350 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
351 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
352 |
[exEnd] |
121 | 353 |
|
122 | 354 |
with modified buttons: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
355 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
356 |
|box| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
357 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
358 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
359 |
(box addTextLabel:'are you certain ?') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
360 |
box addAbortButtonLabelled:'not really'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
361 |
(box addOkButtonLabelled:'yes, absolutely') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
362 |
activeBackgroundColor:Color red. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
363 |
box open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
364 |
[exEnd] |
122 | 365 |
|
366 |
||
645 | 367 |
mswindows style (different up/down bitmaps in buttons): |
368 |
((try tabbing ...) |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
369 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
370 |
|b box| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
371 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
372 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
373 |
(box addTextLabel:'are you certain ?') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
374 |
b := Button new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
375 |
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
|
376 |
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
|
377 |
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
|
378 |
b beImageButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
379 |
box addAbortButton:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
380 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
381 |
b := Button new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
382 |
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
|
383 |
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
|
384 |
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
|
385 |
b beImageButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
386 |
box addOkButton:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
387 |
box open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
388 |
[exEnd] |
162 | 389 |
|
390 |
||
121 | 391 |
two textlabels: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
392 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
393 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
394 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
395 |
addTextLabel:'world'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
396 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
397 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
398 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
399 |
[exEnd] |
118 | 400 |
|
121 | 401 |
fixing the dialogs size (suppres it calculating its size from the |
130 | 402 |
preferredExtents of its components): |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
403 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
404 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
405 |
label:'a simple dialog'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
406 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
407 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
408 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
409 |
extent:200@200; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
410 |
sizeFixed:true; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
411 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
412 |
[exEnd] |
118 | 413 |
|
121 | 414 |
asking the box if it was closed via ok: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
415 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
416 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
417 |
label:'a simple dialog'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
418 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
419 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
420 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
421 |
extent:200@200; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
422 |
sizeFixed:true; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
423 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
424 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
425 |
Transcript showCR:'yes' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
426 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
427 |
Transcript showCR:'no' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
428 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
429 |
[exEnd] |
118 | 430 |
|
121 | 431 |
textLabels are not limited to strings (although, the name which is |
432 |
used for ST-80 compatibility, suggests it): |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
433 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
434 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
435 |
addTextLabel:(Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages'); |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
436 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
437 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
438 |
[exEnd] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
439 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
440 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
441 |
DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
442 |
addTextLabel:'hello'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
443 |
addTextLabel:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
444 |
magnifiedTo:200@150); |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
445 |
addTextLabel:'world'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
446 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
447 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
448 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
449 |
[exEnd] |
120 | 450 |
|
121 | 451 |
adding an input field (on a string model): |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
452 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
453 |
|stringModel| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
454 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
455 |
stringModel := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
456 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
457 |
addTextLabel:'Please enter a string:'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
458 |
addInputFieldOn:stringModel; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
459 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
460 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
461 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
462 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
463 |
Transcript showCR:'entered: ', stringModel value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
464 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
465 |
[exEnd] |
120 | 466 |
|
467 |
||
121 | 468 |
multiple input fields (notice, that the dialog connects the fields |
469 |
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
|
470 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
471 |
|firstName lastName| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
472 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
473 |
firstName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
474 |
lastName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
475 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
476 |
addTextLabel:'Please enter your name:'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
477 |
addInputFieldOn:firstName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
478 |
addVerticalSpace; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
479 |
addInputFieldOn:lastName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
480 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
481 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
482 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
483 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
484 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
485 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
486 |
[exEnd] |
121 | 487 |
|
488 |
||
489 |
of course, the model may contain a value initially: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
490 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
491 |
|firstName lastName p line i name| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
492 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
493 |
firstName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
494 |
lastName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
495 |
p := PipeStream readingFrom:'finger ' , OperatingSystem getLoginName. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
496 |
p notNil ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
497 |
line := p nextLine. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
498 |
(i := line findString:'Name:') ~~ 0 ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
499 |
name := line copyFrom:(i + 'Name:' size). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
500 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
501 |
(i := line findString:'real life:') == 0 ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
502 |
line := p nextLine. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
503 |
]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
504 |
(i := line findString:'real life:') ~~ 0 ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
505 |
name := line copyFrom:(i + 'real life:' size). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
506 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
507 |
]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
508 |
name notNil ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
509 |
firstName value: name asCollectionOfWords first. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
510 |
lastName value: name asCollectionOfWords last. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
511 |
Transcript showCR:'initially ' , firstName value , ' ' , lastName value. |
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 |
p close. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
514 |
]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
515 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
516 |
(DialogBox new |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
517 |
addTextLabel:'Please enter your name:'; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
518 |
addInputFieldOn:firstName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
519 |
addVerticalSpace; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
520 |
addInputFieldOn:lastName; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
521 |
addAbortButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
522 |
addOkButton; |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
523 |
open |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
524 |
) accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
525 |
Transcript showCR:'entered: ', firstName value , ' ' , lastName value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
526 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
527 |
[exEnd] |
121 | 528 |
|
120 | 529 |
|
302 | 530 |
validated password entry: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
531 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
532 |
|box firstEntry secondEntry| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
533 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
534 |
firstEntry := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
535 |
secondEntry := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
536 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
537 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
538 |
(box addTextLabel:'Please enter your secret:') adjust:#left. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
539 |
(box addInputFieldOn:firstEntry) passwordCharacter:$*. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
540 |
box addVerticalSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
541 |
(box addInputFieldOn:secondEntry) passwordCharacter:$*. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
542 |
box addAbortButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
543 |
box addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
544 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
545 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
546 |
firstEntry value ~= secondEntry value ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
547 |
Transcript showCR:'wrong input - try again' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
548 |
] ifFalse:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
549 |
Transcript showCR:'entered: ', firstEntry value |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
550 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
551 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
552 |
[exEnd] |
593 | 553 |
|
554 |
input fields with a label: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
555 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
556 |
|box firstNameHolder middleNameHolder lastNameHolder| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
557 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
558 |
firstNameHolder := 'John' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
559 |
middleNameHolder := 'F' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
560 |
lastNameHolder := 'Peters' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
561 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
562 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
563 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
564 |
addLabelledInputField:'first name:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
565 |
adjust:#right |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
566 |
on:firstNameHolder |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
567 |
tabable:true |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
568 |
separateAtX:0.4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
569 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
570 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
571 |
addLabelledInputField:'middle initial:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
572 |
adjust:#right |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
573 |
on:middleNameHolder |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
574 |
tabable:true |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
575 |
separateAtX:0.4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
576 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
577 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
578 |
addLabelledInputField:'last name:' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
579 |
adjust:#right |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
580 |
on:lastNameHolder |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
581 |
tabable:true |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
582 |
separateAtX:0.4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
583 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
584 |
box addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
585 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
586 |
[exEnd] |
593 | 587 |
|
588 |
||
589 |
constructing a dialog from other elements: |
|
121 | 590 |
adding a fileSelectionList: |
591 |
(since the dialog adds the component with its preferred extent, |
|
592 |
ignoring the 300-height, this looks ugly ... |
|
593 |
... especially when resized vertically) |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
594 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
595 |
|top l scr fileName| |
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 |
fileName := '' asValue. |
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 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
600 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
601 |
l := FileSelectionList new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
602 |
l useIndex:false. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
603 |
l doubleClickAction:[:name | top okPressed]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
604 |
l action:[:name | fileName value:name]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
605 |
scr := ScrollableView forView:l. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
606 |
scr extent:(1.0 @ 300). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
607 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
608 |
top addComponent:scr. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
609 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
610 |
top openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
611 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
612 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
613 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
614 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
615 |
[exEnd] |
121 | 616 |
|
617 |
same, looks better, since the height is made larger (not using |
|
618 |
fileLists preferredExtent): |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
619 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
620 |
|top l scr fileName| |
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 |
fileName := '' asValue. |
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 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
625 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
626 |
l := FileSelectionList new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
627 |
l useIndex:false. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
628 |
l doubleClickAction:[:name | top okPressed]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
629 |
l action:[:name | fileName value:name]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
630 |
scr := ScrollableView forView:l. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
631 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
632 |
top addComponent:scr withExtent:300@300. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
633 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
634 |
top openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
635 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
636 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
637 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
638 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
639 |
[exEnd] |
121 | 640 |
|
641 |
||
642 |
again, setting the boxes initial size and fixing it |
|
130 | 643 |
(let it ignore the components' preferredExtent): |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
644 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
645 |
|top fixFrame l scr fileName| |
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 |
fileName := '' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
648 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
649 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
650 |
top extent:300@300. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
651 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
652 |
fixFrame := View new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
653 |
fixFrame extent:(1.0 @ 300). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
654 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
655 |
l := FileSelectionList new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
656 |
l useIndex:false. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
657 |
l doubleClickAction:[:name | top okPressed]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
658 |
l action:[:name | fileName value:name]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
659 |
scr := ScrollableView forView:l. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
660 |
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
|
661 |
fixFrame add:scr. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
662 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
663 |
top addComponent:fixFrame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
664 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
665 |
top openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
666 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
667 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
668 |
Transcript show:'fileName: '; showCR:fileName value storeString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
669 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
670 |
[exEnd] |
118 | 671 |
|
672 |
||
673 |
adding a panel with checkBoxes: |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
674 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
675 |
|top panel b value1 value2 value3 value4| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
676 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
677 |
value1 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
678 |
value2 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
679 |
value3 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
680 |
value4 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
681 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
682 |
top := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
683 |
top extent:200@300. |
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 |
panel := VerticalPanelView new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
686 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
687 |
b := CheckBox on:value1. b label:'check1'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
688 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
689 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
690 |
b := CheckBox on:value2. b label:'check2'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
691 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
692 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
693 |
b := CheckBox on:value3. b label:'check3'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
694 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
695 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
696 |
b := CheckBox on:value4. b label:'check4'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
697 |
panel addSubView:b. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
698 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
699 |
top addComponent:panel. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
700 |
top addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
701 |
top open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
702 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
703 |
top accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
704 |
Transcript show:'value1: '; showCR:value1 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
705 |
Transcript show:'value2: '; showCR:value2 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
706 |
Transcript show:'value3: '; showCR:value3 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
707 |
Transcript show:'value4: '; showCR:value4 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
708 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
709 |
[exEnd] |
118 | 710 |
|
120 | 711 |
same, using a more convenient interface: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
712 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
713 |
|box value1 value2 value3 value4| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
714 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
715 |
value1 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
716 |
value2 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
717 |
value3 := false asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
718 |
value4 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
719 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
720 |
box := DialogBox new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
721 |
box extent:200@300. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
722 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
723 |
box addCheckBox:'check1' on:value1. |
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:'check2' on:value2. |
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:'check3' on:value3. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
728 |
box addVerticalSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
729 |
box addCheckBox:'check4' on:value4. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
730 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
731 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
732 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
733 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
734 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
735 |
Transcript show:'value1: '; showCR:value1 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
736 |
Transcript show:'value2: '; showCR:value2 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
737 |
Transcript show:'value3: '; showCR:value3 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
738 |
Transcript show:'value4: '; showCR:value4 value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
739 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
740 |
[exEnd] |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
741 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
742 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
743 |
same, using an even better interface: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
744 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
745 |
|box values labels| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
746 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
747 |
values := #(true false false true) collect:[:val | val asValue]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
748 |
labels := #('check1' 'check2' 'check3' 'check4'). |
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 := Dialog new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
751 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
752 |
box |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
753 |
addColumn:(1 to:labels size) |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
754 |
fromX:0.0 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
755 |
toX:1.0 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
756 |
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
|
757 |
tabable:true. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
758 |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
759 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
760 |
box open. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
761 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
762 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
763 |
values with:labels do:[:val :lbl | |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
764 |
Transcript show:(lbl , ': '); showCR:val value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
765 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
766 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
767 |
[exEnd] |
126 | 768 |
|
769 |
||
164 | 770 |
adding two panels in a frame: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
771 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
772 |
|box frame vPanel1 vPanel2 m1 m2 m3 m4 chk ef| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
773 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
774 |
box := Dialog new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
775 |
box label:'example'. |
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 |
frame := FramedBox label:'frame'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
778 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
779 |
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
|
780 |
vPanel1 horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
781 |
vPanel1 verticalLayout:#spreadSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
782 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
783 |
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
|
784 |
vPanel2 horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
785 |
vPanel2 verticalLayout:#spreadSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
786 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
787 |
m1 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
788 |
m2 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
789 |
m3 := true asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
790 |
m4 := 'hello' asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
791 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
792 |
vPanel1 add:(Label label:'check1'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
793 |
vPanel1 add:(Label label:'m2'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
794 |
vPanel1 add:(Label label:'m3'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
795 |
vPanel1 add:(Label label:'enter'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
796 |
vPanel1 add:(Label label:'lbl1'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
797 |
vPanel1 add:(Label label:'lbl2'). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
798 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
799 |
vPanel2 add:(chk := CheckToggle on:m1). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
800 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
801 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
802 |
vPanel2 add:(chk := CheckToggle on:m2). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
803 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
804 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
805 |
vPanel2 add:(chk := CheckToggle on:m3). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
806 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
807 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
808 |
vPanel2 add:(chk := CheckToggle on:m3). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
809 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
810 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
811 |
vPanel2 add:(chk := CheckToggle on:m3). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
812 |
box makeTabable:chk. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
813 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
814 |
vPanel2 add:(ef := EditField on:m4). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
815 |
ef immediateAccept:true. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
816 |
box makeTabable:ef. |
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 addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
819 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
820 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
821 |
box openModal. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
822 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
823 |
Transcript showCR:'accepted with:'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
824 |
Transcript showCR:' m1: ' , m1 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
825 |
Transcript showCR:' m2: ' , m2 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
826 |
Transcript showCR:' m3: ' , m3 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
827 |
Transcript showCR:' m4: ' , m4 value printString. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
828 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
829 |
[exEnd] |
593 | 830 |
|
831 |
||
832 |
||
833 |
a full example (combined settings dialog - as in launcher): |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
834 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
835 |
|box warnSTX allowUnderscore immutableArrays logDoits |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
836 |
listOfLanguages listOfStyles styleNames |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
837 |
frame panel c resourceDir dir | |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
838 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
839 |
warnSTX := Compiler warnSTXSpecials asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
840 |
allowUnderscore := Compiler allowUnderscoreInIdentifier asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
841 |
immutableArrays := Compiler arraysAreImmutable 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 |
logDoits := Smalltalk logDoits asValue. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
844 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
845 |
listOfLanguages := SelectionInList with:#('english' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
846 |
'french' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
847 |
'german' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
848 |
'italian' |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
849 |
'spanish' |
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 |
listOfLanguages selection:(Language asString). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
852 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
853 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
854 |
resourceDir := Smalltalk getSystemFileName:'resources'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
855 |
dir := FileDirectory directoryNamed:resourceDir. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
856 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
857 |
styleNames := dir select:[:aFileName | aFileName endsWith:'.style']. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
858 |
styleNames := styleNames collect:[:aFileName | aFileName copyWithoutLast:6]. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
859 |
listOfStyles := SelectionInList with:styleNames sort. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
860 |
listOfStyles selection:(View defaultStyle asString). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
861 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
862 |
box := Dialog new. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
863 |
box label:'Settings'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
864 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
865 |
frame := FramedBox label:'Compiler'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
866 |
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
|
867 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
868 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
869 |
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
|
870 |
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
|
871 |
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
|
872 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
873 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
874 |
frame := FramedBox label:'Misc'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
875 |
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
|
876 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
877 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
878 |
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
|
879 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
880 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
881 |
frame := FramedBox label:'Language'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
882 |
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
|
883 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
884 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
885 |
panel add:((PopUpList on:listOfLanguages) width:0.5). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
886 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
887 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
888 |
frame := FramedBox label:'Style'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
889 |
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
|
890 |
panel horizontalLayout:#leftSpace. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
891 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
892 |
panel add:((PopUpList on:listOfStyles) width:0.5). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
893 |
box addComponent:frame. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
894 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
895 |
box addAbortButton; addOkButton. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
896 |
box showAtPointer. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
897 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
898 |
box accepted ifTrue:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
899 |
Transcript topView withCursor:Cursor wait do:[ |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
900 |
Compiler warnSTXSpecials:warnSTX value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
901 |
Compiler allowUnderscoreInIdentifier:allowUnderscore value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
902 |
Compiler arraysAreImmutable:immutableArrays 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 |
Smalltalk logDoits:logDoits value. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
905 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
906 |
Transcript showCR:'change language to ' , listOfLanguages selection , ' ...'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
907 |
Smalltalk at:#Language put:listOfLanguages selection asSymbol. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
908 |
Smalltalk changed:#Language. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
909 |
ResourcePack flushCachedResourcePacks. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
910 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
911 |
Transcript showCR:'change style to ' , listOfStyles selection , ' ...'. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
912 |
View defaultStyle:listOfStyles selection asSymbol. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
913 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
914 |
] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
915 |
[exEnd] |
625 | 916 |
an example from Hopkins/Horan: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
917 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
918 |
|aText index| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
919 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
920 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
921 |
index := aText findString:'Smalltalk/X' startingAt:1. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
922 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
923 |
to:'Smalltalk/X' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
924 |
with:#bold. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
925 |
index := aText findString:'Introduction' startingAt:index. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
926 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
927 |
to:'Introduction' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
928 |
with:#italic. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
929 |
Dialog warn:aText |
625 | 930 |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
931 |
[exEnd] |
625 | 932 |
the same, with colors: |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
933 |
[exBegin] |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
934 |
|aText index| |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
935 |
|
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
936 |
aText := 'Smalltalk/X: An Introduction to Application Development' asText. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
937 |
index := aText findString:'Smalltalk/X' startingAt:1. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
938 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
939 |
to:'Smalltalk/X' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
940 |
with:(Array with:#bold with:#underline with:(#color->Color red)). |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
941 |
index := aText findString:'Introduction' startingAt:index. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
942 |
aText emphasizeFrom:index |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
943 |
to:'Introduction' size + index - 1 |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
944 |
with:#italic. |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
945 |
Dialog warn:aText |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
946 |
[exEnd] |
76 | 947 |
" |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
948 |
! |
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 |
inputFocus |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
951 |
" |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
952 |
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
|
953 |
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
|
954 |
|
600 | 955 |
The default is to shift the focus to the ok-button - thus, another return |
956 |
has to be entered (as confirmation) to close & accept the box. |
|
957 |
||
958 |
This can be changed to force an automatic OK with: |
|
1401 | 959 |
aBox focusToOKOnLeave:false |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
960 |
|
600 | 961 |
Then, leaving the last field with return, automatically accepts the box, |
962 |
as if ok was pressed. (useful for simple - single entry dialogs). |
|
963 |
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
|
964 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
965 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
966 |
With: |
1401 | 967 |
aBox acceptReturnAsOK:false |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
968 |
|
600 | 969 |
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
|
970 |
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
|
971 |
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
|
972 |
(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
|
973 |
to be handled somehow). |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
974 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
975 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
976 |
Simply leaving the group with a cursor movement may also be either |
600 | 977 |
interpreted as a return (the default), or again wrap back to the top |
978 |
of the group. |
|
979 |
||
980 |
With: |
|
1401 | 981 |
aBox acceptOnLeave:false |
600 | 982 |
this is turned off, so that with cursor-down, the focus is moved back |
983 |
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
|
984 |
" |
76 | 985 |
! ! |
986 |
||
2768 | 987 |
!DialogBox class methodsFor:'Compatibility-VW'! |
1371 | 988 |
|
989 |
choose:aString fromList:list values:listValues lines:maxLines cancel:cancelBlock for:aView |
|
990 |
"launch a Dialog showing the message and list. |
|
991 |
The user can select an item and click ok; in this case, the corresponding value |
|
992 |
from listValues is returned (doubleclick works as well). |
|
993 |
If cancel is pressed, the value of cancelBlock is returned. |
|
994 |
Pressing ok without a selection is treated like cancel. |
|
995 |
This is a new VW2.5 interface - passing an addtional argument. |
|
996 |
In ST/X, this is not needed and ignored" |
|
997 |
||
998 |
^ self |
|
1401 | 999 |
choose:aString |
1000 |
fromList:list |
|
1001 |
values:listValues |
|
1002 |
lines:maxLines |
|
1003 |
cancel:cancelBlock |
|
1371 | 1004 |
|
1005 |
" |
|
1006 |
Transcript showCR:( |
|
1401 | 1007 |
Dialog |
1008 |
choose:'choose any' |
|
1009 |
fromList:#('one' 'two' 'three' 'four') |
|
1010 |
values:#(1 2 3 4) |
|
1011 |
lines:4 |
|
1012 |
cancel:nil |
|
1371 | 1013 |
) |
1014 |
||
1015 |
Transcript showCR:( |
|
1401 | 1016 |
Dialog |
1017 |
choose:'choose example' |
|
1018 |
fromList:#('one' 'two' 'three' 'four') |
|
1019 |
values:#(1 2 3 4) |
|
1020 |
lines:4 |
|
1021 |
cancel:[Transcript flash. #aborted] |
|
1371 | 1022 |
) |
1023 |
" |
|
1024 |
||
1025 |
"Created: / 1.11.1997 / 13:21:32 / cg" |
|
1026 |
"Modified: / 1.11.1997 / 13:21:54 / cg" |
|
1027 |
! |
|
1102 | 1028 |
|
1029 |
confirm:aMessageString for:ignoredView |
|
1371 | 1030 |
"VW compatibility - confirm using the same viewStyle as in the view |
1102 | 1031 |
argument; not supported in ST/X (who mixes styles ?)" |
1032 |
||
3456 | 1033 |
^ self |
1034 |
confirm:aMessageString |
|
1035 |
title:nil |
|
1036 |
yesLabel:nil noLabel:nil |
|
1037 |
initialAnswer:true. |
|
1038 |
||
1039 |
"Created: / 06-03-1997 / 15:45:54 / cg" |
|
1040 |
"Modified: / 02-03-2007 / 15:25:15 / cg" |
|
1371 | 1041 |
! |
1042 |
||
1043 |
request:aString for:aView |
|
1044 |
"launch a Dialog, which allows user to enter something. |
|
1045 |
Return the entered string (may be empty string) |
|
1046 |
or the empty string (if cancel was pressed), |
|
1047 |
This is a new VW2.5 interface - passing an addtional argument. |
|
1048 |
In ST/X, this is not needed and ignored" |
|
1049 |
||
1050 |
^ self |
|
1401 | 1051 |
request:aString |
1371 | 1052 |
|
1053 |
"Created: / 31.10.1997 / 03:26:32 / cg" |
|
1054 |
"Modified: / 31.10.1997 / 11:53:50 / cg" |
|
1055 |
! |
|
1056 |
||
1057 |
request:aString initialAnswer:initial for:aView |
|
1058 |
"launch a Dialog, which allows user to enter something. |
|
1059 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
1060 |
This is a new VW2.5 interface - passing an addtional argument. |
|
1061 |
In ST/X, this is not needed and ignored" |
|
1062 |
||
1063 |
^ self |
|
1401 | 1064 |
request:aString |
1065 |
initialAnswer:initial |
|
1371 | 1066 |
|
1067 |
"Modified: / 29.5.1996 / 14:30:05 / cg" |
|
1068 |
"Created: / 1.11.1997 / 13:18:29 / cg" |
|
1069 |
! |
|
1070 |
||
1071 |
requestFileName:title default:default version:versionSym ifFail:failBlock for:aViewOrNil |
|
1072 |
"new VW2.5 interface - passing an addtional argument. |
|
1073 |
In ST/X, this is not needed and ignored" |
|
1074 |
||
1075 |
^ self |
|
1401 | 1076 |
requestFileName:title default:default version:versionSym ifFail:failBlock |
1371 | 1077 |
|
1078 |
"Created: / 31.10.1997 / 02:00:42 / cg" |
|
1079 |
"Modified: / 31.10.1997 / 11:52:53 / cg" |
|
1102 | 1080 |
! |
1081 |
||
1082 |
warn:aMessageString for:ignoredView |
|
1371 | 1083 |
"VW compatibility - warn using the same viewStyle as in the view |
1102 | 1084 |
argument; not supported in ST/X (who mixes styles ?)" |
1085 |
||
1086 |
^ self warn:aMessageString |
|
1087 |
||
1371 | 1088 |
"Created: / 6.3.1997 / 15:46:02 / cg" |
1089 |
"Modified: / 31.10.1997 / 11:54:35 / cg" |
|
1102 | 1090 |
! ! |
1091 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1092 |
!DialogBox class methodsFor:'class initialization'! |
498 | 1093 |
|
1094 |
initialize |
|
528
3ed1f0b5a0bb
oops - dont clobber Dialog global if subclasses #initialize
Claus Gittinger <cg@exept.de>
parents:
498
diff
changeset
|
1095 |
self == DialogBox ifTrue:[ |
5650 | 1096 |
"/ do this for ST-80 compatibility |
1097 |
"/ (and in the meantime also for my own compatibility..) |
|
1757 | 1098 |
Dialog := self |
1099 |
]. |
|
1100 |
||
1101 |
DefaultFocusToOKOnLeave := false. |
|
3902
eb4576429ff0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
3888
diff
changeset
|
1102 |
|
eb4576429ff0
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
3888
diff
changeset
|
1103 |
"/ 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
|
1104 |
AboutToOpenBoxNotificationSignal := SimpleView aboutToOpenBoxNotificationSignal |
498 | 1105 |
! ! |
1106 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1107 |
!DialogBox class methodsFor:'common dialogs'! |
100 | 1108 |
|
2479 | 1109 |
about:text label:label icon:image |
1110 |
"opens an standard about box for an application." |
|
1111 |
||
1112 |
|box| |
|
1113 |
||
1114 |
AboutBox isNil ifTrue:[ |
|
1115 |
"/ this handles bad installations of ST/X, |
|
1116 |
"/ where the AboutBox is missing. |
|
1117 |
"/ (May vanish in the future) |
|
1118 |
^ self information:text |
|
1119 |
]. |
|
1120 |
||
1121 |
box := AboutBox title:text. |
|
1122 |
||
2672 | 1123 |
box image:image. |
2479 | 1124 |
box label:label. |
1125 |
box autoHideAfter:10 with:[]. |
|
3548
7cc719de254f
aboutToObenBoxNotification for aboutBox
Claus Gittinger <cg@exept.de>
parents:
3538
diff
changeset
|
1126 |
self showAndThenDestroyBox:box. |
7cc719de254f
aboutToObenBoxNotification for aboutBox
Claus Gittinger <cg@exept.de>
parents:
3538
diff
changeset
|
1127 |
"/ box open. |
2479 | 1128 |
|
1129 |
"Created: / 17.11.2001 / 23:04:53 / cg" |
|
1130 |
"Modified: / 17.11.2001 / 23:06:06 / cg" |
|
1131 |
! |
|
1132 |
||
2499 | 1133 |
aboutClass:aClass |
4132
783ba5afbcf0
comment/format in: #aboutClass:
Claus Gittinger <cg@exept.de>
parents:
4104
diff
changeset
|
1134 |
"opens a standard (simple) aboutBox for aClass." |
2499 | 1135 |
|
1136 |
|rev clsRev msg resources| |
|
1137 |
||
1138 |
rev := ''. |
|
1139 |
||
1140 |
(clsRev := aClass revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
|
1141 |
resources := aClass classResources. |
|
1142 |
||
5597 | 1143 |
msg := '\' withCRs , aClass name allBold, rev. |
2499 | 1144 |
|
1145 |
self |
|
1146 |
about:(resources string:msg) |
|
1147 |
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
|
1148 |
icon:aClass defaultIconForAboutBox |
2499 | 1149 |
! |
1150 |
||
5837 | 1151 |
ask:setupBlock ifNotNilOrEmptyDo:actionBlock |
5836 | 1152 |
"utility: open a requestor with setupBlock; |
1153 |
if it answers ok, invoke actionBlock with the entered input. |
|
1154 |
Otherwise do nothing" |
|
1155 |
||
1156 |
|answer| |
|
1157 |
||
1158 |
answer := setupBlock value. |
|
1159 |
answer notEmptyOrNil ifTrue:[ |
|
1160 |
actionBlock value:answer |
|
1161 |
]. |
|
1162 |
||
1163 |
" |
|
1164 |
Dialog |
|
5837 | 1165 |
ask:[ Dialog request:'Some Answer:' ] |
5836 | 1166 |
ifNotNilOrEmptyDo:[:what | Transcript showCR:what ] |
1167 |
" |
|
5837 | 1168 |
" |
1169 |
Dialog |
|
1170 |
ask:[ Dialog requestFileName:'Some File:' ] |
|
1171 |
ifNotNilOrEmptyDo:[:what | Transcript showCR:what ] |
|
1172 |
" |
|
1173 |
! |
|
1174 |
||
1175 |
askYesNo:setupBlock ifYesDo:actionBlock |
|
5836 | 1176 |
"utility: open a confirmer with setupBlock; |
1177 |
if it answers true, invoke actionBlock. |
|
1178 |
Otherwise do nothing" |
|
1179 |
||
1180 |
|answer| |
|
1181 |
||
1182 |
answer := setupBlock value. |
|
1183 |
answer == true ifTrue:[ |
|
1184 |
actionBlock value |
|
1185 |
]. |
|
1186 |
||
1187 |
" |
|
1188 |
Dialog |
|
5837 | 1189 |
askYesNo:[ Dialog confirm:'Yes or No?' ] |
5836 | 1190 |
ifYesDo:[ Transcript showCR:'yes' ] |
1191 |
" |
|
1192 |
! |
|
1193 |
||
1703
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1194 |
informUser:aString during:aBlock |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1195 |
"show a message-box while executing aBlock" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1196 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1197 |
|box| |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1198 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1199 |
[ |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1200 |
box := InfoBox title:aString. |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1201 |
box hideButtons. |
2439 | 1202 |
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
|
1203 |
] forkAt:(Processor activePriority + 1). |
2522
d80496af7eaf
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2517
diff
changeset
|
1204 |
aBlock ensure:[box destroy] |
1703
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1205 |
|
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1206 |
" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1207 |
Dialog informUser:'wait a second...' during:[Delay waitForSeconds:1] |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1208 |
Dialog informUser:'wait a few seconds...' during:[10000 factorial] |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1209 |
" |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1210 |
! |
8881861270f1
added #informUser:during: utility.
Claus Gittinger <cg@exept.de>
parents:
1702
diff
changeset
|
1211 |
|
2622 | 1212 |
informUser:aString during:aBlock cancel:canCancel |
1213 |
"show a message-box while executing aBlock" |
|
1214 |
||
1215 |
|box subProcess| |
|
1216 |
||
1217 |
box := InfoBox title:aString. |
|
1218 |
canCancel ifTrue:[ |
|
2640
2672ec342e7e
Do not refer to uninitialized ClassResources
Stefan Vogel <sv@exept.de>
parents:
2637
diff
changeset
|
1219 |
box okText:(self classResources string:'Abort'). |
2622 | 1220 |
] ifFalse:[ |
1221 |
box hideButtons. |
|
1222 |
]. |
|
1223 |
||
1224 |
subProcess := [ |
|
1225 |
aBlock ensure:[box destroy] |
|
1226 |
] forkAt:(Processor activePriority - 1). |
|
1227 |
||
1228 |
self showBox:box. |
|
1229 |
subProcess terminate. |
|
1230 |
||
1231 |
||
1232 |
" |
|
1233 |
Dialog informUser:'don''t wait ...' during:[true] cancel:true |
|
3137 | 1234 |
Dialog informUser:'please wait a second...' during:[Delay waitForSeconds:1] cancel:true |
1235 |
Dialog informUser:'please wait, while I compute 30000 factorial...' during:[30000 factorial] cancel:true |
|
2622 | 1236 |
" |
1237 |
! |
|
1238 |
||
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
|
1239 |
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
|
1240 |
"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
|
1241 |
|
5337 | 1242 |
self information:aString title:(aString upTo:Character cr) |
197 | 1243 |
|
1244 |
" |
|
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
|
1245 |
Dialog information:'help' |
197 | 1246 |
" |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1247 |
|
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1248 |
"Modified: 29.5.1996 / 15:23:03 / cg" |
197 | 1249 |
! |
1250 |
||
4208 | 1251 |
information:aString title:windowTitle |
1252 |
"launch a Dialog to tell user something" |
|
1253 |
||
1254 |
|currentScreen| |
|
1255 |
||
1256 |
((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[ |
|
1257 |
^ currentScreen |
|
1258 |
nativeInformationOK:aString |
|
1259 |
title:windowTitle |
|
1260 |
]. |
|
1261 |
self showAndThenDestroyBox:(InfoBox title:aString label:windowTitle) |
|
1262 |
||
1263 |
" |
|
1264 |
Dialog information:'help' title:'Attention' |
|
1265 |
" |
|
1266 |
||
1267 |
"Created: / 22-12-2010 / 19:33:23 / cg" |
|
1268 |
! |
|
1269 |
||
5011 | 1270 |
informationText:aString title:windowTitle |
1271 |
"launch a Dialog to tell user something. |
|
1272 |
The argument aString is shown as multiline, scrollable text" |
|
1273 |
||
1274 |
|dialog textHolder| |
|
1275 |
||
1276 |
textHolder := ValueHolder new. |
|
1277 |
dialog := Dialog |
|
1278 |
forRequestText:'' editViewClass:TextView |
|
1279 |
lines:15 columns:60 |
|
1280 |
initialAnswer:aString initialSelection:nil |
|
1281 |
model:textHolder. |
|
1282 |
dialog window label:windowTitle. |
|
1283 |
dialog open. |
|
1284 |
||
1285 |
" |
|
1286 |
Dialog |
|
1287 |
informationText:(DialogBox class compiledMethodAt:#information:title:) source |
|
1288 |
title:'Hello' |
|
1289 |
" |
|
1290 |
! |
|
1291 |
||
1292 |
informationText:aString title:title windowTitle:windowTitle |
|
1293 |
"launch a Dialog to tell user something. |
|
1294 |
The argument aString is shown as multiline, scrollable text" |
|
1295 |
||
1296 |
|dialog textHolder| |
|
1297 |
||
1298 |
textHolder := ValueHolder new. |
|
1299 |
dialog := Dialog |
|
1300 |
forRequestText:title editViewClass:TextView |
|
1301 |
lines:15 columns:60 |
|
1302 |
initialAnswer:aString initialSelection:nil |
|
1303 |
model:textHolder. |
|
1304 |
dialog removeAbortButton. |
|
1305 |
dialog okButton beReturnButton. |
|
1306 |
dialog window label:windowTitle. |
|
1307 |
dialog open. |
|
1308 |
||
1309 |
" |
|
1310 |
Dialog |
|
1311 |
informationText:(DialogBox class compiledMethodAt:#information:title:) source |
|
1312 |
title:'Hello - the text is:' |
|
1313 |
windowTitle:'Hello' |
|
1314 |
" |
|
1315 |
! |
|
1316 |
||
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
|
1317 |
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
|
1318 |
"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
|
1319 |
|
2493 | 1320 |
|currentScreen| |
1321 |
||
2781 | 1322 |
((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[ |
2493 | 1323 |
^ currentScreen |
1324 |
nativeWarnOK:aString |
|
1325 |
title:aString |
|
1326 |
]. |
|
2439 | 1327 |
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
|
1328 |
|
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
|
1329 |
" |
625 | 1330 |
Dialog warn:'some warning message' |
1331 |
||
1332 |
Dialog warn:('some text with italic emphasis' asText |
|
2439 | 1333 |
emphasizeFrom:16 to:22 with:#italic) |
625 | 1334 |
|
1335 |
Dialog warn:('some warning message' asText |
|
2439 | 1336 |
emphasizeAllWith:(#color->Color red)) |
625 | 1337 |
|
1338 |
Dialog warn:('some text with color emphasis' asText |
|
2439 | 1339 |
emphasizeFrom:6 to:10 with:(#color->Color blue); |
1340 |
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
|
1341 |
" |
625 | 1342 |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
1343 |
"Modified: 29.5.1996 / 15:23:14 / cg" |
4351 | 1344 |
! |
1345 |
||
1346 |
warn:aString title:windowTitle |
|
1347 |
"launch a Dialog to warn user" |
|
1348 |
||
1349 |
|currentScreen| |
|
1350 |
||
1351 |
((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[ |
|
1352 |
^ currentScreen |
|
1353 |
nativeWarnOK:aString |
|
1354 |
title:windowTitle |
|
1355 |
]. |
|
1356 |
self showAndThenDestroyBox:(WarningBox title:aString label:windowTitle) |
|
1357 |
||
1358 |
" |
|
1359 |
Dialog warn:'some warning message' |
|
1360 |
||
1361 |
Dialog warn:('some text with italic emphasis' asText |
|
1362 |
emphasizeFrom:16 to:22 with:#italic) |
|
1363 |
||
1364 |
Dialog warn:('some warning message' asText |
|
1365 |
emphasizeAllWith:(#color->Color red)) |
|
1366 |
||
1367 |
Dialog warn:('some text with color emphasis' asText |
|
1368 |
emphasizeFrom:6 to:10 with:(#color->Color blue); |
|
1369 |
emphasizeFrom:16 to:20 with:(#color->Color red)) |
|
1370 |
" |
|
1371 |
||
1372 |
"Modified: / 29-05-1996 / 15:23:14 / cg" |
|
1373 |
"Created: / 20-01-2012 / 15:54:26 / 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
|
1374 |
! ! |
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
|
1375 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1376 |
!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
|
1377 |
|
197 | 1378 |
confirm:aString |
3355 | 1379 |
"open a modal yes-no dialog. |
1380 |
Return true for yes, false for no" |
|
197 | 1381 |
|
498 | 1382 |
^ self |
3456 | 1383 |
confirm:aString |
1384 |
title:nil |
|
1385 |
yesLabel:nil noLabel:nil |
|
1386 |
initialAnswer:true. |
|
498 | 1387 |
|
197 | 1388 |
" |
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
|
1389 |
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
|
1390 |
|
655 | 1391 |
Transcript showCR:( |
2298 | 1392 |
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
|
1393 |
) |
197 | 1394 |
" |
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
|
1395 |
|
3456 | 1396 |
"Modified: / 02-03-2007 / 15:25:34 / cg" |
197 | 1397 |
! |
1398 |
||
2317 | 1399 |
confirm:aString default:what |
1400 |
"launch a Dialog, which allows user to enter yes or no. |
|
1401 |
return true for yes, false for no. |
|
1402 |
InitialAnswer must be true or false and defines which button is to be |
|
1403 |
the default (i.e. return-) button" |
|
1404 |
||
3456 | 1405 |
^ self |
1406 |
confirm:aString |
|
1407 |
title:nil |
|
1408 |
yesLabel:nil noLabel:nil |
|
1409 |
initialAnswer:what. |
|
2453 | 1410 |
|
1411 |
" |
|
1412 |
Dialog confirm:'Are you happy' default:true |
|
1413 |
||
1414 |
Dialog confirm:'Are you happy' default:false |
|
1415 |
" |
|
3456 | 1416 |
|
1417 |
"Modified: / 02-03-2007 / 15:25:23 / cg" |
|
2317 | 1418 |
! |
1419 |
||
197 | 1420 |
confirm:aString initialAnswer:what |
1421 |
"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
|
1422 |
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
|
1423 |
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
|
1424 |
the default (i.e. return-) button" |
197 | 1425 |
|
2439 | 1426 |
^ self |
1427 |
confirm:aString |
|
1428 |
title:nil |
|
3456 | 1429 |
yesLabel:nil noLabel:nil |
2439 | 1430 |
initialAnswer:what. |
197 | 1431 |
|
1432 |
" |
|
1433 |
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
|
1434 |
|
655 | 1435 |
Transcript showCR:( |
2361 | 1436 |
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
|
1437 |
) |
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
|
1438 |
|
655 | 1439 |
Transcript showCR:( |
2361 | 1440 |
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
|
1441 |
) |
197 | 1442 |
" |
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
|
1443 |
|
3456 | 1444 |
"Modified: / 02-03-2007 / 15:24:52 / cg" |
197 | 1445 |
! |
1446 |
||
2618 | 1447 |
confirm:aString initialAnswer:what noLabel:noText |
1448 |
"launch a Dialog, which allows user to enter yes or no. |
|
1449 |
return true for yes, false for no. |
|
1450 |
InitialAnswer must be true or false and defines which button is to be |
|
1451 |
the default (i.e. return-) button" |
|
1452 |
||
1453 |
^ self |
|
1454 |
confirm:aString |
|
1455 |
title:nil |
|
3456 | 1456 |
yesLabel:nil noLabel:noText |
2618 | 1457 |
initialAnswer:what. |
3456 | 1458 |
|
1459 |
"Modified: / 02-03-2007 / 15:24:49 / cg" |
|
2618 | 1460 |
! |
1461 |
||
2079 | 1462 |
confirm:aString noLabel:noText |
1463 |
"launch a Dialog, which allows user to enter yes or no. |
|
1464 |
return true for yes, false for no. |
|
1465 |
The no-button is labeled noText (for example, if you need a 'cancel' there)" |
|
1466 |
||
1467 |
^ self |
|
1468 |
confirm:aString |
|
2493 | 1469 |
title:nil |
3456 | 1470 |
yesLabel:nil noLabel:noText |
1471 |
initialAnswer:true |
|
2079 | 1472 |
|
1473 |
" |
|
1474 |
Dialog confirm:'really ?' |
|
1475 |
||
2493 | 1476 |
Dialog confirm:'really ?' noLabel:'Cancel' |
2079 | 1477 |
" |
3456 | 1478 |
|
1479 |
"Modified: / 02-03-2007 / 15:24:43 / cg" |
|
1480 |
! |
|
1481 |
||
1482 |
confirm:aString title:title |
|
1483 |
"open a modal yes-no dialog. |
|
1484 |
Return true for yes, false for no" |
|
1485 |
||
1486 |
^ self |
|
1487 |
confirm:aString |
|
5700 | 1488 |
title:title |
3456 | 1489 |
yesLabel:nil noLabel:nil |
1490 |
initialAnswer:true |
|
1491 |
||
1492 |
" |
|
1493 |
Dialog confirm:'really ?' |
|
1494 |
||
1495 |
Transcript showCR:( |
|
1496 |
Dialog confirm:'are you certain ?' |
|
1497 |
) |
|
1498 |
" |
|
1499 |
||
1500 |
"Created: / 02-03-2007 / 15:21:25 / cg" |
|
2079 | 1501 |
! |
1502 |
||
1503 |
confirm:aString title:title noLabel:noText |
|
1504 |
"launch a Dialog, which allows user to enter yes or no. |
|
1505 |
return true for yes, false for no. |
|
1506 |
The no buttons label is defined by noText (for example, to make it 'cancel')." |
|
1507 |
||
1508 |
^ self |
|
2493 | 1509 |
confirm:aString |
1510 |
title:title |
|
1511 |
yesLabel:nil noLabel:noText |
|
3456 | 1512 |
initialAnswer:true |
2079 | 1513 |
|
1514 |
" |
|
1515 |
Dialog |
|
1516 |
confirm:'really ?' |
|
1517 |
title:'fooBar' |
|
2493 | 1518 |
noLabel:'Nope' |
2079 | 1519 |
" |
1520 |
||
1521 |
" |
|
1522 |
Dialog |
|
1523 |
confirm:'really ?' |
|
1524 |
title:nil |
|
2493 | 1525 |
noLabel:'Cancel' |
2079 | 1526 |
" |
3456 | 1527 |
|
1528 |
"Modified: / 02-03-2007 / 15:23:55 / cg" |
|
2079 | 1529 |
! |
1530 |
||
498 | 1531 |
confirm:aString title:title yesLabel:yesText noLabel:noText |
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1532 |
"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
|
1533 |
return true for yes, false for no. |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1534 |
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
|
1535 |
|
2493 | 1536 |
^ self |
1537 |
confirm:aString |
|
1538 |
title:title |
|
1539 |
yesLabel:yesText noLabel:noText |
|
1540 |
initialAnswer:true |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1541 |
|
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1542 |
" |
498 | 1543 |
Dialog |
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1544 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1545 |
title:'fooBar' |
2493 | 1546 |
yesLabel:'Oh well' |
1547 |
noLabel:'Nope' |
|
498 | 1548 |
" |
1549 |
||
881 | 1550 |
" |
1551 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1552 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1553 |
title:nil |
2493 | 1554 |
yesLabel:'Oh well' |
1555 |
noLabel:'Nope' |
|
881 | 1556 |
" |
1557 |
||
1558 |
" |
|
1559 |
Dialog |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1560 |
confirm:'really ?' |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1561 |
title:'' |
2493 | 1562 |
yesLabel:'Oh well' |
1563 |
noLabel:'Nope' |
|
1488
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1564 |
" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1565 |
|
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1566 |
"Created: / 21.2.1996 / 01:10:14 / cg" |
630b308c4295
ESC returns false in #confirm-dialog
Claus Gittinger <cg@exept.de>
parents:
1401
diff
changeset
|
1567 |
"Modified: / 18.4.1998 / 19:25:21 / cg" |
498 | 1568 |
! |
1569 |
||
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1570 |
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
|
1571 |
"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
|
1572 |
return true for yes, false for no. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1573 |
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
|
1574 |
|
3456 | 1575 |
|box answer t currentScreen| |
1576 |
||
1577 |
t := title. |
|
1578 |
t isNil ifTrue:[ t := self classResources string:'Confirm' ]. |
|
1579 |
||
1580 |
((currentScreen := Screen current) notNil and:[currentScreen nativeDialogs]) ifTrue:[ |
|
1581 |
"/ experimental |
|
1582 |
^ currentScreen |
|
1583 |
nativeConfirmYesNo:aString |
|
1584 |
title:t |
|
1585 |
initialAnswer:what |
|
1586 |
]. |
|
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1587 |
|
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1588 |
box := YesNoBox title:aString. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1589 |
yesText notNil ifTrue:[ |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1590 |
box yesLabel:yesText. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1591 |
]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1592 |
noText notNil ifTrue:[ |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1593 |
box noLabel:noText. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1594 |
]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1595 |
answer := false. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1596 |
box yesAction:[answer := true]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1597 |
|
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1598 |
box label:t. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1599 |
what == false ifTrue:[ |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1600 |
box okButton isReturnButton:false. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1601 |
box acceptReturnAsOK:false. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1602 |
box cancelButton beReturnButton. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1603 |
]. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1604 |
|
2439 | 1605 |
self showAndThenDestroyBox:box. |
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1606 |
box yesAction:nil noAction:nil. |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1607 |
^ answer |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1608 |
|
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1609 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1610 |
Dialog |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1611 |
confirm:'really ?' |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1612 |
title:'fooBar' |
2493 | 1613 |
yesLabel:'Oh well' |
1614 |
noLabel:'Nope' |
|
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1615 |
initialAnswer:true |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1616 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1617 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1618 |
Dialog |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1619 |
confirm:'really ?' |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1620 |
title:'fooBar' |
2493 | 1621 |
yesLabel:'Oh well' |
1622 |
noLabel:'Nope' |
|
2374
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1623 |
initialAnswer:false |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1624 |
" |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1625 |
|
3456 | 1626 |
"Created: / 21-02-1996 / 01:10:14 / cg" |
1627 |
"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
|
1628 |
! |
01d107c523aa
code reuse; added #confirm...yesLabel:noLabel:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
2362
diff
changeset
|
1629 |
|
2710 | 1630 |
confirm:msg withCancel:aBoolean |
1631 |
"launch a Dialog, which allows user to enter yes, no and optionally: cancel. |
|
5054 | 1632 |
Return true for 'yes', false for 'no', nil for 'cancel'" |
2710 | 1633 |
|
1634 |
aBoolean ifTrue:[ |
|
1635 |
^ Dialog confirmWithCancel:msg. |
|
1636 |
] ifFalse:[ |
|
1637 |
^ Dialog confirm:msg. |
|
1638 |
]. |
|
1639 |
||
1640 |
" |
|
1641 |
Dialog confirm:'really ?' withCancel:false |
|
1642 |
Dialog confirm:'really ?' withCancel:true |
|
1643 |
" |
|
1644 |
! |
|
1645 |
||
3357
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1646 |
confirm:msg withCancel:aBoolean default:default |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1647 |
"launch a Dialog, which allows user to enter yes, no and optionally: cancel. |
5054 | 1648 |
Return true for 'yes', false for 'no', nil for 'cancel'" |
3357
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1649 |
|
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1650 |
aBoolean ifTrue:[ |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1651 |
^ Dialog confirmWithCancel:msg default:default. |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1652 |
] ifFalse:[ |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1653 |
^ Dialog confirm:msg default:default. |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1654 |
]. |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1655 |
|
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1656 |
" |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1657 |
Dialog confirm:'really ?' withCancel:false |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1658 |
Dialog confirm:'really ?' withCancel:true |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1659 |
" |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1660 |
! |
f00242a1c6cd
+confirm:withCancel:default:
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
1661 |
|
3382 | 1662 |
confirm:aString yesLabel:yesText |
1663 |
"launch a Dialog, which allows user to enter yes or no. |
|
5054 | 1664 |
Return true for yes, false for no. |
3382 | 1665 |
The yes button's label is defined by yesText." |
1666 |
||
1667 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:nil |
|
1668 |
||
1669 |
" |
|
1670 |
Dialog |
|
1671 |
confirm:'really ?' |
|
1672 |
yesLabel:'Oh well' |
|
1673 |
" |
|
1674 |
||
1675 |
"Created: / 04-09-2006 / 11:18:50 / cg" |
|
1676 |
! |
|
1677 |
||
5054 | 1678 |
confirm:aString yesLabel:yesText initialAnswer:what |
1679 |
"launch a Dialog, which allows user to enter yes or no. |
|
1680 |
Return true for yes, false for no. |
|
1681 |
The yes button's label is defined by yesText." |
|
1682 |
||
1683 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:nil initialAnswer:what |
|
1684 |
||
1685 |
" |
|
1686 |
Dialog |
|
1687 |
confirm:'really ?' |
|
1688 |
yesLabel:'Oh well' |
|
1689 |
initialAnswer:false |
|
1690 |
" |
|
1691 |
||
1692 |
"Created: 21.2.1996 / 01:10:14 / cg" |
|
1693 |
"Modified: 8.3.1996 / 21:15:06 / cg" |
|
1694 |
! |
|
1695 |
||
498 | 1696 |
confirm:aString yesLabel:yesText noLabel:noText |
1697 |
"launch a Dialog, which allows user to enter yes or no. |
|
5054 | 1698 |
Return true for yes, false for no. |
3382 | 1699 |
The yes/no buttons' labels are defined by yesText/noText." |
498 | 1700 |
|
1701 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:noText |
|
1702 |
||
1703 |
" |
|
2493 | 1704 |
Dialog |
1705 |
confirm:'really ?' |
|
1706 |
yesLabel:'Oh well' |
|
1707 |
noLabel:'Nope' |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1708 |
" |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1709 |
|
3382 | 1710 |
"Created: / 21-02-1996 / 01:10:14 / cg" |
1711 |
"Modified: / 04-09-2006 / 11:19:00 / cg" |
|
253
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1712 |
! |
f071ff350cd5
added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
1713 |
|
3255 | 1714 |
confirm:aString yesLabel:yesText noLabel:noText initialAnswer:what |
1715 |
"launch a Dialog, which allows user to enter yes or no. |
|
5054 | 1716 |
Return true for yes, false for no. |
3255 | 1717 |
The yes/no buttons labels are defined by yesText/noText." |
1718 |
||
1719 |
^ self confirm:aString title:nil yesLabel:yesText noLabel:noText initialAnswer:what |
|
1720 |
||
1721 |
" |
|
1722 |
Dialog |
|
1723 |
confirm:'really ?' |
|
1724 |
yesLabel:'Oh well' |
|
1725 |
noLabel:'Nope' |
|
1726 |
initialAnswer:false |
|
1727 |
" |
|
1728 |
||
1729 |
"Created: 21.2.1996 / 01:10:14 / cg" |
|
1730 |
"Modified: 8.3.1996 / 21:15:06 / cg" |
|
1731 |
! |
|
1732 |
||
2790 | 1733 |
confirmOKCancel:aString |
1734 |
"launch a Dialog, which allows user to enter OK or Cancel. |
|
1735 |
return true for OK, false for Cancel." |
|
1736 |
||
1737 |
|resources| |
|
1738 |
||
1739 |
resources := self classResources. |
|
1740 |
^ self |
|
1741 |
confirm:aString |
|
1742 |
yesLabel:(resources string:'OK') |
|
1743 |
noLabel:(resources string:'Cancel') |
|
1744 |
||
1745 |
" |
|
1746 |
Dialog confirmOKCancel:'really ?' |
|
1747 |
" |
|
1748 |
! |
|
1749 |
||
197 | 1750 |
confirmWithCancel:aString |
1751 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1752 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
1753 |
||
3456 | 1754 |
^ self |
1755 |
confirmWithCancel:aString |
|
5321 | 1756 |
default:true |
3456 | 1757 |
title:nil |
1004 | 1758 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1759 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1760 |
Dialog confirmWithCancel:'really ?' |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1761 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1762 |
|
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1763 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1764 |
Transcript showCR:( |
3456 | 1765 |
Dialog confirmWithCancel:'really ?' |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1766 |
) |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1767 |
" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1768 |
|
3456 | 1769 |
"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
|
1770 |
! |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1771 |
|
1004 | 1772 |
confirmWithCancel:aString default:default |
1773 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1774 |
return true for 'yes', false for 'no', nil for 'cancel'. |
|
1775 |
The default argument marks the return-button; it may be one of nil, false or true" |
|
1776 |
||
3456 | 1777 |
^ self |
2415 | 1778 |
confirmWithCancel:aString |
3456 | 1779 |
default:default |
1780 |
title:nil |
|
2790 | 1781 |
|
1004 | 1782 |
" |
1783 |
Dialog confirmWithCancel:'really ?' default:false |
|
2437 | 1784 |
Dialog confirmWithCancel:'really ?' default:true |
1004 | 1785 |
" |
3456 | 1786 |
|
1787 |
"Modified: / 02-03-2007 / 15:26:13 / cg" |
|
1004 | 1788 |
! |
1789 |
||
2788
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1790 |
confirmWithCancel:aString default:defaultValue onCancel:cancelValue |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1791 |
"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
|
1792 |
return true for 'yes', false for 'no', cancelValues value for 'cancel'" |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1793 |
|
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1794 |
|answer| |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1795 |
|
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1796 |
answer := self confirmWithCancel:aString default:defaultValue. |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1797 |
answer isNil ifTrue:[ |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1798 |
^ cancelValue value |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1799 |
]. |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1800 |
^ answer |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1801 |
|
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1802 |
" |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1803 |
Dialog confirmWithCancel:'really ?' onCancel:[AbortSignal raise] |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1804 |
" |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1805 |
! |
6e4b5ada3f89
+confirmWithCancel:default:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2787
diff
changeset
|
1806 |
|
3456 | 1807 |
confirmWithCancel:aString default:default title:titleString |
1808 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
1809 |
return true for 'yes', false for 'no', nil for 'cancel'. |
|
1810 |
The default argument marks the return-button; it may be one of nil, false or true" |
|
1811 |
||
1812 |
^ self |
|
1813 |
confirmWithCancel:aString |
|
1814 |
labels:(self classResources array:#('Cancel' 'No' 'Yes') ) |
|
1815 |
values:#(nil false true) |
|
1816 |
default:(#(nil false true) indexOf:default ifAbsent:nil) |
|
1817 |
title:titleString |
|
1818 |
||
1819 |
" |
|
1820 |
Dialog confirmWithCancel:'really ?' default:false |
|
1821 |
Dialog confirmWithCancel:'really ?' default:true |
|
1822 |
" |
|
1823 |
||
1824 |
"Created: / 02-03-2007 / 15:09:56 / cg" |
|
1825 |
! |
|
1826 |
||
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1827 |
confirmWithCancel:aString labels:labelArray |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1828 |
"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
|
1829 |
Return true for 'yes', false for 'no', nil for 'cancel'. |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1830 |
The default is yes. |
4682 | 1831 |
The buttons labels are given in labelArray, cancel being first, yes being last |
1832 |
(notice that the order may get reversed in some styles)" |
|
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1833 |
|
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1834 |
^ self |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1835 |
confirmWithCancel:aString |
3456 | 1836 |
labels:(self classResources array:labelArray) |
1837 |
default:3 |
|
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1838 |
" |
2493 | 1839 |
Dialog confirmWithCancel:'really ?' labels:#( 'Oops' 'Nope' 'Yea') |
4682 | 1840 |
Dialog confirmWithCancel:'really ?' |
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1841 |
" |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1842 |
|
3456 | 1843 |
"Modified: / 02-03-2007 / 15:10:34 / cg" |
1624
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1844 |
! |
bc716c00b226
added #confirmWithCancel:labels:
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
1845 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1846 |
confirmWithCancel:aString labels:buttonLabels default:default |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1847 |
"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
|
1848 |
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
|
1849 |
The strings for cancel, no and yes are to be passed in |
6012 | 1850 |
buttonLabels, with cancel/abort being the first. |
1004 | 1851 |
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
|
1852 |
return button (1 to 3)" |
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1853 |
|
1707 | 1854 |
^ self |
1855 |
confirmWithCancel:aString |
|
1856 |
labels:buttonLabels |
|
1857 |
values:#(nil false true) |
|
1858 |
default:default |
|
1859 |
||
1860 |
" |
|
1861 |
Transcript showCR:( |
|
1862 |
Dialog |
|
1863 |
confirmWithCancel:'really ?' |
|
2493 | 1864 |
labels:#('mhmh' 'Maybe' 'Definitely') |
1707 | 1865 |
default:3 |
1866 |
) |
|
1867 |
" |
|
1868 |
||
1869 |
"Created: / 18.10.1996 / 14:50:51 / cg" |
|
1870 |
"Modified: / 21.10.1998 / 15:49:16 / cg" |
|
1871 |
! |
|
1872 |
||
1873 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default |
|
1874 |
"launch a Dialog, which allows user to click on any button. |
|
1875 |
Return the corresponding value from the values array. |
|
5854 | 1876 |
The labels for the buttons are to be passed in |
6012 | 1877 |
buttonLabels, with cancel/abort being the first. |
1707 | 1878 |
The default argument (if non-nil) defines the index of the |
1879 |
return button (1 to n)" |
|
1880 |
||
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1881 |
^ self |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1882 |
confirmWithCancel:aString |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1883 |
labels:buttonLabels |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1884 |
values:buttonValues |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1885 |
default:default |
3456 | 1886 |
title:nil |
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1887 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1888 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1889 |
Transcript showCR:( |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1890 |
Dialog |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1891 |
confirmWithCancel:'really ?' |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1892 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1893 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1894 |
default:3 |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1895 |
) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1896 |
" |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1897 |
|
3456 | 1898 |
"Created: / 18-10-1996 / 14:50:51 / cg" |
1899 |
"Modified: / 02-03-2007 / 15:09:24 / cg" |
|
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1900 |
! |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1901 |
|
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1902 |
confirmWithCancel:aString labels:buttonLabels values:buttonValues default:default boxLabel:boxLabelOrNil |
6012 | 1903 |
<resource: #obsolete> |
1904 |
||
3456 | 1905 |
"obsolete - for backward compatibility" |
1906 |
||
1907 |
^ self |
|
1908 |
confirmWithCancel:aString |
|
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1909 |
labels:buttonLabels |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1910 |
values:buttonValues |
3456 | 1911 |
default:default |
1912 |
title:boxLabelOrNil |
|
1913 |
||
1914 |
"Modified: / 02-03-2007 / 15:09:11 / cg" |
|
1915 |
! |
|
1916 |
||
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1917 |
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
|
1918 |
"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
|
1919 |
Return the corresponding value from the values array. |
5854 | 1920 |
The labels for the buttons are to be passed in |
6012 | 1921 |
buttonLabels, with cancel/abort being the first. |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1922 |
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
|
1923 |
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
|
1924 |
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
|
1925 |
|
3701 | 1926 |
|box buttons answer i| |
197 | 1927 |
|
5854 | 1928 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
1929 |
box buttonTitles:buttonLabels |
1707 | 1930 |
actions:(buttonValues collect:[:v | [answer := v]]). |
2972
d66d46e04cd4
Use #image:/#label: instead of obsolete #form:
Stefan Vogel <sv@exept.de>
parents:
2966
diff
changeset
|
1931 |
box image:(YesNoBox iconBitmap). |
3622 | 1932 |
default notNil ifTrue:[ |
5854 | 1933 |
box defaultButtonIndex:(default isInteger |
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
|
1934 |
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
|
1935 |
ifFalse:[ buttonValues indexOf:default]) |
3622 | 1936 |
]. |
2493 | 1937 |
box label:(boxLabelOrNil ? (self classResources string:'Confirm')). |
3701 | 1938 |
buttons := box buttons. |
2907
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1939 |
(i := buttonValues indexOf:true) ~~ 0 ifTrue:[ |
3701 | 1940 |
i <= buttons size ifTrue:[ |
1941 |
(buttons at:i) cursor:(Cursor thumbsUp). |
|
3218 | 1942 |
] |
2907
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1943 |
]. |
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1944 |
(i := buttonValues indexOf:false) ~~ 0 ifTrue:[ |
3701 | 1945 |
i <= buttons size ifTrue:[ |
1946 |
(buttons at:i) cursor:(Cursor thumbsDown). |
|
3218 | 1947 |
] |
2907
8867601e24c6
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2830
diff
changeset
|
1948 |
]. |
2908
b26616b2e603
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2907
diff
changeset
|
1949 |
(i := buttonValues indexOf:nil) ~~ 0 ifTrue:[ |
3701 | 1950 |
i <= buttons size ifTrue:[ |
1951 |
(buttons at:i) cursor:(Cursor thumbsDown). |
|
3218 | 1952 |
] |
2908
b26616b2e603
thumbsUp/Down in confirm dialog
Claus Gittinger <cg@exept.de>
parents:
2907
diff
changeset
|
1953 |
]. |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1954 |
checkLabelOrNil notNil ifTrue:[ |
4380
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
1955 |
box addCheckBoxAtBottom:checkLabelOrNil on:checkHolderOrNil. |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1956 |
]. |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1957 |
|
2439 | 1958 |
self showAndThenDestroyBox:box. |
197 | 1959 |
box actions:nil. |
1960 |
^ answer |
|
1961 |
||
1962 |
" |
|
1707 | 1963 |
Transcript showCR:( |
5854 | 1964 |
Dialog |
1707 | 1965 |
confirmWithCancel:'really ?' |
1748
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1966 |
labels:#('mhmh' 'maybe' 'definitely') |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1967 |
values:#(1 2 3) |
88215be18503
+ confirmWithCancel:labels:values:default:boxLabel:
Claus Gittinger <cg@exept.de>
parents:
1740
diff
changeset
|
1968 |
default:3 |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1969 |
check:'Again' on:(true asValue) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1970 |
title:'hello there' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1971 |
) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1972 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1973 |
Transcript showCR:( |
5854 | 1974 |
Dialog |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1975 |
confirmWithCancel:'really ?' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1976 |
labels:#('mhmh' 'maybe' 'definitely') |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1977 |
values:#(1 2 3) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1978 |
default:3 |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1979 |
check:nil on:nil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1980 |
title:'hello there' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1981 |
) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1982 |
" |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1983 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1984 |
"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
|
1985 |
! |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1986 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1987 |
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
|
1988 |
"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
|
1989 |
Return the corresponding value from the values array. |
5854 | 1990 |
The labels for the buttons are to be passed in |
6012 | 1991 |
buttonLabels, with cancel/abort being the first. |
5854 | 1992 |
The default argument (if non-nil) defines the index of the |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1993 |
return button (1 to n)" |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1994 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
1995 |
^ self |
5854 | 1996 |
confirmWithCancel:aString |
1997 |
labels:buttonLabels |
|
1998 |
values:buttonValues |
|
1999 |
default:default |
|
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2000 |
check:nil on:nil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2001 |
title:boxLabelOrNil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2002 |
|
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2003 |
" |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2004 |
Transcript showCR:( |
5854 | 2005 |
Dialog |
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2006 |
confirmWithCancel:'really ?' |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2007 |
labels:#('mhmh' 'maybe' 'definitely') |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2008 |
values:#(1 2 3) |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2009 |
default:3 |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2010 |
title:'hello there' |
1707 | 2011 |
) |
2012 |
" |
|
2013 |
||
3456 | 2014 |
"Created: / 02-03-2007 / 15:08:49 / cg" |
2787
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2015 |
! |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2016 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2017 |
confirmWithCancel:aString onCancel:cancelValue |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2018 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2019 |
return true for 'yes', false for 'no', cancelValues value for 'cancel'" |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2020 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2021 |
|answer| |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2022 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2023 |
answer := self confirmWithCancel:aString. |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2024 |
answer isNil ifTrue:[ |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2025 |
^ cancelValue value |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2026 |
]. |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2027 |
^ answer |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2028 |
|
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2029 |
" |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2030 |
Dialog confirmWithCancel:'really ?' onCancel:[AbortSignal raise] |
401103ebccb7
+confirmWithCancel:onCancel:
Claus Gittinger <cg@exept.de>
parents:
2781
diff
changeset
|
2031 |
" |
3456 | 2032 |
! |
2033 |
||
2034 |
confirmWithCancel:aString title:titleString |
|
2035 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
2036 |
return true for 'yes', false for 'no', nil for 'cancel'" |
|
2037 |
||
3906
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2038 |
^ self |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2039 |
confirmWithCancel:aString |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2040 |
default:nil |
75ca4638f79e
added a public entry to confirm with an additional
Claus Gittinger <cg@exept.de>
parents:
3902
diff
changeset
|
2041 |
title:titleString |
3456 | 2042 |
|
2043 |
" |
|
2044 |
Dialog confirmWithCancel:'really ?' |
|
2045 |
" |
|
2046 |
||
2047 |
" |
|
2048 |
Transcript showCR:( |
|
2049 |
Dialog confirmWithCancel:'really ?' |
|
2050 |
) |
|
2051 |
" |
|
2052 |
||
2053 |
"Created: / 02-03-2007 / 15:11:14 / cg" |
|
6115 | 2054 |
! |
2055 |
||
2056 |
confirmWithRaiseAbortOnCancel:aString |
|
2057 |
"launch a Dialog, which allows user to enter yes, no and cancel. |
|
2058 |
Return true for 'yes', false for 'no'. |
|
2059 |
Raise the abort signal 'cancel'" |
|
2060 |
||
2061 |
|answer| |
|
2062 |
||
2063 |
answer := self |
|
2064 |
confirmWithCancel:aString |
|
2065 |
default:true |
|
2066 |
title:nil. |
|
2067 |
answer isNil ifTrue:[ |
|
2068 |
AbortOperationRequest raiseRequest. |
|
2069 |
]. |
|
2070 |
^ answer. |
|
2071 |
||
2072 |
" |
|
2073 |
Dialog confirmWithRaiseAbortOnCancel:'really ?' |
|
2074 |
" |
|
2075 |
||
2076 |
" |
|
2077 |
Transcript showCR:( |
|
2078 |
Dialog confirmWithRaiseAbortOnCancel:'really ?' |
|
2079 |
) |
|
2080 |
" |
|
2081 |
||
2082 |
"Created: / 04-03-2017 / 10:23:36 / 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
|
2083 |
! ! |
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
|
2084 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2085 |
!DialogBox class methodsFor:'defaults'! |
573 | 2086 |
|
2087 |
defaultLabel |
|
2088 |
"return the boxes default window title." |
|
2089 |
||
2090 |
^ 'Dialog' |
|
2091 |
||
2092 |
"Created: 23.4.1996 / 17:13:10 / cg" |
|
1757 | 2093 |
! |
2094 |
||
2095 |
updateStyleCache |
|
2096 |
"extract values from the styleSheet and cache them in class variables" |
|
2097 |
||
2098 |
<resource: #style (#'dialogBox.returnShiftsFocusToOK')> |
|
2099 |
||
2100 |
DefaultFocusToOKOnLeave := StyleSheet at:'dialogBox.returnShiftsFocusToOK' default:false. |
|
2101 |
||
573 | 2102 |
! ! |
2103 |
||
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
2104 |
!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
|
2105 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2106 |
requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2107 |
"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
|
2108 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2109 |
^ self |
2825 | 2110 |
requestDirectoryName:'Select Directory' |
2111 |
default:nil |
|
2112 |
ok:nil abort:nil |
|
2113 |
ifFail:'' |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2114 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2115 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2116 |
Dialog requestDirectoryName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2117 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2118 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2119 |
"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
|
2120 |
"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
|
2121 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2122 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2123 |
requestDirectoryName:title |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2124 |
"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
|
2125 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2126 |
^ self |
2825 | 2127 |
requestDirectoryName:title |
2128 |
default:nil |
|
2129 |
ok:nil abort:nil |
|
2130 |
ifFail:'' |
|
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 |
2825 | 2134 |
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
|
2135 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2136 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2137 |
"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
|
2138 |
"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
|
2139 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2140 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2141 |
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
|
2142 |
"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
|
2143 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2144 |
^ self |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2145 |
requestDirectoryName:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2146 |
default:aFileName |
2825 | 2147 |
ok:nil abort:nil |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2148 |
ifFail:'' |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2149 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2150 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2151 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2152 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2153 |
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
|
2154 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2155 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2156 |
"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
|
2157 |
"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
|
2158 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2159 |
|
2966 | 2160 |
requestDirectoryName:title default:aFileName acceptReturnAsOK:aBoolean |
2161 |
"same as requestFileName, but only show directories" |
|
2162 |
||
2163 |
^ self |
|
2164 |
requestDirectoryName:title |
|
2165 |
default:aFileName |
|
2166 |
ok:nil abort:nil |
|
2167 |
ifFail:'' |
|
2168 |
acceptReturnAsOK:aBoolean |
|
2169 |
||
2170 |
" |
|
2171 |
Dialog |
|
2172 |
requestDirectoryName:'which directory ?' |
|
2173 |
default:'/etc' |
|
2174 |
" |
|
2175 |
||
2176 |
"Created: 19.4.1996 / 14:29:10 / cg" |
|
2177 |
"Modified: 19.4.1996 / 14:31:52 / cg" |
|
2178 |
! |
|
2179 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2180 |
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
|
2181 |
"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
|
2182 |
|
2825 | 2183 |
^ self |
2184 |
requestDirectoryName:title |
|
2185 |
default:aFileName |
|
2186 |
ok:nil abort:nil |
|
2187 |
ifFail:failBlock |
|
2188 |
||
2189 |
" |
|
2190 |
Dialog |
|
2191 |
requestDirectoryName:'which directory ?' |
|
2192 |
default:'/etc' |
|
2193 |
ifFail:'none' 'none' |
|
2194 |
" |
|
2195 |
||
2196 |
"Created: 19.4.1996 / 14:31:04 / cg" |
|
2197 |
"Modified: 23.10.1997 / 19:24:41 / cg" |
|
2198 |
! |
|
2199 |
||
2200 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText |
|
2201 |
"same as requestFileName, but only show directories" |
|
2202 |
||
2203 |
^ self |
|
2204 |
requestDirectoryName:title |
|
2205 |
default:aFileName |
|
2206 |
ok:okText abort:abortText |
|
2207 |
ifFail:'' |
|
2208 |
||
2209 |
" |
|
2210 |
Dialog |
|
2211 |
requestDirectoryName:'which directory ?' |
|
2212 |
default:'/etc' |
|
2213 |
ok:'Yes' abort:'No' |
|
2214 |
" |
|
2215 |
||
2216 |
"Created: 19.4.1996 / 14:31:04 / cg" |
|
2217 |
"Modified: 23.10.1997 / 19:24:41 / cg" |
|
2218 |
! |
|
2219 |
||
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2220 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2221 |
"Same as requestFileName, but only show directories." |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2222 |
|
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2223 |
^ self |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2224 |
requestDirectoryName:title |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2225 |
default:aFileName |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2226 |
ok:okText |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2227 |
abort:abortText |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2228 |
ifFail:failBlock |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2229 |
acceptReturnAsOK:false |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2230 |
|
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2231 |
"Modified (format): / 23-01-2012 / 11:46:08 / cg" |
2966 | 2232 |
! |
2233 |
||
2234 |
requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
|
2235 |
"Same as requestFileName, but only show directories. |
|
2236 |
Extended to accept return as ok if wanted." |
|
2825 | 2237 |
|
2238 |
|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
|
2239 |
|
2621 | 2240 |
UserPreferences current useNewFileDialog ifTrue:[ |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2241 |
FileDialog notNil ifTrue:[ |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2242 |
^ "FileDialogV2" FileDialog requestDirectoryName:title default:aFileName ok:okText abort:abortText ifFail:failBlock acceptReturnAsOK:aBoolean |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2243 |
] |
2621 | 2244 |
]. |
2789 | 2245 |
|
2246 |
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
|
2247 |
fileBox := FileSelectionBox |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2248 |
title:title |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2249 |
action:[:fileName | enteredName := fileName]. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2250 |
|
3352 | 2251 |
fileBox acceptReturnAsOK:aBoolean. |
2966 | 2252 |
|
2825 | 2253 |
okText notNil |
2254 |
ifTrue:[ t := okText ] |
|
2255 |
ifFalse:[ t := resources string:'OK' ]. |
|
2256 |
fileBox okText:t. |
|
2257 |
||
2258 |
abortText notNil |
|
2259 |
ifTrue:[ t := abortText ] |
|
2260 |
ifFalse:[ t := resources string:'Cancel' ]. |
|
2261 |
fileBox abortText:t. |
|
2262 |
||
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2263 |
fN := aFileName. |
1780
bfc30a82aae3
dont get confused with a nil default
Claus Gittinger <cg@exept.de>
parents:
1764
diff
changeset
|
2264 |
dirF := (aFileName ? '.') asFilename. |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2265 |
dirF name = dirF baseName ifFalse:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2266 |
dir := dirF directoryName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2267 |
fN := dirF baseName. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2268 |
] ifTrue:[ |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2269 |
dir := FileSelectionBox lastFileSelectionDirectory. |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2270 |
]. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2271 |
dir notNil ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2272 |
fileBox directory:dir. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2273 |
]. |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2274 |
|
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2275 |
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
|
2276 |
fileBox selectingDirectory:true. |
2439 | 2277 |
|
2278 |
self showAndThenDestroyBox:fileBox. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2279 |
|
3237
4c6fe0664cab
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
3234
diff
changeset
|
2280 |
(enteredName isEmptyOrNil) ifTrue:[ |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2281 |
^ failBlock value |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2282 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2283 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2284 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2285 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2286 |
^ enteredName |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2287 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2288 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2289 |
Dialog |
1740
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2290 |
requestDirectoryName:'which directory ?' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2291 |
default:'/etc' |
0160c5afae9c
care for default-dir in #requestDirectoryName:..
Claus Gittinger <cg@exept.de>
parents:
1736
diff
changeset
|
2292 |
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
|
2293 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2294 |
|
3352 | 2295 |
"Created: / 19-04-1996 / 14:31:04 / cg" |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2296 |
"Modified: / 23-01-2012 / 11:43:07 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2297 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2298 |
|
2631 | 2299 |
requestDirectoryName:titleString default:aFileName ok:okText abort:abortText version:versionSymbol pattern:pattern fromDirectory:aDirectoryPath ifFail:failBlock whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
2300 |
"same as requestFileName, but only show directories" |
|
2301 |
||
4353
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2302 |
UserPreferences current useNewFileDialog ifTrue:[ |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2303 |
FileDialog notNil ifTrue:[ |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2304 |
^ FileDialog |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2305 |
requestDirectoryName:titleString |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2306 |
default:aFileName |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2307 |
ok:okText |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2308 |
abort:abortText |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2309 |
version:versionSymbol |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2310 |
pattern:pattern |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2311 |
fromDirectory:aDirectoryPath |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2312 |
ifFail:failBlock |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2313 |
whenBoxCreatedEvaluate:boxCreatedCallback |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2314 |
asLoadDialog:aBoolean. |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2315 |
]. |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2316 |
]. |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2317 |
^ self |
2631 | 2318 |
requestDirectoryName:titleString |
2319 |
default:aFileName |
|
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2320 |
ok:okText abort:abortText |
2631 | 2321 |
ifFail:failBlock |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2322 |
acceptReturnAsOK:true |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2323 |
|
4353
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2324 |
"Modified: / 23-01-2012 / 17:23:27 / cg" |
2631 | 2325 |
! |
2326 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2327 |
requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2328 |
"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
|
2329 |
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
|
2330 |
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
|
2331 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2332 |
^ self |
1401 | 2333 |
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
|
2334 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2335 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2336 |
Dialog requestFileName |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2337 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2338 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2339 |
"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
|
2340 |
"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
|
2341 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2342 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2343 |
requestFileName:titleString |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2344 |
"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
|
2345 |
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
|
2346 |
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
|
2347 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2348 |
^ self |
1401 | 2349 |
requestFileName:titleString |
2350 |
default:'file.ext' |
|
183 | 2351 |
|
197 | 2352 |
" |
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
|
2353 |
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
|
2354 |
Dialog requestFileName:'enter a fileName:' |
183 | 2355 |
" |
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
|
2356 |
|
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
|
2357 |
"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
|
2358 |
"Modified: 19.4.1996 / 13:53:17 / cg" |
118 | 2359 |
! |
2360 |
||
100 | 2361 |
requestFileName:titleString default:defaultName |
2362 |
"launch a Dialog, which allows user to enter a filename. |
|
2363 |
The box will not allow pressing 'ok' without an entered string. |
|
2364 |
Return the pathname string consisting of the full pathname of the filename, |
|
2365 |
or an empty string (if cancel was pressed)." |
|
2366 |
||
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2367 |
^ self |
4357
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2368 |
requestFileName:titleString |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2369 |
default:defaultName |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2370 |
version:nil |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2371 |
ifFail:'' |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2372 |
|
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2373 |
" |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2374 |
Dialog requestFileName:'Enter a fileName:' default:'' |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2375 |
Dialog requestFileName:'Enter a fileName:' default:'Makefile.bak' |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2376 |
" |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2377 |
|
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2378 |
"Modified: / 19-04-1996 / 13:47:44 / cg" |
157138969646
comment/format in: #requestFileName:default:
Claus Gittinger <cg@exept.de>
parents:
4354
diff
changeset
|
2379 |
"Modified (comment): / 23-01-2012 / 18:02:51 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2380 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2381 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2382 |
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
|
2383 |
"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
|
2384 |
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
|
2385 |
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
|
2386 |
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
|
2387 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2388 |
^ self |
4181 | 2389 |
requestFileName:titleString |
2390 |
default:defaultName |
|
2391 |
version:nil |
|
2392 |
ifFail:'' |
|
2393 |
pattern:nil |
|
2394 |
fromDirectory:aDirectoryPath |
|
2395 |
forSave:false |
|
2396 |
whenBoxCreatedEvaluate:nil |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2397 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2398 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2399 |
Dialog |
4181 | 2400 |
requestFileName:'enter a fileName:' |
2401 |
default:'Makefile.bak' |
|
2402 |
fromDirectory:'..' |
|
2403 |
" |
|
2404 |
||
2405 |
"Modified: / 27-10-2010 / 10:40:42 / cg" |
|
100 | 2406 |
! |
2407 |
||
2637
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2408 |
requestFileName:titleString default:defaultName ifFail:cancelBlockOrValue |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2409 |
"launch a Dialog, which allows user to enter a filename. |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2410 |
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
|
2411 |
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
|
2412 |
or an empty string (if cancel was pressed)." |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2413 |
|
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2414 |
^ self |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2415 |
requestFileName:titleString |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2416 |
default:defaultName |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2417 |
version:nil |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2418 |
ifFail:cancelBlockOrValue |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2419 |
|
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2420 |
" |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2421 |
Dialog requestFileName:'enter a fileName:' default:'' |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2422 |
Dialog requestFileName:'enter a fileName:' default:'Makefile.bak' |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2423 |
" |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2424 |
|
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2425 |
"Modified: 19.4.1996 / 13:47:44 / cg" |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2426 |
! |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
2427 |
|
1736 | 2428 |
requestFileName:titleString default:defaultName ifFail:failReturn pattern:pattern fromDirectory:dir |
2429 |
"launch a Dialog, which allows user to enter a filename. |
|
2430 |
The files presented initially are those from dir. |
|
2431 |
The box will show ok/cancel in its buttons. |
|
2432 |
The matchPattern is set to pattern initially. |
|
2433 |
Return the string or failReturn if cancel was pressed." |
|
2434 |
||
2435 |
^ self |
|
2436 |
requestFileName:titleString |
|
2437 |
default:defaultName |
|
2438 |
version:nil |
|
2439 |
ifFail:failReturn |
|
2440 |
pattern:pattern |
|
2441 |
fromDirectory:dir |
|
2442 |
||
2443 |
! |
|
2444 |
||
2825 | 2445 |
requestFileName:titleString default:defaultName ok:okText abort:abortText |
2446 |
"launch a Dialog, which allows user to enter a filename. |
|
2447 |
The files presented initially are those from the current directory. |
|
2448 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2449 |
The matchPattern is set to pattern initially. |
|
2450 |
Return the string or nil if cancel was pressed." |
|
2451 |
||
2452 |
^ self |
|
2453 |
requestFileName:titleString |
|
2454 |
default:defaultName |
|
2455 |
ok:okText abort:abortText |
|
2456 |
pattern:'*' |
|
2457 |
||
2458 |
" |
|
2459 |
Dialog |
|
2460 |
requestFileName:'enter a fileName:' |
|
2461 |
default:'' |
|
2462 |
ok:'yeah' |
|
2463 |
abort:'oh, no' |
|
2464 |
" |
|
2465 |
! |
|
2466 |
||
197 | 2467 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern |
2468 |
"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
|
2469 |
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
|
2470 |
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
|
2471 |
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
|
2472 |
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
|
2473 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2474 |
^ self |
1401 | 2475 |
requestFileName:titleString |
2476 |
default:defaultName |
|
2477 |
ok:okText |
|
2478 |
abort:abortText |
|
2479 |
pattern:pattern |
|
2480 |
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
|
2481 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2482 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2483 |
Dialog |
1401 | 2484 |
requestFileName:'enter a fileName:' |
2485 |
default:'' |
|
2486 |
ok:'yeah' |
|
2487 |
abort:'oh, no' |
|
2488 |
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
|
2489 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2490 |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2491 |
"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
|
2492 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2493 |
|
2218 | 2494 |
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
|
2495 |
"launch a Dialog, which allows user to enter a filename. |
2218 | 2496 |
The files presented initially are those in aDirectoryPathOrNil, or the |
2497 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
197 | 2498 |
The box will show okText in its okButton, abortText in the abortButton. |
2499 |
The matchPattern is set to pattern initially. |
|
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
2500 |
Return the string, or nil if cancel was pressed." |
197 | 2501 |
|
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2502 |
^ self |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2503 |
requestFileName:titleString |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2504 |
default:defaultName |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2505 |
ok:okText |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2506 |
abort:abortText |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2507 |
pattern:pattern |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2508 |
fromDirectory:aDirectoryPathOrNil |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2509 |
whenBoxCreatedEvaluate:nil |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2510 |
! |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2511 |
|
4181 | 2512 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil forSave:forSave |
2513 |
"launch a Dialog, which allows user to enter a filename. |
|
2514 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
2515 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
2516 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2517 |
The matchPattern is set to pattern initially. |
|
2518 |
Return the string, or nil if cancel was pressed." |
|
2519 |
||
2520 |
^ self |
|
2521 |
requestFileName:titleString |
|
2522 |
default:defaultName |
|
2523 |
ok:okText |
|
2524 |
abort:abortText |
|
2525 |
pattern:pattern |
|
2526 |
fromDirectory:aDirectoryPathOrNil |
|
2527 |
forSave:forSave |
|
2528 |
whenBoxCreatedEvaluate:nil |
|
2529 |
||
2530 |
"Created: / 27-10-2010 / 11:22:58 / cg" |
|
2531 |
! |
|
2532 |
||
2533 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil forSave:forSave whenBoxCreatedEvaluate:boxCreatedCallback |
|
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2534 |
"launch a Dialog, which allows user to enter a filename. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2535 |
The files presented initially are those in aDirectoryPathOrNil, or the |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2536 |
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
|
2537 |
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
|
2538 |
The matchPattern is set to pattern initially. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2539 |
Return the string, or nil if cancel was pressed." |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2540 |
|
5619 | 2541 |
^ self |
2542 |
requestFileName:titleString |
|
2543 |
default:defaultName |
|
2544 |
ok:okText abort:abortText |
|
2545 |
pattern:pattern |
|
2546 |
orFilters:nil |
|
2547 |
"argument #filtersOrNil is window specific, |
|
2548 |
it is an array of arrays with filter (*.zip) and its description (ZIP compressed archive file) |
|
2549 |
to support a call with just #filtersOrNil and no #patternOrNil the pattern will be extracted from the #filtersOrNil for linux" |
|
2550 |
||
2551 |
fromDirectory:aDirectoryPathOrNil |
|
2552 |
forSave:forSave |
|
2553 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
2554 |
! |
|
2555 |
||
2556 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
2557 |
"launch a Dialog, which allows user to enter a filename. |
|
2558 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
2559 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
2560 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2561 |
The matchPattern is set to pattern initially. |
|
2562 |
Return the string, or nil if cancel was pressed." |
|
2563 |
||
2564 |
^ self |
|
2565 |
requestFileName:titleString |
|
2566 |
default:defaultName |
|
2567 |
ok:okText |
|
2568 |
abort:abortText |
|
2569 |
pattern:pattern |
|
2570 |
fromDirectory:aDirectoryPathOrNil |
|
2571 |
forSave:false |
|
2572 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
2573 |
||
2574 |
" |
|
2575 |
Dialog |
|
2576 |
requestFileName:'enter a fileName:' |
|
2577 |
default:'' |
|
2578 |
ok:'yeah' |
|
2579 |
abort:'oh, no' |
|
2580 |
pattern:'rc*' |
|
2581 |
fromDirectory:'/etc' |
|
2582 |
" |
|
2583 |
||
2584 |
"Modified: / 24-08-2010 / 17:28:57 / sr" |
|
2585 |
"Modified: / 27-10-2010 / 11:21:44 / cg" |
|
2586 |
! |
|
2587 |
||
2588 |
requestFileName:titleString default:defaultName ok:okText abort:abortText pattern:patternOrNil orFilters:filtersOrNil fromDirectory:aDirectoryPathOrNil forSave:forSave whenBoxCreatedEvaluate:boxCreatedCallback |
|
2589 |
"launch a Dialog, which allows user to enter a filename. |
|
2590 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
2591 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
2592 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2593 |
The matchPattern is set to pattern initially. |
|
2594 |
Return the string, or nil if cancel was pressed." |
|
2595 |
||
2596 |
"argument #filtersOrNil is window specific, |
|
2597 |
it is an array of arrays with filter (*.zip) and its description (ZIP compressed archive file) |
|
2598 |
to support a call with just #filtersOrNil and no #patternOrNil the pattern will be extracted from the #filtersOrNil for linux" |
|
2599 |
||
2600 |
|box defaultDir defaultNm dir enteredName |
|
2601 |
pattern| |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2602 |
|
4164 | 2603 |
Screen current nativeFileDialogs ifTrue:[ |
3575
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2604 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2605 |
Win32FileDialog notNil ifTrue:[ |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2606 |
^ Win32FileDialog |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2607 |
fileDialogFor:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2608 |
save:forSave |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2609 |
title:titleString |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2610 |
inDirectory:aDirectoryPathOrNil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2611 |
initialAnswer:defaultName |
5619 | 2612 |
pattern:patternOrNil |
2613 |
orFilters:filtersOrNil |
|
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2614 |
extension:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2615 |
]. |
3575
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2616 |
]. |
01ed1cd65ff8
more native stuff (preparation only)
Claus Gittinger <cg@exept.de>
parents:
3574
diff
changeset
|
2617 |
]. |
5619 | 2618 |
|
2619 |
patternOrNil isNil ifTrue:[ |
|
2620 |
"extract the pattern from #filtersOrNil" |
|
2621 |
pattern := self patternForFilters:filtersOrNil. |
|
2622 |
] ifFalse:[ |
|
2623 |
pattern := patternOrNil. |
|
2624 |
]. |
|
2625 |
||
2620 | 2626 |
UserPreferences current useNewFileDialog ifTrue:[ |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2627 |
FileDialog notNil ifTrue:[ |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2628 |
^ FileDialog |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2629 |
requestFileName:titleString |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2630 |
default:defaultName |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2631 |
ok:okText abort:abortText |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2632 |
pattern:pattern |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2633 |
fromDirectory:aDirectoryPathOrNil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2634 |
whenBoxCreatedEvaluate:boxCreatedCallback |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2635 |
] |
2620 | 2636 |
]. |
2637 |
||
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2638 |
defaultNm := defaultName. |
2218 | 2639 |
defaultDir := aDirectoryPathOrNil. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2640 |
defaultDir isNil ifTrue:[ |
2218 | 2641 |
defaultNm notNil ifTrue:[ |
2642 |
defaultDir := defaultName asFilename directoryName. |
|
2643 |
defaultNm := defaultNm asFilename baseName. |
|
2644 |
defaultDir = Filename currentDirectory name ifTrue:[ |
|
2645 |
defaultName asFilename isExplicitRelative ifFalse:[ |
|
2646 |
defaultDir := nil |
|
2647 |
] |
|
2648 |
] |
|
2649 |
]. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2650 |
]. |
197 | 2651 |
|
2652 |
box := FileSelectionBox |
|
2218 | 2653 |
title:titleString |
2654 |
okText:okText |
|
2655 |
abortText:abortText |
|
2656 |
action:[:fileName | enteredName := fileName]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2657 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2658 |
defaultDir notNil ifTrue:[ |
2218 | 2659 |
box directory:defaultDir |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2660 |
] ifFalse:[ |
2218 | 2661 |
dir := FileSelectionBox lastFileSelectionDirectory. |
2662 |
dir notNil ifTrue:[ |
|
2663 |
box directory:dir. |
|
2664 |
]. |
|
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2665 |
]. |
197 | 2666 |
box pattern:pattern. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2667 |
box initialText:defaultNm. |
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2668 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:box]. |
2439 | 2669 |
|
2670 |
self showAndThenDestroyBox:box. |
|
197 | 2671 |
box action:nil. |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2672 |
|
3237
4c6fe0664cab
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
3234
diff
changeset
|
2673 |
(enteredName notEmptyOrNil) ifTrue:[ |
2218 | 2674 |
FileSelectionBox lastFileSelectionDirectory:(enteredName asFilename directoryName). |
1360
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2675 |
]. |
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2676 |
|
ede30cea2827
also remember last directory in requestFileName dialogs
Claus Gittinger <cg@exept.de>
parents:
1355
diff
changeset
|
2677 |
^ enteredName |
197 | 2678 |
|
2679 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2680 |
Dialog |
2218 | 2681 |
requestFileName:'enter a fileName:' |
2682 |
default:'' |
|
2683 |
ok:'yeah' |
|
2684 |
abort:'oh, no' |
|
2685 |
pattern:'rc*' |
|
2686 |
fromDirectory:'/etc' |
|
197 | 2687 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2688 |
|
4164 | 2689 |
"Modified: / 24-08-2010 / 17:28:57 / sr" |
4181 | 2690 |
"Created: / 27-10-2010 / 11:21:05 / cg" |
2691 |
! |
|
2692 |
||
2631 | 2693 |
requestFileName:titleString default:defaultName ok:okText abort:abortText version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:aBoolean |
2694 |
"launch a Dialog, which allows user to enter a filename. |
|
2695 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
2696 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
2697 |
The box will show okText in its okButton, abortText in the abortButton. |
|
2698 |
The matchPattern is set to pattern initially. |
|
2699 |
Return the string, or nil if cancel was pressed |
|
2700 |
The version argument allows validation of the files existance; |
|
2701 |
it may be any of: |
|
2702 |
#mustBeNew - fail (return empty string) if the file exists |
|
2703 |
#new - confirm if the file exists |
|
2704 |
#mustBeOld - fail if the file does not exist |
|
2705 |
#old - confirm if the file does not exist |
|
2706 |
#any (other) - no validation |
|
2707 |
" |
|
2708 |
||
4353
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2709 |
UserPreferences current useNewFileDialog ifTrue:[ |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2710 |
FileDialog notNil ifTrue:[ |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2711 |
^ FileDialog |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2712 |
requestFileName:titleString |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2713 |
default:defaultName |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2714 |
ok:okText |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2715 |
abort:abortText |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2716 |
version:versionSymbol |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2717 |
ifFail:failBlock |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2718 |
pattern:pattern |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2719 |
fromDirectory:aDirectoryPath |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2720 |
whenBoxCreatedEvaluate:boxCreatedCallback |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2721 |
asLoadDialog:aBoolean. |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2722 |
]. |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2723 |
]. |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2724 |
^ self |
2631 | 2725 |
requestFileName:titleString |
2726 |
default:defaultName |
|
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2727 |
ok:okText abort:abortText |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2728 |
pattern:pattern fromDirectory:aDirectoryPath forSave:aBoolean not |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2729 |
whenBoxCreatedEvaluate:boxCreatedCallback |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2730 |
|
4353
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
2731 |
"Modified: / 23-01-2012 / 17:22:57 / cg" |
2631 | 2732 |
! |
2733 |
||
1030 | 2734 |
requestFileName:titleString default:defaultName pattern:pattern |
2735 |
"launch a Dialog, which allows user to enter a filename. |
|
2736 |
The files presented initially are those from the current directory. |
|
2737 |
The box will show ok/cancel in its buttons. |
|
2738 |
The matchPattern is set to pattern initially. |
|
2739 |
Return the string or nil if cancel was pressed." |
|
2740 |
||
2415 | 2741 |
|resources| |
2742 |
||
2743 |
resources := self classResources. |
|
1030 | 2744 |
^ self |
2415 | 2745 |
requestFileName:titleString |
2746 |
default:defaultName |
|
3276 | 2747 |
ok:(resources string:'OK') |
2415 | 2748 |
abort:(resources string:'Cancel') |
2749 |
pattern:pattern |
|
2750 |
fromDirectory:nil |
|
1030 | 2751 |
|
2752 |
" |
|
2753 |
Dialog |
|
2415 | 2754 |
requestFileName:'enter a fileName:' |
2755 |
default:'' |
|
2756 |
pattern:'*.st' |
|
1030 | 2757 |
" |
2758 |
" |
|
2759 |
Dialog |
|
2415 | 2760 |
requestFileName:'enter a fileName:' |
2761 |
default:'' |
|
2762 |
pattern:'*.st;*.h' |
|
1030 | 2763 |
" |
2764 |
||
2765 |
"Created: 21.2.1997 / 11:16:52 / cg" |
|
2766 |
"Modified: 21.2.1997 / 11:18:40 / cg" |
|
2767 |
! |
|
2768 |
||
2525 | 2769 |
requestFileName:titleString default:defaultName pattern:pattern fromDirectory:aDirectory |
2770 |
"launch a Dialog, which allows user to enter a filename. |
|
2771 |
The files presented initially are those from the current directory. |
|
2772 |
The box will show ok/cancel in its buttons. |
|
2773 |
The matchPattern is set to pattern initially. |
|
2774 |
Return the string or nil if cancel was pressed." |
|
2775 |
||
2776 |
|resources| |
|
2777 |
||
2778 |
resources := self classResources. |
|
2779 |
^ self |
|
2780 |
requestFileName:titleString |
|
2781 |
default:defaultName |
|
3276 | 2782 |
ok:(resources string:'OK') |
2525 | 2783 |
abort:(resources string:'Cancel') |
2784 |
pattern:pattern |
|
2785 |
fromDirectory:aDirectory |
|
2786 |
||
2787 |
" |
|
2788 |
Dialog |
|
2789 |
requestFileName:'enter a fileName:' |
|
2790 |
default:'' |
|
2791 |
pattern:'*.st' |
|
2792 |
" |
|
2793 |
" |
|
2794 |
Dialog |
|
2795 |
requestFileName:'enter a fileName:' |
|
2796 |
default:'' |
|
2797 |
pattern:'*.st;*.h' |
|
2798 |
" |
|
2799 |
||
2800 |
"Created: 21.2.1997 / 11:16:52 / cg" |
|
2801 |
"Modified: 21.2.1997 / 11:18:40 / cg" |
|
2802 |
! |
|
2803 |
||
100 | 2804 |
requestFileName:titleString default:defaultName version:versionSymbol |
2805 |
"launch a Dialog, which allows user to enter a filename. |
|
2806 |
The box will not allow pressing 'ok' without an entered string. |
|
2807 |
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
|
2808 |
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
|
2809 |
it may be any of: |
1401 | 2810 |
#mustBeNew - fail (return empty string) if the file exists |
2811 |
#new - confirm if the file exists |
|
2812 |
#mustBeOld - fail if the file does not exist |
|
2813 |
#old - confirm if the file does not exist |
|
2814 |
#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
|
2815 |
" |
100 | 2816 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2817 |
^ self |
1401 | 2818 |
requestFileName:titleString |
2819 |
default:defaultName |
|
2820 |
version:versionSymbol |
|
2821 |
ifFail:'' |
|
100 | 2822 |
|
2823 |
" |
|
2824 |
Dialog requestFileName:'enter a fileName:' |
|
1401 | 2825 |
default:'' |
2826 |
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
|
2827 |
|
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
|
2828 |
Dialog requestFileName:'enter a fileName:' |
1401 | 2829 |
default:'' |
2830 |
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
|
2831 |
|
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
|
2832 |
Dialog requestFileName:'enter a fileName:' |
1401 | 2833 |
default:'' |
2834 |
version:#new |
|
100 | 2835 |
" |
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
|
2836 |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2837 |
"Modified: 19.4.1996 / 13:53:58 / cg" |
100 | 2838 |
! |
2839 |
||
2840 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock |
|
2841 |
"launch a Dialog, which allows user to enter a filename. |
|
2842 |
The box will not allow pressing 'ok' without an entered string. |
|
2843 |
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
|
2844 |
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
|
2845 |
it may be any of: |
1401 | 2846 |
#mustBeNew - fail (return empty string) if the file exists |
2847 |
#new - confirm if the file exists |
|
2848 |
#mustBeOld - fail if the file does not exist |
|
2849 |
#old - confirm if the file does not exist |
|
2850 |
#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
|
2851 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2852 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2853 |
^ self |
1401 | 2854 |
requestFileName:titleString |
2855 |
default:defaultName |
|
2856 |
version:versionSymbol |
|
2857 |
ifFail:failBlock |
|
2858 |
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
|
2859 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2860 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2861 |
Dialog |
1401 | 2862 |
requestFileName:'enter a fileName:' |
2863 |
default:'' |
|
2864 |
version:nil |
|
2865 |
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
|
2866 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2867 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2868 |
Dialog |
1401 | 2869 |
requestFileName:'enter a fileName:' |
2870 |
default:'' |
|
2871 |
version:#old |
|
2872 |
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
|
2873 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2874 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2875 |
"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
|
2876 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2877 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
2878 |
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
|
2879 |
"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
|
2880 |
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
|
2881 |
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
|
2882 |
it may be any of: |
1736 | 2883 |
#mustBeNew - fail (return empty string) if the file exists |
2884 |
#new - confirm if the file exists |
|
2885 |
#mustBeOld - fail if the file does not exist |
|
2886 |
#old - confirm if the file does not exist |
|
2887 |
#any (other) - no validation |
|
2888 |
" |
|
2889 |
||
2890 |
^ self |
|
2891 |
requestFileName:titleString |
|
2892 |
default:defaultName |
|
2893 |
version:versionSymbol |
|
2894 |
ifFail:failBlock |
|
2895 |
pattern:nil |
|
2896 |
fromDirectory:aDirectoryPath |
|
1031 | 2897 |
|
2898 |
" |
|
2899 |
Dialog |
|
1736 | 2900 |
requestFileName:'enter a fileName:' |
2901 |
default:'' |
|
2902 |
version:nil |
|
2903 |
ifFail:['none'] |
|
2904 |
fromDirectory:'/etc' |
|
1031 | 2905 |
" |
2906 |
" |
|
2907 |
Dialog |
|
1736 | 2908 |
requestFileName:'enter a fileName:' |
2909 |
default:'' |
|
2910 |
version:#old |
|
2911 |
ifFail:['none'] |
|
2912 |
fromDirectory:'/etc' |
|
1031 | 2913 |
" |
2914 |
" |
|
2915 |
Dialog |
|
1736 | 2916 |
requestFileName:'enter a fileName:' |
2917 |
default:'' |
|
2918 |
version:#mustBeNew |
|
2919 |
ifFail:['none'] |
|
2920 |
fromDirectory:'/etc' |
|
1031 | 2921 |
" |
2922 |
||
2923 |
"Modified: 20.2.1997 / 18:12:28 / cg" |
|
2924 |
"Modified: 21.2.1997 / 14:27:27 / stefan" |
|
2925 |
! |
|
2926 |
||
2927 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath |
|
2928 |
"launch a Dialog, which allows user to enter a filename. |
|
2929 |
Return the string or the value of failBlock if cancel was pressed. |
|
2930 |
The version argument allows validation of the files existance; |
|
2931 |
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
|
2932 |
#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
|
2933 |
#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
|
2934 |
#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
|
2935 |
#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
|
2936 |
#any (other) - no validation |
1031 | 2937 |
" |
2938 |
||
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2939 |
^ self |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2940 |
requestFileName:titleString |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2941 |
default:defaultName |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2942 |
version:versionSymbol |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2943 |
ifFail:failBlock |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2944 |
pattern:pattern |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2945 |
fromDirectory:aDirectoryPath |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2946 |
whenBoxCreatedEvaluate:nil |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2947 |
! |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2948 |
|
4181 | 2949 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath forSave:forSave whenBoxCreatedEvaluate:boxCreatedCallback |
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2950 |
"launch a Dialog, which allows user to enter a filename. |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2951 |
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
|
2952 |
The version argument allows validation of the files existance; |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2953 |
it may be any of: |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2954 |
#mustBeNew - fail (return empty string) if the file exists |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2955 |
#new - confirm if the file exists |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2956 |
#mustBeOld - fail if the file does not exist |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2957 |
#old - confirm if the file does not exist |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2958 |
#any (other) - no validation |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2959 |
" |
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
2960 |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2961 |
|box defaultDir defaultNm| |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2962 |
|
4164 | 2963 |
Screen current nativeFileDialogs ifTrue:[ |
3574 | 2964 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2965 |
Win32FileDialog notNil ifTrue:[ |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2966 |
^ Win32FileDialog |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2967 |
fileDialogFor:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2968 |
save:forSave |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2969 |
title:titleString |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2970 |
inDirectory:aDirectoryPath |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2971 |
initialAnswer:defaultName |
5619 | 2972 |
pattern:pattern |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2973 |
extension:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2974 |
] |
3574 | 2975 |
]. |
2976 |
]. |
|
2977 |
||
2621 | 2978 |
UserPreferences current useNewFileDialog ifTrue:[ |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2979 |
FileDialog notNil ifTrue:[ |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2980 |
^ FileDialog |
2769 | 2981 |
requestFileName:titleString |
2982 |
default:defaultName |
|
2983 |
version:versionSymbol |
|
2984 |
ifFail:failBlock |
|
2985 |
pattern:pattern |
|
2986 |
fromDirectory:aDirectoryPath |
|
2987 |
whenBoxCreatedEvaluate:boxCreatedCallback. |
|
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2988 |
]. |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2989 |
]. |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
2990 |
|
2773 | 2991 |
defaultName notNil ifTrue:[defaultNm := defaultName asFilename name]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2992 |
defaultDir := aDirectoryPath. |
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
2993 |
defaultDir isNil ifTrue:[ |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2994 |
defaultNm notNil ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2995 |
defaultName asFilename withoutSuffix baseName = '*' ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2996 |
defaultDir := FileSelectionBox lastFileSelectionDirectory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2997 |
defaultNm := ''. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2998 |
] ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
2999 |
defaultDir := defaultName asFilename directoryName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3000 |
defaultNm := defaultNm asFilename baseName. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3001 |
] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3002 |
]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
3003 |
]. |
100 | 3004 |
|
3005 |
box := FileSelectionBox title:titleString. |
|
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
3006 |
defaultDir notNil ifTrue:[box directory:defaultDir]. |
1031 | 3007 |
pattern notNil ifTrue:[box pattern:pattern]. |
1029
ddc27f751b3d
allow path as default in requestFileName;
Claus Gittinger <cg@exept.de>
parents:
1004
diff
changeset
|
3008 |
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
|
3009 |
box action:[:name | |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3010 |
versionSymbol == #mustBeNew ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3011 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3012 |
name asFilename exists ifTrue:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3013 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3014 |
versionSymbol == #new ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3015 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3016 |
name asFilename exists ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3017 |
(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
|
3018 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3019 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3020 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3021 |
versionSymbol == #mustBeOld ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3022 |
name asFilename exists ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3023 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3024 |
versionSymbol == #old ifTrue:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3025 |
"/ file may not exist |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3026 |
name asFilename exists ifFalse:[ |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3027 |
(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
|
3028 |
ifFalse:[^ '']. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3029 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3030 |
]. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3031 |
FileSelectionBox lastFileSelectionDirectory:box directory. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3032 |
box destroy. |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3033 |
^ 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
|
3034 |
]. |
2355
986d96f5ff6c
added postCreateCallBack option
Claus Gittinger <cg@exept.de>
parents:
2332
diff
changeset
|
3035 |
boxCreatedCallback notNil ifTrue:[boxCreatedCallback value:box]. |
2439 | 3036 |
self showAndThenDestroyBox:box. |
100 | 3037 |
box action:nil. |
3038 |
^ failBlock value |
|
3039 |
||
3040 |
" |
|
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3041 |
Dialog |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3042 |
requestFileName:'enter a fileName:' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3043 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3044 |
version:nil |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3045 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3046 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3047 |
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
|
3048 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3049 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3050 |
Dialog |
4354
398565cdbe6c
comment/format in: #requestFileName:default:version:ifFail:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4353
diff
changeset
|
3051 |
requestFileName:'Enter a fileName:' |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3052 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3053 |
version:#old |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3054 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3055 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3056 |
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
|
3057 |
" |
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
|
3058 |
" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3059 |
Dialog |
4354
398565cdbe6c
comment/format in: #requestFileName:default:version:ifFail:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4353
diff
changeset
|
3060 |
requestFileName:'Enter a fileName:' |
1575
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3061 |
default:'' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3062 |
version:#mustBeNew |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3063 |
ifFail:['none'] |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3064 |
pattern:'*.conf' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3065 |
fromDirectory:'/etc' |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3066 |
" |
a30ae9842432
use lastFileSelection if requesting a file without given dir,
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3067 |
|
4181 | 3068 |
"Modified: / 24-08-2010 / 17:29:04 / sr" |
3069 |
"Created: / 27-10-2010 / 10:38:10 / cg" |
|
3070 |
! |
|
3071 |
||
3072 |
requestFileName:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback |
|
3073 |
"launch a Dialog, which allows user to enter a filename. |
|
3074 |
Return the string or the value of failBlock if cancel was pressed. |
|
3075 |
The version argument allows validation of the files existance; |
|
3076 |
it may be any of: |
|
3077 |
#mustBeNew - fail (return empty string) if the file exists |
|
3078 |
#new - confirm if the file exists |
|
3079 |
#mustBeOld - fail if the file does not exist |
|
3080 |
#old - confirm if the file does not exist |
|
3081 |
#any (other) - no validation |
|
3082 |
" |
|
3083 |
||
3084 |
^ self |
|
3085 |
requestFileName:titleString |
|
3086 |
default:defaultName |
|
3087 |
version:versionSymbol |
|
3088 |
ifFail:failBlock |
|
3089 |
pattern:pattern |
|
3090 |
fromDirectory:aDirectoryPath |
|
3091 |
forSave:false |
|
3092 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3093 |
||
3094 |
" |
|
3095 |
Dialog |
|
3096 |
requestFileName:'enter a fileName:' |
|
3097 |
default:'' |
|
3098 |
version:nil |
|
3099 |
ifFail:['none'] |
|
3100 |
pattern:'*.conf' |
|
3101 |
fromDirectory:'/etc' |
|
3102 |
" |
|
3103 |
" |
|
3104 |
Dialog |
|
3105 |
requestFileName:'enter a fileName:' |
|
3106 |
default:'' |
|
3107 |
version:#old |
|
3108 |
ifFail:['none'] |
|
3109 |
pattern:'*.conf' |
|
3110 |
fromDirectory:'/etc' |
|
3111 |
" |
|
3112 |
" |
|
3113 |
Dialog |
|
3114 |
requestFileName:'enter a fileName:' |
|
3115 |
default:'' |
|
3116 |
version:#mustBeNew |
|
3117 |
ifFail:['none'] |
|
3118 |
pattern:'*.conf' |
|
3119 |
fromDirectory:'/etc' |
|
3120 |
" |
|
3121 |
||
4164 | 3122 |
"Created: / 21-02-1997 / 14:23:44 / stefan" |
3123 |
"Modified: / 24-08-2010 / 17:29:04 / sr" |
|
4181 | 3124 |
"Modified: / 27-10-2010 / 10:38:53 / cg" |
549
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3125 |
! |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3126 |
|
3877 | 3127 |
requestFileName:titleString fromDirectory:aDirectory |
3128 |
"launch a Dialog, which allows user to enter a filename. |
|
3129 |
The files presented initially are those from the current directory. |
|
3130 |
The box will show ok/cancel in its buttons. |
|
3131 |
Return the string or nil if cancel was pressed." |
|
3132 |
||
3133 |
^ self |
|
3134 |
requestFileName:titleString |
|
3135 |
default:nil |
|
3136 |
pattern:'*' |
|
3137 |
fromDirectory:aDirectory |
|
3138 |
||
3139 |
" |
|
3140 |
Dialog |
|
3141 |
requestFileName:'enter a fileName:' |
|
3142 |
fromDirectory:'../../libbasic' |
|
3143 |
" |
|
3144 |
! |
|
3145 |
||
2637
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
3146 |
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
|
3147 |
"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
|
3148 |
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
|
3149 |
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
|
3150 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3151 |
^ self |
2637
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
3152 |
requestFileName:titleString |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
3153 |
default:'file.ext' |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
3154 |
version:nil |
1142eda23f83
added requestFileName:default:ifFail::
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
3155 |
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
|
3156 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3157 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3158 |
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
|
3159 |
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
|
3160 |
" |
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3161 |
|
c9d438ab85ce
moved all file request methods (class protocol) to DialogBox; added directory dialogs
Claus Gittinger <cg@exept.de>
parents:
535
diff
changeset
|
3162 |
"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
|
3163 |
"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
|
3164 |
! |
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
|
3165 |
|
2524 | 3166 |
requestFileName:titleString pattern:pattern |
3167 |
"launch a Dialog, which allows user to enter a filename. |
|
3168 |
The files presented initially are those from the current directory. |
|
3169 |
The box will show ok/cancel in its buttons. |
|
3170 |
The matchPattern is set to pattern initially. |
|
3171 |
Return the string or nil if cancel was pressed." |
|
3172 |
||
3173 |
^ self |
|
3174 |
requestFileName:titleString |
|
3175 |
default:nil |
|
3176 |
pattern:pattern |
|
3177 |
||
3178 |
" |
|
3179 |
Dialog |
|
3180 |
requestFileName:'enter a fileName:' |
|
3181 |
pattern:'*.st' |
|
3182 |
" |
|
3183 |
" |
|
3184 |
Dialog |
|
3185 |
requestFileName:'enter a fileName:' |
|
3186 |
pattern:'*.st;*.h' |
|
3187 |
" |
|
3188 |
! |
|
3189 |
||
2525 | 3190 |
requestFileName:titleString pattern:pattern fromDirectory:aDirectory |
3191 |
"launch a Dialog, which allows user to enter a filename. |
|
3192 |
The files presented initially are those from the current directory. |
|
3193 |
The box will show ok/cancel in its buttons. |
|
3194 |
The matchPattern is set to pattern initially. |
|
3195 |
Return the string or nil if cancel was pressed." |
|
3196 |
||
3197 |
^ self |
|
3198 |
requestFileName:titleString |
|
3199 |
default:nil |
|
3200 |
pattern:pattern |
|
3201 |
fromDirectory:aDirectory |
|
3202 |
" |
|
3203 |
Dialog |
|
3204 |
requestFileName:'enter a fileName:' |
|
3205 |
pattern:'*.st' |
|
3206 |
" |
|
3207 |
" |
|
3208 |
Dialog |
|
3209 |
requestFileName:'enter a fileName:' |
|
3210 |
pattern:'*.st;*.h' |
|
3211 |
" |
|
3212 |
! |
|
3213 |
||
6026 | 3214 |
requestFileNameForImageSave:title image:anImage default:defaultName pattern:patternOrNil |
3215 |
"launch a Dialog, which allows user to enter a filename for a bitmap image save operation. |
|
3216 |
Return the pathname string consisting of the full pathname of the filename, |
|
3217 |
or an empty string (if cancel was pressed)." |
|
3218 |
||
3219 |
|resources| |
|
3220 |
||
3221 |
resources := self classResources. |
|
3222 |
||
3223 |
^ self |
|
3224 |
requestFileName:title |
|
3225 |
default:defaultName |
|
3226 |
ok:(resources string:'Save') |
|
3227 |
abort:(resources string:'Cancel') |
|
3228 |
pattern:'*.png;*.tiff;*.bmp' |
|
3229 |
fromDirectory:nil |
|
3230 |
forSave:true |
|
3231 |
whenBoxCreatedEvaluate:[:box | |
|
3232 |
|editButton paintButton copyButton| |
|
3233 |
"/ UserPreferences current useNewFileDialog ifFalse:[ |
|
3234 |
editButton := Button label:(resources string:'Edit'). |
|
3235 |
editButton |
|
3236 |
action:[ |
|
3237 |
box hide; destroy. |
|
3238 |
ImageEditor openOnImage:anImage. |
|
3239 |
]. |
|
3240 |
box addButton:editButton. |
|
3241 |
||
3242 |
paintButton := Button label:(resources string:'OS Editor'). |
|
3243 |
paintButton |
|
3244 |
action:[ |
|
3245 |
|tempStream| |
|
3246 |
||
3247 |
tempStream := FileStream newTemporaryWithSuffix:'png'. |
|
3248 |
box hide; destroy. |
|
3249 |
PNGReader save:anImage onStream:tempStream. |
|
3250 |
tempStream close. |
|
3251 |
OperatingSystem |
|
3252 |
openApplicationForDocument:tempStream fileName operation:#edit mimeType:'image/png'. |
|
3253 |
]. |
|
3254 |
box addButton:paintButton. |
|
3255 |
||
3256 |
copyButton := Button label:(resources string:'Copy to Clipboard'). |
|
3257 |
copyButton |
|
3258 |
action:[ |
|
3259 |
Screen current rootView setClipboardObject:anImage. |
|
3260 |
box hide; destroy. |
|
3261 |
]. |
|
3262 |
box addButton:copyButton. |
|
3263 |
"/ ] |
|
3264 |
]. |
|
3265 |
||
3266 |
" |
|
3267 |
self |
|
3268 |
requestFileNameForImageSave:'save' |
|
3269 |
image:(Image fromScreen:(0@0 corner:100@100)) |
|
3270 |
default:'screen.png' |
|
3271 |
pattern:'*.png' |
|
3272 |
" |
|
3273 |
! |
|
3274 |
||
4181 | 3275 |
requestFileNameForSave:titleString |
3276 |
"launch a Dialog, which allows user to enter a filename. |
|
3277 |
Return the pathname string consisting of the full pathname of the filename, |
|
3278 |
or an empty string (if cancel was pressed)." |
|
3279 |
||
3280 |
^ self |
|
3281 |
requestFileNameForSave:titleString |
|
3282 |
default:'file.ext' |
|
3283 |
||
3284 |
" |
|
3285 |
Dialog requestFileName:'enter a fileName:' |
|
3286 |
Dialog requestFileName:'enter a fileName:' |
|
3287 |
" |
|
3288 |
||
3289 |
"Created: / 27-10-2010 / 11:31:52 / cg" |
|
3290 |
! |
|
3291 |
||
3292 |
requestFileNameForSave:titleString default:defaultName |
|
3293 |
"launch a Dialog, which allows user to enter a filename. |
|
3294 |
The box will not allow pressing 'ok' without an entered string. |
|
3295 |
Return the pathname string consisting of the full pathname of the filename, |
|
3296 |
or an empty string (if cancel was pressed)." |
|
3297 |
||
3298 |
^ self |
|
4182
46fec1281cbc
changed: #requestFileNameForSave:default:
Claus Gittinger <cg@exept.de>
parents:
4181
diff
changeset
|
3299 |
requestFileNameForSave:titleString |
4181 | 3300 |
default:defaultName |
3301 |
version:nil |
|
3302 |
ifFail:'' |
|
3303 |
||
3304 |
" |
|
3305 |
Dialog requestFileName:'enter a fileName:' default:'' |
|
4183
c775db615fdf
comment/format in: #requestFileNameForSave:default:
Claus Gittinger <cg@exept.de>
parents:
4182
diff
changeset
|
3306 |
Dialog requestFileNameForSave:'enter a fileName:' default:'' |
4181 | 3307 |
" |
3308 |
||
3309 |
"Created: / 27-10-2010 / 11:32:06 / cg" |
|
3310 |
! |
|
3311 |
||
3312 |
requestFileNameForSave:titleString default:defaultName fromDirectory:aDirectoryPath |
|
3313 |
"launch a Dialog, which allows user to enter a filename. |
|
3314 |
The box will not allow pressing 'ok' without an entered string. |
|
3315 |
Return the pathname string consisting of the full pathname of the filename, |
|
3316 |
or an empty string (if cancel was pressed)." |
|
3317 |
||
3318 |
^ self |
|
3319 |
requestFileName:titleString |
|
3320 |
default:defaultName |
|
3321 |
version:nil |
|
3322 |
ifFail:'' |
|
3323 |
pattern:nil |
|
3324 |
fromDirectory:aDirectoryPath |
|
3325 |
forSave:true |
|
3326 |
whenBoxCreatedEvaluate:nil |
|
3327 |
||
3328 |
" |
|
3329 |
Dialog |
|
3330 |
requestFileName:'enter a fileName:' |
|
3331 |
default:'Makefile.bak' |
|
3332 |
fromDirectory:'..' |
|
3333 |
" |
|
3334 |
||
3335 |
"Created: / 27-10-2010 / 10:41:04 / cg" |
|
3336 |
! |
|
3337 |
||
3338 |
requestFileNameForSave:titleString default:defaultName ok:okText abort:abortText pattern:pattern |
|
3339 |
"launch a Dialog, which allows user to enter a filename. |
|
3340 |
The files presented initially are those from the current directory. |
|
3341 |
The box will show okText in its okButton, abortText in the abortButton. |
|
3342 |
The matchPattern is set to pattern initially. |
|
3343 |
Return the string or nil if cancel was pressed." |
|
3344 |
||
3345 |
^ self |
|
3346 |
requestFileNameForSave:titleString |
|
3347 |
default:defaultName |
|
3348 |
ok:okText |
|
3349 |
abort:abortText |
|
3350 |
pattern:pattern |
|
3351 |
fromDirectory:nil |
|
3352 |
||
3353 |
" |
|
3354 |
Dialog |
|
3355 |
requestFileName:'enter a fileName:' |
|
3356 |
default:'' |
|
3357 |
ok:'yeah' |
|
3358 |
abort:'oh, no' |
|
3359 |
pattern:'*.st' |
|
3360 |
" |
|
3361 |
||
3362 |
"Created: / 27-10-2010 / 11:29:20 / cg" |
|
3363 |
! |
|
3364 |
||
3365 |
requestFileNameForSave:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil |
|
3366 |
"launch a Dialog, which allows user to enter a filename. |
|
3367 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
3368 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
3369 |
The box will show okText in its okButton, abortText in the abortButton. |
|
3370 |
The matchPattern is set to pattern initially. |
|
3371 |
Return the string, or nil if cancel was pressed." |
|
3372 |
||
3373 |
^ self |
|
3374 |
requestFileName:titleString |
|
3375 |
default:defaultName |
|
3376 |
ok:okText |
|
3377 |
abort:abortText |
|
3378 |
pattern:pattern |
|
3379 |
fromDirectory:aDirectoryPathOrNil |
|
3380 |
forSave:true |
|
3381 |
whenBoxCreatedEvaluate:nil |
|
3382 |
||
3383 |
"Created: / 27-10-2010 / 11:24:37 / cg" |
|
3384 |
! |
|
3385 |
||
3386 |
requestFileNameForSave:titleString default:defaultName ok:okText abort:abortText pattern:pattern fromDirectory:aDirectoryPathOrNil whenBoxCreatedEvaluate:boxCreatedCallback |
|
3387 |
"launch a Dialog, which allows user to enter a filename. |
|
3388 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
3389 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
3390 |
The box will show okText in its okButton, abortText in the abortButton. |
|
3391 |
The matchPattern is set to pattern initially. |
|
3392 |
Return the string, or nil if cancel was pressed." |
|
3393 |
||
3394 |
^ self |
|
3395 |
requestFileName:titleString |
|
3396 |
default:defaultName |
|
3397 |
ok:okText |
|
3398 |
abort:abortText |
|
3399 |
pattern:pattern |
|
3400 |
fromDirectory:aDirectoryPathOrNil |
|
3401 |
forSave:true |
|
3402 |
whenBoxCreatedEvaluate:boxCreatedCallback |
|
3403 |
||
3404 |
" |
|
3405 |
Dialog |
|
3406 |
requestFileName:'enter a fileName:' |
|
3407 |
default:'' |
|
3408 |
ok:'yeah' |
|
3409 |
abort:'oh, no' |
|
3410 |
pattern:'rc*' |
|
3411 |
fromDirectory:'/etc' |
|
3412 |
" |
|
3413 |
||
3414 |
"Modified: / 24-08-2010 / 17:28:57 / sr" |
|
3415 |
"Created: / 27-10-2010 / 11:23:40 / cg" |
|
3416 |
! |
|
3417 |
||
3418 |
requestFileNameForSave:titleString default:defaultName version:versionSymbol ifFail:failBlock |
|
3419 |
"launch a Dialog, which allows user to enter a filename. |
|
3420 |
The box will not allow pressing 'ok' without an entered string. |
|
3421 |
Return the string or the value of failBlock if cancel was pressed. |
|
3422 |
The version argument allows validation of the files existance; |
|
3423 |
it may be any of: |
|
3424 |
#mustBeNew - fail (return empty string) if the file exists |
|
3425 |
#new - confirm if the file exists |
|
3426 |
#mustBeOld - fail if the file does not exist |
|
3427 |
#old - confirm if the file does not exist |
|
3428 |
#any (other) - no validation |
|
3429 |
" |
|
3430 |
||
3431 |
^ self |
|
3432 |
requestFileNameForSave:titleString |
|
3433 |
default:defaultName |
|
3434 |
version:versionSymbol |
|
3435 |
ifFail:failBlock |
|
3436 |
fromDirectory:nil |
|
3437 |
||
3438 |
" |
|
3439 |
Dialog |
|
3440 |
requestFileName:'enter a fileName:' |
|
3441 |
default:'' |
|
3442 |
version:nil |
|
3443 |
ifFail:['none'] |
|
3444 |
" |
|
3445 |
" |
|
3446 |
Dialog |
|
3447 |
requestFileName:'enter a fileName:' |
|
3448 |
default:'' |
|
3449 |
version:#old |
|
3450 |
ifFail:['none'] |
|
3451 |
" |
|
3452 |
||
3453 |
"Created: / 27-10-2010 / 11:32:03 / cg" |
|
3454 |
! |
|
3455 |
||
3456 |
requestFileNameForSave:titleString default:defaultName version:versionSymbol ifFail:failBlock fromDirectory:aDirectoryPath |
|
3457 |
"launch a Dialog, which allows user to enter a filename. |
|
3458 |
Return the string or the value of failBlock if cancel was pressed. |
|
3459 |
The version argument allows validation of the files existance; |
|
3460 |
it may be any of: |
|
3461 |
#mustBeNew - fail (return empty string) if the file exists |
|
3462 |
#new - confirm if the file exists |
|
3463 |
#mustBeOld - fail if the file does not exist |
|
3464 |
#old - confirm if the file does not exist |
|
3465 |
#any (other) - no validation |
|
3466 |
" |
|
3467 |
||
3468 |
^ self |
|
3469 |
requestFileNameForSave:titleString |
|
3470 |
default:defaultName |
|
3471 |
version:versionSymbol |
|
3472 |
ifFail:failBlock |
|
3473 |
pattern:nil |
|
3474 |
fromDirectory:aDirectoryPath |
|
3475 |
||
3476 |
" |
|
3477 |
Dialog |
|
3478 |
requestFileName:'enter a fileName:' |
|
3479 |
default:'' |
|
3480 |
version:nil |
|
3481 |
ifFail:['none'] |
|
3482 |
fromDirectory:'/etc' |
|
3483 |
" |
|
3484 |
" |
|
3485 |
Dialog |
|
3486 |
requestFileName:'enter a fileName:' |
|
3487 |
default:'' |
|
3488 |
version:#old |
|
3489 |
ifFail:['none'] |
|
3490 |
fromDirectory:'/etc' |
|
3491 |
" |
|
3492 |
" |
|
3493 |
Dialog |
|
3494 |
requestFileName:'enter a fileName:' |
|
3495 |
default:'' |
|
3496 |
version:#mustBeNew |
|
3497 |
ifFail:['none'] |
|
3498 |
fromDirectory:'/etc' |
|
3499 |
" |
|
3500 |
||
3501 |
"Modified: / 21-02-1997 / 14:27:27 / stefan" |
|
3502 |
"Created: / 27-10-2010 / 11:32:22 / cg" |
|
3503 |
! |
|
3504 |
||
3505 |
requestFileNameForSave:titleString default:defaultName version:versionSymbol ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath |
|
3506 |
"launch a Dialog, which allows user to enter a filename. |
|
3507 |
Return the string or the value of failBlock if cancel was pressed. |
|
3508 |
The version argument allows validation of the files existance; |
|
3509 |
it may be any of: |
|
3510 |
#mustBeNew - fail (return empty string) if the file exists |
|
3511 |
#new - confirm if the file exists |
|
3512 |
#mustBeOld - fail if the file does not exist |
|
3513 |
#old - confirm if the file does not exist |
|
3514 |
#any (other) - no validation |
|
3515 |
" |
|
3516 |
||
3517 |
^ self |
|
3518 |
requestFileName:titleString |
|
3519 |
default:defaultName |
|
3520 |
version:versionSymbol |
|
3521 |
ifFail:failBlock |
|
3522 |
pattern:pattern |
|
3523 |
fromDirectory:aDirectoryPath |
|
3524 |
forSave:true |
|
3525 |
whenBoxCreatedEvaluate:nil |
|
3526 |
||
3527 |
"Created: / 27-10-2010 / 11:32:55 / cg" |
|
3528 |
! |
|
3529 |
||
2631 | 3530 |
requestFileNames:titleString default:defaultName ok:okText abort:abortText ifFail:failBlock pattern:pattern fromDirectory:aDirectoryPath whenBoxCreatedEvaluate:boxCreatedCallback asLoadDialog:asLoadDialog |
3531 |
"launch a Dialog, which allows user to enter a filename. |
|
3532 |
The files presented initially are those in aDirectoryPathOrNil, or the |
|
3533 |
last fileBox directory (default: current directory) (if a nil path is given). |
|
3534 |
The box will show okText in its okButton, abortText in the abortButton. |
|
3535 |
The matchPattern is set to pattern initially. |
|
3536 |
Return all selected Filenames as filenames in a collection, or nil if cancel was pressed |
|
3537 |
" |
|
3538 |
||
4353
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3539 |
UserPreferences current useNewFileDialog ifTrue:[ |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3540 |
FileDialog notNil ifTrue:[ |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3541 |
^ FileDialog |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3542 |
requestFileNames:titleString |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3543 |
default:defaultName |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3544 |
ok:okText |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3545 |
abort:abortText |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3546 |
ifFail:failBlock |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3547 |
pattern:pattern |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3548 |
fromDirectory:aDirectoryPath |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3549 |
whenBoxCreatedEvaluate:boxCreatedCallback |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3550 |
asLoadDialog:asLoadDialog. |
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3551 |
]. |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3552 |
]. |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3553 |
^ self |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3554 |
requestFileName:titleString |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3555 |
default:defaultName |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3556 |
ok:okText abort:abortText |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3557 |
pattern:pattern fromDirectory:aDirectoryPath forSave:asLoadDialog not |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3558 |
whenBoxCreatedEvaluate:boxCreatedCallback |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3559 |
|
4353
f49df92ebf0a
comment/format in: #requestFileName:default:ok:abort:pattern:fromDirectory:forSave:whenBoxCreatedEvaluate:
Claus Gittinger <cg@exept.de>
parents:
4352
diff
changeset
|
3560 |
"Modified: / 23-01-2012 / 17:24:06 / cg" |
2631 | 3561 |
! |
3562 |
||
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
|
3563 |
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
|
3564 |
"launch a Dialog, which allows user to enter a filename. |
5811 | 3565 |
We expect a new files (i.e. nonexisting) name to be entered, |
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
|
3566 |
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
|
3567 |
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
|
3568 |
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
|
3569 |
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
|
3570 |
|
5811 | 3571 |
^ self |
3572 |
requestFileName:titleString |
|
3573 |
default:defaultName |
|
3574 |
version:#new |
|
1736 | 3575 |
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
|
3576 |
|
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
|
3577 |
" |
5811 | 3578 |
Dialog requestNewFileName:'enter a fileName:' 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
|
3579 |
" |
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
|
3580 |
|
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
|
3581 |
"Modified: 27.1.1996 / 13:44:13 / cg" |
2694 | 3582 |
! |
3583 |
||
3584 |
requestSaveFileName:title default:defaultOrNil fromDirectory:directoryOrNil action:action appendAction:appendActionOrNil |
|
3418 | 3585 |
"save contents into a file - ask user for filename using a fileSelectionBox. |
3586 |
Append is NOT offered, if appendActionOrNil is nil." |
|
2694 | 3587 |
|
2789 | 3588 |
|doAppend fileBox fileName dialog default resources| |
2694 | 3589 |
|
3590 |
default := defaultOrNil. |
|
3591 |
default notNil ifTrue:[ default := default asString]. |
|
3592 |
||
2789 | 3593 |
resources := self classResources. |
3594 |
||
4164 | 3595 |
Screen current nativeFileDialogs ifTrue:[ |
3574 | 3596 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
3597 |
appendActionOrNil isNil ifTrue:[ |
|
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3598 |
Win32FileDialog notNil ifTrue:[ |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3599 |
^ Win32FileDialog |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3600 |
fileDialogFor:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3601 |
save:true |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3602 |
title:title |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3603 |
inDirectory:directoryOrNil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3604 |
initialAnswer:default |
5619 | 3605 |
pattern:nil |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3606 |
extension:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3607 |
] |
3574 | 3608 |
]. |
3609 |
]. |
|
3610 |
]. |
|
3611 |
||
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3612 |
(UserPreferences current useNewFileDialog and:[FileDialog notNil]) ifTrue:[ |
2694 | 3613 |
fileName := FileDialog |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3614 |
requestFileName:title |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3615 |
default:default |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3616 |
ok:(resources string:'Save') |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3617 |
abort:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3618 |
version:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3619 |
ifFail:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3620 |
pattern:nil |
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3621 |
fromDirectory:directoryOrNil |
5866 | 3622 |
whenBoxCreatedEvaluate:[:box | |
3623 |
(dialog := box) appendButtonVisibleHolder value:appendActionOrNil notNil |
|
3624 |
]. |
|
2694 | 3625 |
|
3626 |
doAppend := dialog appendWasPressed |
|
3627 |
] ifFalse:[ |
|
3628 |
fileBox := FileSaveBox |
|
3629 |
title:title |
|
2789 | 3630 |
okText:(resources string:'Save') |
3631 |
abortText:(resources string:'Cancel') |
|
2694 | 3632 |
action:[:fn | doAppend := false. fileName := fn]. |
3633 |
fileBox appendAction:[:fn | doAppend := true. fileName := fn]. |
|
3634 |
directoryOrNil notNil ifTrue:[ fileBox directory:directoryOrNil]. |
|
3635 |
default notNil ifTrue:[fileBox initialText:default]. |
|
3636 |
fileBox showAtPointer. |
|
3637 |
fileBox destroy. |
|
3638 |
]. |
|
3639 |
||
3640 |
fileName size > 0 ifTrue:[ |
|
2705
a7c0e46f20fb
requestSaveFileName:title default:defaultOrNil fromDirectory:directoryOrNil action:action appendAction
tm
parents:
2700
diff
changeset
|
3641 |
(doAppend ifTrue:[appendActionOrNil] ifFalse:[action]) |
2694 | 3642 |
value:fileName |
3643 |
]. |
|
5866 | 3644 |
^ fileName. |
3418 | 3645 |
|
3646 |
" |
|
3647 |
Dialog |
|
3648 |
requestSaveFileName:'Save dialog example with append' |
|
3649 |
default:'xxx.txt' |
|
3650 |
fromDirectory:(Filename homeDirectory) |
|
3651 |
action:[:fn | Transcript showCR:'save ',fn] |
|
3652 |
appendAction:[:fn | Transcript showCR:'append ',fn] |
|
3653 |
||
3654 |
Dialog |
|
3655 |
requestSaveFileName:'Save dialog example' |
|
3656 |
default:'xxx.txt' |
|
3657 |
fromDirectory:(Filename homeDirectory) |
|
3658 |
action:[:fn | Transcript showCR:'save ',fn] |
|
3659 |
appendAction:nil |
|
3660 |
" |
|
3661 |
||
4164 | 3662 |
"Modified: / 24-08-2010 / 17:29:12 / sr" |
4352
9fc90b8f931c
care for fileDialog not present
Claus Gittinger <cg@exept.de>
parents:
4351
diff
changeset
|
3663 |
"Modified: / 23-01-2012 / 11:53:07 / 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
|
3664 |
! ! |
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
|
3665 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
3666 |
!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
|
3667 |
|
4556 | 3668 |
forRequestText:title editViewClass:editViewClass lines:numLines columns:numCols initialAnswer:initialText initialSelection:anIntervalOrNil model:textModel |
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3669 |
"return a dialog asking for multiline text. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3670 |
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
|
3671 |
|
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3672 |
^ self |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3673 |
forRequestText:title |
4875 | 3674 |
editViewClass:editViewClass |
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3675 |
lines:numLines columns:numCols |
4556 | 3676 |
initialAnswer:initialText |
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3677 |
setupWith: |
4556 | 3678 |
[:textView :dialog| |
3679 |
initialText notEmptyOrNil ifTrue:[ |
|
3680 |
textModel value:initialText |
|
3681 |
]. |
|
5011 | 3682 |
textView scrolledView model:textModel. |
3683 |
textView scrolledView |
|
3684 |
perform:#acceptChannel: |
|
3685 |
with:(dialog acceptChannel) |
|
3686 |
ifNotUnderstood:[]. |
|
3687 |
||
4556 | 3688 |
anIntervalOrNil notNil ifTrue:[ |
3689 |
textView scrolledView selectFromCharacterPosition:anIntervalOrNil start to:anIntervalOrNil stop. |
|
3690 |
]. |
|
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3691 |
] |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3692 |
|
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3693 |
"Modified: / 12-10-2006 / 13:59:21 / cg" |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3694 |
! |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3695 |
|
4556 | 3696 |
forRequestText:title editViewClass:editViewClass lines:numLines columns:numCols initialAnswer:initialText model:textModel |
3697 |
"return a dialog asking for multiline text. |
|
3698 |
The box is not shown yet, for further customization" |
|
3699 |
||
3700 |
^ self |
|
3701 |
forRequestText:title |
|
3702 |
editViewClass:editViewClass |
|
3703 |
lines:numLines columns:numCols |
|
3704 |
initialAnswer:initialText initialSelection:nil |
|
3705 |
model:textModel |
|
3706 |
! |
|
3707 |
||
3708 |
forRequestText:title editViewClass:editViewClass lines:numLines columns:numCols initialAnswer:initialText setupWith:aSetupBlockOrNil |
|
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3709 |
"return a dialog asking for multiline text. |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3710 |
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
|
3711 |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3712 |
|dialog textView| |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3713 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3714 |
dialog := self new. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3715 |
(dialog addTextLabel:(self classResources string:title)) adjust:#left. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3716 |
textView := dialog addTextBoxOn:nil |
2315 | 3717 |
class:editViewClass |
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3718 |
withNumberOfLines:numLines |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3719 |
hScrollable:true |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3720 |
vScrollable:true. |
4556 | 3721 |
initialText notEmptyOrNil ifTrue:[ |
3722 |
textView contents:initialText |
|
3723 |
]. |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3724 |
dialog width:(textView preferredExtentForLines:numLines cols:numCols) x. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3725 |
dialog addAbortAndOkButtons. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3726 |
dialog okButton isReturnButton:false. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3727 |
dialog makeTabable:textView. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3728 |
dialog stickAtBottomWithVariableHeight:textView. |
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3729 |
|
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3730 |
aSetupBlockOrNil notNil ifTrue:[ |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3731 |
aSetupBlockOrNil valueWithOptionalArgument:textView and:dialog |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3732 |
]. |
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3733 |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3734 |
^ dialog |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3735 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3736 |
" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3737 |
|dialog textHolder| |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3738 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3739 |
textHolder := ValueHolder new. |
2315 | 3740 |
dialog := Dialog |
3741 |
forRequestText:'foo' |
|
3742 |
editViewClass:EditTextView |
|
3743 |
lines:10 columns:40 |
|
3744 |
initialAnswer:'hello' model:textHolder. |
|
3745 |
dialog open. |
|
3746 |
dialog accepted ifTrue:[ |
|
3747 |
^ textHolder value |
|
3748 |
]. |
|
3749 |
^ nil |
|
3750 |
" |
|
3751 |
||
3752 |
" |
|
3753 |
|dialog textHolder| |
|
3754 |
||
3755 |
textHolder := ValueHolder new. |
|
3756 |
dialog := Dialog |
|
3757 |
forRequestText:'foo' |
|
3758 |
editViewClass:CodeView |
|
3759 |
lines:10 columns:40 |
|
3760 |
initialAnswer:'hello' model:textHolder. |
|
3761 |
dialog open. |
|
3762 |
dialog accepted ifTrue:[ |
|
3763 |
^ textHolder value |
|
3764 |
]. |
|
3765 |
^ nil |
|
3766 |
" |
|
3767 |
||
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3768 |
"Created: / 12-10-2006 / 13:59:27 / cg" |
2315 | 3769 |
! |
3770 |
||
4556 | 3771 |
forRequestText:title lines:numLines columns:numCols initialAnswer:initialText initialSelection:anIntervalOrNil model:textModel |
3772 |
"return a dialog asking for multiline text. |
|
3773 |
The box is not shown yet, for further customization" |
|
3774 |
||
3775 |
^ self |
|
3776 |
forRequestText:title |
|
3777 |
editViewClass:EditTextView |
|
3778 |
lines:numLines columns:numCols |
|
3779 |
initialAnswer:initialText initialSelection:anIntervalOrNil |
|
3780 |
model:textModel |
|
3781 |
||
3782 |
" |
|
3783 |
|dialog textHolder| |
|
3784 |
||
3785 |
textHolder := ValueHolder new. |
|
3786 |
dialog := Dialog forRequestText:'foo' lines:10 columns:40 initialAnswer:'hello' model:textHolder. |
|
3787 |
dialog open. |
|
3788 |
dialog accepted ifTrue:[ |
|
3789 |
^ textHolder value |
|
3790 |
]. |
|
3791 |
^ nil |
|
3792 |
" |
|
3793 |
||
3794 |
"Modified: / 12-10-2006 / 12:45:47 / cg" |
|
3795 |
! |
|
3796 |
||
2315 | 3797 |
forRequestText:title lines:numLines columns:numCols initialAnswer:initialText model:textModel |
3798 |
"return a dialog asking for multiline text. |
|
3799 |
The box is not shown yet, for further customization" |
|
3800 |
||
3801 |
^ self |
|
3802 |
forRequestText:title |
|
3803 |
editViewClass:EditTextView |
|
3804 |
lines:numLines columns:numCols |
|
4556 | 3805 |
initialAnswer:initialText initialSelection:nil |
3806 |
model:textModel |
|
2315 | 3807 |
|
3808 |
" |
|
3809 |
|dialog textHolder| |
|
3810 |
||
3811 |
textHolder := ValueHolder new. |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3812 |
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
|
3813 |
dialog open. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3814 |
dialog accepted ifTrue:[ |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3815 |
^ textHolder value |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3816 |
]. |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3817 |
^ nil |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3818 |
" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3819 |
|
3407
bad82e62870f
callBack hook in list/text-dialog
Claus Gittinger <cg@exept.de>
parents:
3404
diff
changeset
|
3820 |
"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
|
3821 |
! |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
3822 |
|
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
|
3823 |
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
|
3824 |
"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
|
3825 |
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
|
3826 |
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
|
3827 |
|
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
|
3828 |
^ self |
2439 | 3829 |
request:aString |
3830 |
displayAt:nil |
|
3831 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
3832 |
action:nil |
|
3833 |
initialAnswer:'' |
|
3834 |
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
|
3835 |
|
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
|
3836 |
" |
4633 | 3837 |
Dialog 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
|
3838 |
" |
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
|
3839 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3840 |
"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
|
3841 |
! |
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
|
3842 |
|
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
|
3843 |
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
|
3844 |
"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
|
3845 |
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
|
3846 |
that point. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3847 |
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
|
3848 |
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
|
3849 |
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
|
3850 |
|
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
|
3851 |
^ self |
2444 | 3852 |
request:aString |
3853 |
displayAt:aPoint |
|
3854 |
centered:centered |
|
3855 |
action:resultAction |
|
3856 |
initialAnswer:initial |
|
3857 |
okLabel:nil |
|
3858 |
cancelLabel:nil |
|
3859 |
title:nil |
|
4093 | 3860 |
onCancel:nil |
2444 | 3861 |
list:nil |
3862 |
initialSelection:nil |
|
3863 |
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
|
3864 |
|
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
|
3865 |
" |
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
|
3866 |
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
|
3867 |
|
2444 | 3868 |
Dialog |
2548 | 3869 |
request:'Enter a string:' |
2444 | 3870 |
displayAt:200@200 |
3871 |
centered:true |
|
3872 |
action:[:result | result printNewline] |
|
3873 |
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
|
3874 |
|
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
|
3875 |
|
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
|
3876 |
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
|
3877 |
|
2444 | 3878 |
Dialog |
2548 | 3879 |
request:'Enter a string:' |
2444 | 3880 |
displayAt:200@200 |
3881 |
centered:false |
|
3882 |
action:[:result | result printNewline] |
|
3883 |
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
|
3884 |
|
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
|
3885 |
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
|
3886 |
|
2444 | 3887 |
Dialog |
2548 | 3888 |
request:'Enter a string:' |
2444 | 3889 |
displayAt:nil |
3890 |
centered:false |
|
3891 |
action:[:result | result printNewline] |
|
3892 |
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
|
3893 |
|
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
|
3894 |
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
|
3895 |
|
2444 | 3896 |
Dialog |
2548 | 3897 |
request:'Enter a string:' |
2444 | 3898 |
displayAt:nil |
3899 |
centered:true |
|
3900 |
action:[:result | result printNewline] |
|
3901 |
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
|
3902 |
" |
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
|
3903 |
|
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
|
3904 |
"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
|
3905 |
"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
|
3906 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3907 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3908 |
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
|
3909 |
"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
|
3910 |
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
|
3911 |
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
|
3912 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3913 |
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
|
3914 |
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
|
3915 |
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
|
3916 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3917 |
^ self |
2444 | 3918 |
request:aString |
3919 |
displayAt:aPoint |
|
3920 |
centered:centered |
|
3921 |
action:resultAction |
|
3922 |
initialAnswer:initial |
|
3923 |
okLabel:okLabel |
|
3924 |
cancelLabel:cancelLabel |
|
3925 |
title:nil |
|
3926 |
onCancel:cancelValue |
|
3927 |
list:nil |
|
3928 |
initialSelection:nil |
|
3929 |
entryCompletionBlock:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3930 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3931 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3932 |
at topLeft (centering is suppressed, to make the box fully visible) |
2444 | 3933 |
Dialog |
2548 | 3934 |
request:'Enter a string:' |
2444 | 3935 |
displayAt:0@0 |
3936 |
centered:true |
|
3937 |
action:[:result | result printNewline] |
|
3938 |
initialAnswer:'the default' |
|
2548 | 3939 |
okLabel:'Yes' |
3940 |
cancelLabel:'No' |
|
2444 | 3941 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3942 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3943 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3944 |
|
2444 | 3945 |
Dialog |
2548 | 3946 |
request:'Enter a string:' |
2444 | 3947 |
displayAt:200@200 |
3948 |
centered:true |
|
3949 |
action:[:result | result printNewline] |
|
3950 |
initialAnswer:'the default' |
|
2548 | 3951 |
okLabel:'Yes' |
3952 |
cancelLabel:'No' |
|
2444 | 3953 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3954 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3955 |
topLeft of box at 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3956 |
|
2444 | 3957 |
Dialog |
2548 | 3958 |
request:'Enter a string:' |
2444 | 3959 |
displayAt:200@200 |
3960 |
centered:false |
|
3961 |
action:[:result | result printNewline] |
|
3962 |
initialAnswer:'the default' |
|
2548 | 3963 |
okLabel:'Yes' |
3964 |
cancelLabel:'No' |
|
2444 | 3965 |
onCancel:#foo |
717
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 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3968 |
|
2444 | 3969 |
Dialog |
2548 | 3970 |
request:'Enter a string:' |
2444 | 3971 |
displayAt:nil |
3972 |
centered:false |
|
3973 |
action:[:result | result printNewline] |
|
3974 |
initialAnswer:'the default' |
|
2548 | 3975 |
okLabel:'Yes' |
3976 |
cancelLabel:'No' |
|
2444 | 3977 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3978 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3979 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3980 |
|
2444 | 3981 |
Dialog |
2548 | 3982 |
request:'Enter a string:' |
2444 | 3983 |
displayAt:nil |
3984 |
centered:true |
|
3985 |
action:[:result | result printNewline] |
|
3986 |
initialAnswer:'the default' |
|
2548 | 3987 |
okLabel:'Yes' |
3988 |
cancelLabel:'No' |
|
2444 | 3989 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3990 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3991 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3992 |
"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
|
3993 |
"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
|
3994 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3995 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
3996 |
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
|
3997 |
"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
|
3998 |
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
|
3999 |
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
|
4000 |
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
|
4001 |
screen center (if centered is true). |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4002 |
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
|
4003 |
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
|
4004 |
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
|
4005 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4006 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4007 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4008 |
displayAt:aPoint |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4009 |
centered:centered |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4010 |
action:resultAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4011 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4012 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4013 |
cancelLabel:cancelLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4014 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4015 |
onCancel:cancelValue |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4016 |
list:nil |
2444 | 4017 |
initialSelection:nil |
4018 |
entryCompletionBlock:nil |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4019 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4020 |
|
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4021 |
request:aString displayAt:aPoint centered:centered action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4022 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4023 |
onCancel:cancelValue list:listToSelectFrom |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4024 |
"launch a Dialog, which allows user to enter a string. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4025 |
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
|
4026 |
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
|
4027 |
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
|
4028 |
screen center (if centered is true). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4029 |
The ok-button is labelled okLabel (or the default, ifNil), |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4030 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4031 |
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
|
4032 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4033 |
^ self |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4034 |
request:aString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4035 |
displayAt:aPoint |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4036 |
centered:centered |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4037 |
action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4038 |
initialAnswer:initial |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4039 |
okLabel:okLabel |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4040 |
cancelLabel:cancelLabel |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4041 |
title:titleString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4042 |
onCancel:cancelValue |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4043 |
list:listToSelectFrom |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4044 |
initialSelection:nil |
2444 | 4045 |
entryCompletionBlock:nil |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4046 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4047 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4048 |
centered around 200@200: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4049 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4050 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4051 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4052 |
displayAt:200@200 |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4053 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4054 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4055 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4056 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4057 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4058 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4059 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4060 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4061 |
under mouse pointer: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4062 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4063 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4064 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4065 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4066 |
centered:false |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4067 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4068 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4069 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4070 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4071 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4072 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4073 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4074 |
centered on the screen: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4075 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4076 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4077 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4078 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4079 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4080 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4081 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4082 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4083 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4084 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4085 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4086 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4087 |
with a list: |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4088 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4089 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4090 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4091 |
displayAt:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4092 |
centered:true |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4093 |
action:[:result | result printNewline] |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4094 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4095 |
okLabel:'yes' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4096 |
cancelLabel:'no' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4097 |
title:'foo' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4098 |
onCancel:#foo |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4099 |
list:#(foo bar baz) |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4100 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4101 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4102 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4103 |
"Modified: / 5.5.1999 / 10:50:22 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4104 |
! |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4105 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4106 |
request:aString displayAt:aPoint centered:centered action:resultAction |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4107 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
4556 | 4108 |
onCancel:cancelValue list:listToSelectFrom initialSelection:anIntervalOrNil |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4109 |
"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
|
4110 |
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
|
4111 |
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
|
4112 |
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
|
4113 |
screen center (if centered is true). |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4114 |
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
|
4115 |
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
|
4116 |
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
|
4117 |
|
2444 | 4118 |
^ self |
4119 |
request:aString |
|
4120 |
displayAt:aPoint |
|
4121 |
centered:centered |
|
4122 |
action:resultAction |
|
4123 |
initialAnswer:initial |
|
4124 |
okLabel:okLabel |
|
4125 |
cancelLabel:cancelLabel |
|
4126 |
title:titleString |
|
4127 |
onCancel:cancelValue |
|
4128 |
list:listToSelectFrom |
|
4556 | 4129 |
initialSelection:anIntervalOrNil |
2444 | 4130 |
entryCompletionBlock:nil |
4131 |
||
4132 |
" |
|
4133 |
centered around 200@200: |
|
4134 |
||
4135 |
Dialog |
|
2548 | 4136 |
request:'Enter a string:' |
2444 | 4137 |
displayAt:200@200 |
4138 |
centered:true |
|
4139 |
action:[:result | result printNewline] |
|
4140 |
initialAnswer:'the default' |
|
2548 | 4141 |
okLabel:'Yes' |
4142 |
cancelLabel:'No' |
|
2444 | 4143 |
title:'foo' |
4144 |
onCancel:#foo |
|
4145 |
||
4146 |
under mouse pointer: |
|
4147 |
||
4148 |
Dialog |
|
2548 | 4149 |
request:'Enter a string:' |
2444 | 4150 |
displayAt:nil |
4151 |
centered:false |
|
4152 |
action:[:result | result printNewline] |
|
4153 |
initialAnswer:'the default' |
|
2548 | 4154 |
okLabel:'Yes' |
4155 |
cancelLabel:'No' |
|
2444 | 4156 |
title:'foo' |
4157 |
onCancel:#foo |
|
4158 |
||
4159 |
centered on the screen: |
|
4160 |
||
4161 |
Dialog |
|
2548 | 4162 |
request:'Enter a string:' |
2444 | 4163 |
displayAt:nil |
4164 |
centered:true |
|
4165 |
action:[:result | result printNewline] |
|
4166 |
initialAnswer:'the default' |
|
2548 | 4167 |
okLabel:'Yes' |
4168 |
cancelLabel:'No' |
|
2444 | 4169 |
title:'foo' |
4170 |
onCancel:#foo |
|
4171 |
||
4172 |
with a list: |
|
4173 |
||
4174 |
Dialog |
|
2548 | 4175 |
request:'Enter a string:' |
2444 | 4176 |
displayAt:nil |
4177 |
centered:true |
|
4178 |
action:[:result | result printNewline] |
|
4179 |
initialAnswer:'the default' |
|
2548 | 4180 |
okLabel:'Yes' |
4181 |
cancelLabel:'No' |
|
2444 | 4182 |
title:'foo' |
4183 |
onCancel:#foo |
|
4184 |
list:#(foo bar baz) |
|
4185 |
" |
|
4186 |
||
4187 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
|
4188 |
"Modified: / 5.5.1999 / 10:50:22 / cg" |
|
4189 |
! |
|
4190 |
||
4191 |
request:aString displayAt:aPoint centered:centeredOrNil action:resultAction |
|
4192 |
initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
|
4556 | 4193 |
onCancel:cancelValue list:listToSelectFrom initialSelection:anIntervalOrNil |
2444 | 4194 |
entryCompletionBlock:entryCompletionBlock |
4195 |
"launch a Dialog, which allows user to enter a string. |
|
4196 |
The dialogs window is titled titleString, or the default (if nil). |
|
4197 |
If aPoint is nonNil, the box is shown there, optionally centered around it. |
|
4198 |
If it is nil, it is shown at the current pointer position or at the |
|
4199 |
screen center (if centered is true). |
|
4200 |
The ok-button is labelled okLabel (or the default, ifNil), |
|
4201 |
the cancel-button is labelled cancelLabel (or the default, ifNil). |
|
4202 |
Return the string or the value of cancelValue (if cancel was pressed)" |
|
4203 |
||
4204 |
|box centered| |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4205 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4206 |
listToSelectFrom isNil ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4207 |
box := EnterBox title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4208 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4209 |
box := EnterBoxWithList title:aString. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4210 |
box list:listToSelectFrom. |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4211 |
]. |
2685 | 4212 |
initial notNil ifTrue:[ box initialText:initial printString ]. |
4556 | 4213 |
anIntervalOrNil notNil ifTrue:[ |
4214 |
box selectFromCharacterPosition:anIntervalOrNil start to:anIntervalOrNil stop. |
|
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4215 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
4216 |
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
|
4217 |
okLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4218 |
box okText:okLabel. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4219 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4220 |
cancelLabel notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4221 |
box abortText:cancelLabel |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4222 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4223 |
resultAction isNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4224 |
box action:[:val | box destroy. ^ val] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4225 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4226 |
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
|
4227 |
]. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4228 |
titleString notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4229 |
box label:titleString |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4230 |
]. |
2444 | 4231 |
entryCompletionBlock notNil ifTrue:[ |
2517 | 4232 |
"/ box entryCompletionBlock:[:text | box |
4233 |
"/ initialText:(entryCompletionBlock value:text) |
|
4234 |
"/ selected:false]. |
|
4235 |
box entryCompletionBlock:entryCompletionBlock. |
|
2444 | 4236 |
]. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4237 |
|
2444 | 4238 |
centered := centeredOrNil ? (ForceModalBoxesToOpenAtCenter ? false). |
4239 |
||
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4240 |
aPoint notNil ifTrue:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4241 |
box showAt:aPoint center:centered |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4242 |
] ifFalse:[ |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4243 |
centered ifTrue:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4244 |
box showAtCenter |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4245 |
] ifFalse:[ |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4246 |
box showAtPointer |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4247 |
] |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4248 |
]. |
719
574be1981be0
destroy boxes from standard dialogs
Claus Gittinger <cg@exept.de>
parents:
718
diff
changeset
|
4249 |
box destroy. |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4250 |
^ cancelValue value. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4251 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4252 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4253 |
centered around 200@200: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4254 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4255 |
Dialog |
2548 | 4256 |
request:'Enter a string:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4257 |
displayAt:200@200 |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4258 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4259 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4260 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4261 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4262 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4263 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4264 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4265 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4266 |
under mouse pointer: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4267 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4268 |
Dialog |
2548 | 4269 |
request:'Enter a string:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4270 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4271 |
centered:false |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4272 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4273 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4274 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4275 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4276 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4277 |
onCancel:#foo |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4278 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4279 |
centered on the screen: |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4280 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4281 |
Dialog |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4282 |
request:'enter a string:' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4283 |
displayAt:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4284 |
centered:true |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4285 |
action:[:result | result printNewline] |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4286 |
initialAnswer:'the default' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4287 |
okLabel:'yes' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4288 |
cancelLabel:'no' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4289 |
title:'foo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4290 |
onCancel:#foo |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4291 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4292 |
with a list: |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4293 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4294 |
Dialog |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4295 |
request:'enter a string:' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4296 |
displayAt:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4297 |
centered:true |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4298 |
action:[:result | result printNewline] |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4299 |
initialAnswer:'the default' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4300 |
okLabel:'yes' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4301 |
cancelLabel:'no' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4302 |
title:'foo' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4303 |
onCancel:#foo |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4304 |
list:#(foo bar baz) |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4305 |
" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4306 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4307 |
"Created: / 29.5.1996 / 14:35:04 / cg" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4308 |
"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
|
4309 |
! |
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
|
4310 |
|
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
|
4311 |
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
|
4312 |
"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
|
4313 |
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
|
4314 |
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
|
4315 |
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
|
4316 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4317 |
^ self |
2444 | 4318 |
request:aString |
4319 |
displayAt:aPoint |
|
4320 |
centered:centered |
|
4321 |
action:resultAction |
|
4322 |
initialAnswer:initial |
|
4323 |
okLabel:nil |
|
4324 |
cancelLabel:nil |
|
4325 |
title:nil |
|
4326 |
onCancel:cancelValue |
|
4327 |
list:nil |
|
4328 |
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
|
4329 |
|
100 | 4330 |
" |
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
|
4331 |
at topLeft (centering is suppressed, to make the box fully visible) |
2444 | 4332 |
Dialog |
4333 |
request:'enter a string:' |
|
4334 |
displayAt:0@0 |
|
4335 |
centered:true |
|
4336 |
action:[:result | result printNewline] |
|
4337 |
initialAnswer:'the default' |
|
4338 |
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
|
4339 |
|
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
|
4340 |
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
|
4341 |
|
2444 | 4342 |
Dialog |
4343 |
request:'enter a string:' |
|
4344 |
displayAt:200@200 |
|
4345 |
centered:true |
|
4346 |
action:[:result | result printNewline] |
|
4347 |
initialAnswer:'the default' |
|
4348 |
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
|
4349 |
|
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 |
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
|
4351 |
|
2444 | 4352 |
Dialog |
4353 |
request:'enter a string:' |
|
4354 |
displayAt:200@200 |
|
4355 |
centered:false |
|
4356 |
action:[:result | result printNewline] |
|
4357 |
initialAnswer:'the default' |
|
4358 |
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
|
4359 |
|
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
|
4360 |
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
|
4361 |
|
2444 | 4362 |
Dialog |
4363 |
request:'enter a string:' |
|
4364 |
displayAt:nil |
|
4365 |
centered:false |
|
4366 |
action:[:result | result printNewline] |
|
4367 |
initialAnswer:'the default' |
|
4368 |
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
|
4369 |
|
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
|
4370 |
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
|
4371 |
|
2444 | 4372 |
Dialog |
4373 |
request:'enter a string:' |
|
4374 |
displayAt:nil |
|
4375 |
centered:true |
|
4376 |
action:[:result | result printNewline] |
|
4377 |
initialAnswer:'the default' |
|
4378 |
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
|
4379 |
" |
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
|
4380 |
|
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
|
4381 |
"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
|
4382 |
"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
|
4383 |
! |
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
|
4384 |
|
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
|
4385 |
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
|
4386 |
"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
|
4387 |
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
|
4388 |
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
|
4389 |
|
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
|
4390 |
^ self |
2439 | 4391 |
request:aString |
4392 |
displayAt:aPoint |
|
4393 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4394 |
action:nil |
|
4395 |
initialAnswer:initial |
|
4093 | 4396 |
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
|
4397 |
|
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
|
4398 |
" |
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
|
4399 |
Dialog |
2439 | 4400 |
request:'enter a string:' |
4401 |
displayAt:(250 @ 250) |
|
4402 |
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
|
4403 |
" |
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
|
4404 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4405 |
"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
|
4406 |
! |
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
|
4407 |
|
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
|
4408 |
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
|
4409 |
"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
|
4410 |
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
|
4411 |
|
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
|
4412 |
^ self |
2439 | 4413 |
request:aString |
4414 |
displayAt:nil |
|
4415 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4416 |
action:nil |
|
2444 | 4417 |
initialAnswer:initial |
4418 |
okLabel:nil |
|
4419 |
cancelLabel:nil |
|
4420 |
title:nil |
|
4093 | 4421 |
onCancel:nil |
2444 | 4422 |
list:nil |
4423 |
initialSelection:nil |
|
4424 |
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
|
4425 |
|
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
|
4426 |
" |
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
|
4427 |
Dialog |
2439 | 4428 |
request:'enter a string:' |
4429 |
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
|
4430 |
" |
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
|
4431 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4432 |
"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
|
4433 |
! |
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
|
4434 |
|
2444 | 4435 |
request:aString initialAnswer:initial entryCompletionBlock:entryCompletionBlock |
4436 |
"launch a Dialog, which allows user to enter something. |
|
4437 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
|
4438 |
||
4439 |
^ self |
|
4440 |
request:aString |
|
4441 |
displayAt:nil |
|
4442 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4443 |
action:nil |
|
4444 |
initialAnswer:initial |
|
4445 |
okLabel:nil |
|
4446 |
cancelLabel:nil |
|
4447 |
title:nil |
|
4093 | 4448 |
onCancel:nil |
2444 | 4449 |
list:nil |
4450 |
initialSelection:nil |
|
4451 |
entryCompletionBlock:entryCompletionBlock |
|
4452 |
||
4453 |
" |
|
4454 |
Dialog |
|
4455 |
request:'enter a selector:' |
|
4456 |
initialAnswer:'at:p' |
|
4457 |
entryCompletionBlock:[:s | |completion| |
|
4458 |
||
4459 |
completion := Smalltalk selectorCompletion:s. |
|
4460 |
completion second size > 1 ifTrue:[ Screen current beep]. |
|
4461 |
completion first |
|
4462 |
]. |
|
4463 |
" |
|
4464 |
||
4465 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
|
4466 |
! |
|
4467 |
||
4556 | 4468 |
request:aString initialAnswer:initial initialSelection:anIntervalOrNil |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4469 |
"launch a Dialog, which allows user to enter something. |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4470 |
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
|
4471 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4472 |
^ self |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4473 |
request:aString |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4474 |
displayAt:nil |
2439 | 4475 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4476 |
action:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4477 |
initialAnswer:initial |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4478 |
okLabel:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4479 |
cancelLabel:nil |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4480 |
title:nil |
4093 | 4481 |
onCancel:nil |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4482 |
list:nil |
4556 | 4483 |
initialSelection:anIntervalOrNil |
2444 | 4484 |
entryCompletionBlock:nil |
2080
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4485 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4486 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4487 |
Dialog |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4488 |
request:'enter a string:' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4489 |
initialAnswer:'the default' |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4490 |
initialSelection:(1 to:3) |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4491 |
" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4492 |
|
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4493 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4494 |
! |
620d5ac7dee5
added #request:initialAnswer:initialSelection:
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
4495 |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4496 |
request:aString initialAnswer:initial list:aList |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4497 |
"launch a Dialog, which allows user to enter something, |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4498 |
or select from a list of values. |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4499 |
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
|
4500 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4501 |
^ self |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4502 |
request:aString |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4503 |
displayAt:nil |
2439 | 4504 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4505 |
action:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4506 |
initialAnswer:initial |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4507 |
okLabel:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4508 |
cancelLabel:nil |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4509 |
title:nil |
4093 | 4510 |
onCancel:nil |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4511 |
list:aList |
2444 | 4512 |
initialSelection:nil |
4513 |
entryCompletionBlock:nil |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4514 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4515 |
" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4516 |
Dialog |
2548 | 4517 |
request:'Enter a string:' |
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4518 |
initialAnswer:'the default' |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4519 |
list:#('foo' 'bar' 'baz') |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4520 |
" |
2110 | 4521 |
" |
4522 |
Dialog |
|
4523 |
request:'enter a string:' |
|
4524 |
initialAnswer:'the default' |
|
4525 |
list:((1 to:30) collect:[:i | i printString]) |
|
4526 |
" |
|
1898
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4527 |
|
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4528 |
"Modified: / 5.5.1999 / 10:53:45 / cg" |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4529 |
! |
fe4300f57e1a
convenient entry: #request:initialAnswer:list
Claus Gittinger <cg@exept.de>
parents:
1877
diff
changeset
|
4530 |
|
2550 | 4531 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString |
4532 |
"launch a Dialog, which allows user to enter something. |
|
4533 |
Return the entered string (may be empty string) |
|
4534 |
or cancelValue (if cancel was pressed)" |
|
4535 |
||
4536 |
^ self |
|
4537 |
request:aString |
|
4538 |
displayAt:nil |
|
4539 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4540 |
action:nil |
|
4541 |
initialAnswer:initial |
|
4542 |
okLabel:okLabel |
|
4543 |
cancelLabel:nil |
|
4544 |
title:titleString |
|
4545 |
onCancel:nil |
|
4546 |
list:nil |
|
4547 |
initialSelection:nil |
|
4548 |
entryCompletionBlock:nil |
|
4549 |
||
4550 |
" |
|
4551 |
Dialog |
|
4552 |
request:'Enter a string:' |
|
4553 |
initialAnswer:'the default' |
|
4554 |
okLabel:'Yes' |
|
4555 |
title:'Only a Test' |
|
4556 |
" |
|
4557 |
||
4558 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
|
4559 |
"Created: 29.5.1996 / 14:59:57 / cg" |
|
4560 |
! |
|
4561 |
||
2551 | 4562 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString list:list |
4563 |
"launch a Dialog, which allows user to enter something. |
|
4564 |
Return the entered string (may be empty string) |
|
4565 |
or cancelValue (if cancel was pressed)" |
|
4566 |
||
4567 |
^ self |
|
4568 |
request:aString |
|
4569 |
displayAt:nil |
|
4570 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4571 |
action:nil |
|
4572 |
initialAnswer:initial |
|
4573 |
okLabel:okLabel |
|
4574 |
cancelLabel:nil |
|
4575 |
title:titleString |
|
4576 |
onCancel:nil |
|
4577 |
list:list |
|
4578 |
initialSelection:nil |
|
4579 |
entryCompletionBlock:nil |
|
4580 |
||
4581 |
" |
|
4582 |
Dialog |
|
4583 |
request:'Enter or select a string:' |
|
4584 |
initialAnswer:'the default' |
|
4585 |
okLabel:'Yes' |
|
4586 |
title:'Only a Test' |
|
4587 |
list:#('a' 'b' 'c') |
|
4588 |
" |
|
4589 |
||
4590 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
|
4591 |
"Created: 29.5.1996 / 14:59:57 / cg" |
|
4592 |
! |
|
4593 |
||
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4594 |
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
|
4595 |
"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
|
4596 |
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
|
4597 |
or cancelValue (if cancel was pressed)" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4598 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4599 |
^ self |
2439 | 4600 |
request:aString |
4601 |
displayAt:nil |
|
4602 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4603 |
action:nil |
|
4604 |
initialAnswer:initial |
|
4605 |
okLabel:okLabel |
|
4606 |
cancelLabel:nil |
|
4607 |
title:titleString |
|
4608 |
onCancel:cancelAction |
|
2444 | 4609 |
list:nil |
4610 |
initialSelection:nil |
|
4611 |
entryCompletionBlock:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4612 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4613 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4614 |
Dialog |
2548 | 4615 |
request:'Enter a string:' |
2439 | 4616 |
initialAnswer:'the default' |
4617 |
onCancel:['foooo'] |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4618 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4619 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4620 |
"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
|
4621 |
"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
|
4622 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4623 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4624 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction list:listOfChoices |
2548 | 4625 |
"launch a Dialog, which allows user to enter something |
4626 |
(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
|
4627 |
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
|
4628 |
or cancelValue (if cancel was pressed)" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4629 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4630 |
^ self |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4631 |
request:aString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4632 |
displayAt:nil |
2439 | 4633 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4634 |
action:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4635 |
initialAnswer:initial |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4636 |
okLabel:okLabel |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4637 |
cancelLabel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4638 |
title:titleString |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4639 |
onCancel:cancelAction |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4640 |
list:listOfChoices |
2444 | 4641 |
initialSelection:nil |
4642 |
entryCompletionBlock:nil |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4643 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4644 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4645 |
Dialog |
2548 | 4646 |
request:'Enter a String:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4647 |
initialAnswer:'the default' |
2548 | 4648 |
okLabel:'OK' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4649 |
title:'demo' |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4650 |
onCancel:nil |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4651 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4652 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4653 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4654 |
"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
|
4655 |
"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
|
4656 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4657 |
|
2517 | 4658 |
request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction list:listOfChoices entryCompletionBlock:entryCompletionBlock |
2548 | 4659 |
"launch a Dialog, which allows user to enter something |
4660 |
(with a list of choices for fast input). |
|
2517 | 4661 |
Return the entered string (may be empty string) |
4662 |
or cancelValue (if cancel was pressed)" |
|
4663 |
||
4664 |
^ self |
|
4665 |
request:aString |
|
4666 |
displayAt:nil |
|
4667 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4668 |
action:nil |
|
4669 |
initialAnswer:initial |
|
4670 |
okLabel:okLabel |
|
4671 |
cancelLabel:nil |
|
4672 |
title:titleString |
|
4673 |
onCancel:cancelAction |
|
4674 |
list:listOfChoices |
|
4675 |
initialSelection:nil |
|
4676 |
entryCompletionBlock:entryCompletionBlock |
|
4677 |
||
4678 |
" |
|
4679 |
Dialog |
|
2548 | 4680 |
request:'Enter a String:' |
2517 | 4681 |
initialAnswer:'the default' |
2548 | 4682 |
okLabel:'OK' |
2517 | 4683 |
title:'demo' |
4684 |
onCancel:nil |
|
4685 |
list:#('foo' 'bar' 'baz') |
|
4686 |
" |
|
4687 |
||
4688 |
"Modified: 29.5.1996 / 14:28:24 / cg" |
|
4689 |
"Created: 29.5.1996 / 14:59:57 / cg" |
|
4690 |
! |
|
4691 |
||
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
|
4692 |
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
|
4693 |
"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
|
4694 |
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
|
4695 |
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
|
4696 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4697 |
^ self |
2439 | 4698 |
request:aString |
4699 |
displayAt:nil |
|
4700 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4701 |
action:nil |
|
4702 |
initialAnswer:initial |
|
2444 | 4703 |
okLabel:nil |
4704 |
cancelLabel:nil |
|
4705 |
title:nil |
|
2439 | 4706 |
onCancel:cancelAction |
2444 | 4707 |
list:nil |
4708 |
initialSelection:nil |
|
4709 |
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
|
4710 |
|
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
|
4711 |
" |
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
|
4712 |
Dialog |
2439 | 4713 |
request:'enter a string:' |
4714 |
initialAnswer:'the default' |
|
4715 |
onCancel:['foooo'] |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4716 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4717 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4718 |
"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
|
4719 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4720 |
|
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4721 |
request:aString list:listOfChoices |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4722 |
"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
|
4723 |
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
|
4724 |
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
|
4725 |
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
|
4726 |
|
4302 | 4727 |
^ self request:aString list:listOfChoices initialAnswer:'' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4728 |
|
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4729 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4730 |
Dialog |
2548 | 4731 |
request:'Enter a string:' |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4732 |
list:#('foo' 'bar' 'baz') |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4733 |
" |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4734 |
|
4302 | 4735 |
"Modified: / 18-08-2011 / 19:29:28 / cg" |
1705
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4736 |
! |
1a126505ac49
added a standard request dialog with a comboBox
Claus Gittinger <cg@exept.de>
parents:
1704
diff
changeset
|
4737 |
|
4301
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4738 |
request:aString list:listOfChoices initialAnswer:initialAnswer |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4739 |
"launch a Dialog, which allows user to enter something, |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4740 |
but adds a list of choices for fast input. |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4741 |
Return the entered string (may be empty string) |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4742 |
or the empty string (if cancel was pressed)" |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4743 |
|
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4744 |
^ self |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4745 |
request:aString |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4746 |
displayAt:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4747 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4748 |
action:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4749 |
initialAnswer:initialAnswer |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4750 |
okLabel:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4751 |
cancelLabel:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4752 |
title:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4753 |
onCancel:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4754 |
list:listOfChoices |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4755 |
initialSelection:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4756 |
entryCompletionBlock:nil |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4757 |
|
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4758 |
" |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4759 |
Dialog |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4760 |
request:'Enter a string:' |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4761 |
list:#('foo' 'bar' 'baz') |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4762 |
initialAnswer:'foe' |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4763 |
" |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4764 |
|
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4765 |
"Modified: / 29-05-1996 / 14:26:25 / cg" |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4766 |
"Created: / 18-08-2011 / 19:28:13 / cg" |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4767 |
! |
1b9559767efb
added: #request:list:initialAnswer:
Claus Gittinger <cg@exept.de>
parents:
4294
diff
changeset
|
4768 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4769 |
request:aString okLabel:okLabel |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4770 |
"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
|
4771 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4772 |
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
|
4773 |
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
|
4774 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4775 |
^ self |
2439 | 4776 |
request:aString |
4777 |
displayAt:nil |
|
4778 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4779 |
action:nil |
|
4780 |
initialAnswer:'' |
|
4781 |
okLabel:okLabel |
|
4782 |
cancelLabel:nil |
|
2444 | 4783 |
title:nil |
4784 |
onCancel:nil |
|
4785 |
list:nil |
|
4786 |
initialSelection:nil |
|
4787 |
entryCompletionBlock:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4788 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4789 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4790 |
Dialog |
2548 | 4791 |
request:'Enter a string:' |
4792 |
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
|
4793 |
" |
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
|
4794 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4795 |
"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
|
4796 |
"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
|
4797 |
! |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4798 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4799 |
request:aString okLabel:okLabel onCancel:cancelValue |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4800 |
"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
|
4801 |
The okButton is labelled as okLabel. |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4802 |
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
|
4803 |
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
|
4804 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4805 |
^ self |
2439 | 4806 |
request:aString |
4807 |
displayAt:nil |
|
4808 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4809 |
action:nil |
|
4810 |
initialAnswer:'' |
|
4811 |
okLabel:okLabel |
|
4812 |
cancelLabel:nil |
|
2444 | 4813 |
title:nil |
2439 | 4814 |
onCancel:cancelValue |
2444 | 4815 |
list:nil |
4816 |
initialSelection:nil |
|
4817 |
entryCompletionBlock:nil |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4818 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4819 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4820 |
Dialog |
2548 | 4821 |
request:'Enter a string:' |
4822 |
okLabel:'Yes' |
|
2439 | 4823 |
onCancel:nil |
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4824 |
" |
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4825 |
|
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4826 |
"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
|
4827 |
! |
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
|
4828 |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4829 |
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
|
4830 |
"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
|
4831 |
The okButton is labelled as okLabel. |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4832 |
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
|
4833 |
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
|
4834 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4835 |
^ self |
2439 | 4836 |
request:aString |
4837 |
displayAt:nil |
|
4838 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4839 |
action:nil |
|
4840 |
initialAnswer:'' |
|
4841 |
okLabel:okLabel |
|
4842 |
cancelLabel:nil |
|
4843 |
title:titleString |
|
4844 |
onCancel:cancelValue |
|
2444 | 4845 |
list:nil |
4846 |
initialSelection:nil |
|
4847 |
entryCompletionBlock:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4848 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4849 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4850 |
Dialog |
2548 | 4851 |
request:'Enter a String:' |
4852 |
okLabel:'Yes' |
|
2439 | 4853 |
title:'foo' |
4854 |
onCancel:nil |
|
718
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4855 |
" |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4856 |
|
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4857 |
"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
|
4858 |
"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
|
4859 |
! |
bd04131f84c8
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
717
diff
changeset
|
4860 |
|
2360 | 4861 |
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
|
4862 |
"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
|
4863 |
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
|
4864 |
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
|
4865 |
|
717
816259bd3408
more fill-in-the-blank standard entries
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
4866 |
^ self |
2360 | 4867 |
request:aString |
4868 |
displayAt:nil |
|
2439 | 4869 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
2360 | 4870 |
action:nil |
4871 |
initialAnswer:'' |
|
2444 | 4872 |
okLabel:nil |
4873 |
cancelLabel:nil |
|
4874 |
title:nil |
|
2360 | 4875 |
onCancel:cancelActionOrValue |
2444 | 4876 |
list:nil |
4877 |
initialSelection:nil |
|
4878 |
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
|
4879 |
|
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
|
4880 |
" |
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
|
4881 |
Dialog |
2548 | 4882 |
request:'Enter a String:' |
2360 | 4883 |
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
|
4884 |
" |
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
|
4885 |
|
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
|
4886 |
"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
|
4887 |
"Modified: 29.5.1996 / 14:28:59 / cg" |
100 | 4888 |
! |
4889 |
||
5091 | 4890 |
request:aString title:windowTitle |
4891 |
"launch a Dialog, which allows user to enter a string." |
|
4892 |
||
4893 |
^ self |
|
4894 |
request:aString |
|
4895 |
displayAt:nil |
|
4896 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4897 |
action:nil |
|
4898 |
initialAnswer:nil |
|
4899 |
okLabel:nil |
|
4900 |
cancelLabel:nil |
|
4901 |
title:windowTitle |
|
4902 |
onCancel:'' |
|
4903 |
list:nil |
|
4904 |
initialSelection:nil |
|
4905 |
||
4906 |
" |
|
4907 |
at topLeft (centering is suppressed, to make the box fully visible) |
|
4908 |
Dialog |
|
4909 |
request:'enter a string:' |
|
4910 |
displayAt:0@0 |
|
4911 |
centered:true |
|
4912 |
action:[:result | result printNewline] |
|
4913 |
initialAnswer:'the default' |
|
4914 |
onCancel:#foo |
|
4915 |
||
4916 |
centered around 200@200: |
|
4917 |
||
4918 |
Dialog |
|
4919 |
request:'enter a string:' |
|
4920 |
displayAt:200@200 |
|
4921 |
centered:true |
|
4922 |
action:[:result | result printNewline] |
|
4923 |
initialAnswer:'the default' |
|
4924 |
onCancel:#foo |
|
4925 |
||
4926 |
topLeft of box at 200@200: |
|
4927 |
||
4928 |
Dialog |
|
4929 |
request:'enter a string:' |
|
4930 |
displayAt:200@200 |
|
4931 |
centered:false |
|
4932 |
action:[:result | result printNewline] |
|
4933 |
initialAnswer:'the default' |
|
4934 |
onCancel:#foo |
|
4935 |
||
4936 |
under mouse pointer: |
|
4937 |
||
4938 |
Dialog |
|
4939 |
request:'enter a string:' |
|
4940 |
displayAt:nil |
|
4941 |
centered:false |
|
4942 |
action:[:result | result printNewline] |
|
4943 |
initialAnswer:'the default' |
|
4944 |
onCancel:#foo |
|
4945 |
||
4946 |
centered on the screen: |
|
4947 |
||
4948 |
Dialog |
|
4949 |
request:'enter a string:' |
|
4950 |
displayAt:nil |
|
4951 |
centered:true |
|
4952 |
action:[:result | result printNewline] |
|
4953 |
initialAnswer:'the default' |
|
4954 |
onCancel:#foo |
|
4955 |
" |
|
4956 |
||
4957 |
"Created: 7.12.1995 / 23:14:10 / cg" |
|
4958 |
"Modified: 29.5.1996 / 14:24:39 / cg" |
|
4959 |
! |
|
4960 |
||
2718 | 4961 |
request:aString title:titleString initialAnswer:initial |
4962 |
"launch a Dialog, which allows user to enter something. |
|
4963 |
Return the entered string (may be empty string) or nil (if cancel was pressed)" |
|
4964 |
||
4965 |
^ self |
|
4966 |
request:aString |
|
4967 |
displayAt:nil |
|
4968 |
centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
4969 |
action:nil |
|
4970 |
initialAnswer:initial |
|
4971 |
okLabel:nil |
|
4972 |
cancelLabel:nil |
|
4973 |
title:titleString |
|
4093 | 4974 |
onCancel:nil |
2718 | 4975 |
list:nil |
4976 |
initialSelection:nil |
|
4977 |
entryCompletionBlock:nil |
|
4978 |
||
4979 |
" |
|
4980 |
Dialog |
|
4981 |
request:'enter a string:' |
|
4982 |
initialAnswer:'the default' |
|
4983 |
" |
|
4984 |
||
4985 |
"Modified: 29.5.1996 / 14:30:05 / cg" |
|
4986 |
! |
|
4987 |
||
3152 | 4988 |
requestNumber:aString |
4989 |
"launch a Dialog, which allows user to enter a number. |
|
4990 |
Return the numeric value or nil |
|
4991 |
(for an invalid number or if cancel was pressed)" |
|
4992 |
||
4993 |
|string| |
|
4994 |
||
4995 |
string := self request:aString. |
|
4996 |
^ Number readFrom:string onError:nil. |
|
4997 |
||
4998 |
" |
|
4999 |
Dialog requestNumber:'Enter your Age:' |
|
5000 |
" |
|
5001 |
||
5002 |
"Created: 17.11.1995 / 09:45:21 / cg" |
|
5003 |
! |
|
5004 |
||
3321 | 5005 |
requestNumber:aString initialAnswer: aNumber |
5006 |
"launch a Dialog, which allows user to enter a number. |
|
5007 |
Return the numeric value or nil |
|
5008 |
(for an invalid number or if cancel was pressed)" |
|
5009 |
||
5010 |
|string| |
|
5011 |
||
5012 |
string := self request:aString initialAnswer: aNumber. |
|
5013 |
^ Number readFrom:string onError:nil. |
|
5014 |
||
5015 |
" |
|
5016 |
Dialog requestNumber:'Enter your Age:' initialAnswer: 25 |
|
5017 |
" |
|
5018 |
||
5019 |
"Created: / 26-07-2006 / 12:22:23 / fm" |
|
5020 |
"Modified: / 07-08-2006 / 15:31:30 / fm" |
|
5021 |
! |
|
5022 |
||
197 | 5023 |
requestPassword:aString |
5024 |
"launch a Dialog, which allows user to enter something invisibly. |
|
5025 |
Return the entered string (may be empty string) |
|
5026 |
or nil (if cancel was pressed)" |
|
100 | 5027 |
|
197 | 5028 |
^ EnterBox requestPassword:aString |
133 | 5029 |
|
5030 |
" |
|
5031 |
Dialog |
|
2548 | 5032 |
requestPassword:'Enter Secret:' |
133 | 5033 |
" |
197 | 5034 |
|
5035 |
"Created: 17.11.1995 / 09:45:21 / cg" |
|
2014 | 5036 |
! |
5037 |
||
4882 | 5038 |
requestPassword:aString initialAnswer:defaultAnswer |
4880 | 5039 |
"launch a Dialog, which allows user to enter something invisibly. |
5040 |
Return the entered string (may be empty string) |
|
5041 |
or nil (if cancel was pressed)" |
|
5042 |
||
5043 |
^ EnterBox new initialText:defaultAnswer; requestPassword:aString |
|
5044 |
||
5045 |
" |
|
5046 |
Dialog |
|
5047 |
requestPassword:'Enter Secret:' |
|
5048 |
initialText:'blabla' |
|
5049 |
" |
|
5050 |
! |
|
5051 |
||
4139 | 5052 |
requestText:title |
5053 |
"open a dialog asking for multiline text. |
|
5054 |
Return a stringCollection or nil if cancelled." |
|
5055 |
||
5056 |
^ self |
|
4556 | 5057 |
requestText:title initialAnswer:'' initialSelection:nil |
4139 | 5058 |
|
5059 |
" |
|
5060 |
Dialog requestText:'Bla' |
|
5061 |
" |
|
5062 |
! |
|
5063 |
||
4556 | 5064 |
requestText:title initialAnswer:initialAnswer |
4139 | 5065 |
"open a dialog asking for multiline text. |
5066 |
Return a stringCollection or nil if cancelled." |
|
5067 |
||
5068 |
^ self |
|
4556 | 5069 |
requestText:title initialAnswer:initialAnswer initialSelection:nil |
4139 | 5070 |
|
5071 |
" |
|
5072 |
Dialog requestText:'Bla' initialAnswer:'Hello world' |
|
5073 |
" |
|
5074 |
! |
|
5075 |
||
4556 | 5076 |
requestText:title initialAnswer:initialAnswer initialSelection:anIntervalOrNil |
5077 |
"open a dialog asking for multiline text. |
|
5078 |
Return a stringCollection or nil if cancelled." |
|
5079 |
||
5080 |
^ self |
|
5081 |
requestText:title lines:10 columns:60 initialAnswer:initialAnswer initialSelection:anIntervalOrNil |
|
5082 |
||
5083 |
" |
|
5084 |
Dialog requestText:'Bla' initialAnswer:'Hello world' initialSelection:(1 to:5) |
|
5085 |
" |
|
5086 |
! |
|
5087 |
||
2014 | 5088 |
requestText:title lines:numLines columns:numCols initialAnswer:initialText |
5089 |
"open a dialog asking for multiline text. |
|
5090 |
Return a stringCollection or nil if cancelled." |
|
5091 |
||
4556 | 5092 |
^ self |
5093 |
requestText:title lines:numLines columns:numCols |
|
5094 |
initialAnswer:initialText initialSelection:nil |
|
5095 |
||
5096 |
" |
|
5097 |
Dialog requestText:'Bla' lines:8 columns:40 initialAnswer:'hello world' |
|
5098 |
" |
|
5099 |
||
5100 |
"Modified: / 18.8.2000 / 21:45:41 / cg" |
|
5101 |
! |
|
5102 |
||
5103 |
requestText:title lines:numLines columns:numCols initialAnswer:initialText initialSelection:anIntervalOrNil |
|
5104 |
"open a dialog asking for multiline text. |
|
5105 |
Return a stringCollection or nil if cancelled." |
|
5106 |
||
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5107 |
|dialog textHolder| |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5108 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
5109 |
textHolder := ValueHolder new. |
4556 | 5110 |
dialog := Dialog |
5111 |
forRequestText:title editViewClass:EditTextView |
|
5112 |
lines:numLines columns:numCols |
|
5113 |
initialAnswer:initialText initialSelection:anIntervalOrNil |
|
5114 |
model:textHolder. |
|
2014 | 5115 |
dialog open. |
5116 |
dialog accepted ifTrue:[ |
|
2675 | 5117 |
^ textHolder value |
2014 | 5118 |
]. |
5119 |
^ nil |
|
5120 |
||
2675 | 5121 |
" |
4556 | 5122 |
Dialog |
5123 |
requestText:'Bla' lines:8 columns:40 initialAnswer:'hello world' |
|
5124 |
||
5125 |
Dialog |
|
5126 |
requestText:'Bla2' lines:8 columns:40 initialAnswer:'hello world' initialSelection:(1 to:5) |
|
5127 |
" |
|
2675 | 5128 |
|
5129 |
"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
|
5130 |
! ! |
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
|
5131 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
5132 |
!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
|
5133 |
|
3234 | 5134 |
choose:aString fromList:list lines:maxLines |
5135 |
"launch a Dialog showing the message and list. |
|
4581 | 5136 |
The user can select an item and click ok; in this case, the value |
5137 |
from list is returned (doubleclick works as well). |
|
3234 | 5138 |
If cancel is pressed, the value of cancelBlock is returned. |
5139 |
Pressing ok without a selection is treated like cancel." |
|
5140 |
||
5141 |
^ self |
|
5142 |
choose:aString |
|
3455 | 5143 |
fromList:(list collect:[:each| each printString]) values:list |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5144 |
initialSelection:nil |
3455 | 5145 |
buttons:nil values:nil |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5146 |
default:nil |
3234 | 5147 |
lines:maxLines |
5148 |
cancel:nil |
|
5149 |
multiple:false |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5150 |
title:nil |
3234 | 5151 |
postBuildBlock:nil |
5152 |
||
5153 |
" |
|
5154 |
Transcript showCR:( |
|
5155 |
Dialog |
|
5156 |
choose:'choose any' |
|
5157 |
fromList:#(1 2 3 4 5 6 7) |
|
5158 |
lines:4 |
|
5159 |
) |
|
5160 |
" |
|
5161 |
||
3455 | 5162 |
"Modified: / 02-03-2007 / 12:08:31 / cg" |
3234 | 5163 |
! |
5164 |
||
3307 | 5165 |
choose:aString fromList:list lines:maxLines initialSelection:initialSelection |
5166 |
"launch a Dialog showing the message and list. |
|
4581 | 5167 |
The user can select an item and click ok; in this case, the value |
5168 |
from list is returned (doubleclick works as well). |
|
3307 | 5169 |
If cancel is pressed, the value of cancelBlock is returned. |
5170 |
Pressing ok without a selection is treated like cancel." |
|
5171 |
||
5172 |
^ self |
|
5173 |
choose:aString |
|
5174 |
fromList:list values:list initialSelection:initialSelection |
|
5175 |
buttons:nil values:nil |
|
5176 |
lines:maxLines |
|
5177 |
cancel:nil |
|
5178 |
multiple:false |
|
5179 |
postBuildBlock:nil |
|
5180 |
||
5181 |
" |
|
5182 |
Transcript showCR:( |
|
5183 |
Dialog |
|
5184 |
choose:'choose any' |
|
5185 |
fromList:#(1 2 3 4 5 6 7) |
|
5186 |
lines:4 |
|
5187 |
initialSelection:4 |
|
5188 |
) |
|
5189 |
" |
|
5190 |
||
5191 |
"Modified: 27.1.1996 / 14:17:07 / cg" |
|
5192 |
! |
|
5193 |
||
3455 | 5194 |
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
|
5195 |
"launch a Dialog showing the message and list. |
4581 | 5196 |
The user can select an item and click ok; in this case, the value |
5197 |
from list is returned (doubleclick works as well). |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5198 |
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
|
5199 |
Pressing ok without a selection is treated like cancel." |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5200 |
|
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5201 |
^ self |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5202 |
choose:aString |
3455 | 5203 |
fromList:(list collect:[:each| each printString]) values:list |
5204 |
initialSelection:initialSelection |
|
5205 |
buttons:nil values:nil |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5206 |
default:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5207 |
lines:maxLines |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5208 |
cancel:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5209 |
multiple:false |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5210 |
title:windowTitle |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5211 |
postBuildBlock:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5212 |
|
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5213 |
" |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5214 |
Transcript showCR:( |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5215 |
Dialog |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5216 |
choose:'choose any' |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5217 |
fromList:#(1 2 3 4 5 6 7) |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5218 |
lines:4 |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5219 |
title:'Choose' |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5220 |
) |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5221 |
" |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5222 |
|
3455 | 5223 |
"Created: / 02-03-2007 / 12:06:39 / cg" |
5224 |
! |
|
5225 |
||
5226 |
choose:aString fromList:list lines:maxLines title:windowTitle |
|
5227 |
"launch a Dialog showing the message and list. |
|
4581 | 5228 |
The user can select an item and click ok; in this case, the value |
5229 |
from list is returned (doubleclick works as well). |
|
3455 | 5230 |
If cancel is pressed, the value of cancelBlock is returned. |
5231 |
Pressing ok without a selection is treated like cancel." |
|
5232 |
||
5233 |
^ self |
|
5234 |
choose:aString |
|
5235 |
fromList:(list collect:[:each| each printString]) values:list |
|
5236 |
initialSelection:nil |
|
5237 |
buttons:nil values:nil |
|
5238 |
default:nil |
|
5239 |
lines:maxLines |
|
5240 |
cancel:nil |
|
5241 |
multiple:false |
|
5242 |
title:windowTitle |
|
5243 |
postBuildBlock:nil |
|
5244 |
||
5245 |
" |
|
5246 |
Transcript showCR:( |
|
5247 |
Dialog |
|
5248 |
choose:'choose any' |
|
5249 |
fromList:#(1 2 3 4 5 6 7) |
|
5250 |
lines:4 |
|
5251 |
title:'Choose' |
|
5252 |
) |
|
5253 |
" |
|
5254 |
||
5255 |
"Modified: / 02-03-2007 / 12:08:20 / cg" |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5256 |
! |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5257 |
|
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
|
5258 |
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
|
5259 |
"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
|
5260 |
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
|
5261 |
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
|
5262 |
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
|
5263 |
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
|
5264 |
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
|
5265 |
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
|
5266 |
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
|
5267 |
|
2111 | 5268 |
^ self |
5269 |
choose:aString |
|
3455 | 5270 |
fromList:list values:listValues |
5271 |
buttons:buttonLabels values:buttonValues |
|
2111 | 5272 |
lines:maxLines |
5273 |
cancel:cancelBlock |
|
5274 |
multiple:false |
|
5275 |
||
5276 |
" |
|
5277 |
full example: |
|
5278 |
||
5279 |
Transcript showCR:( |
|
5280 |
Dialog |
|
5281 |
choose:'choose any' |
|
5282 |
fromList:#('one' 'two' 'three' 'four') |
|
5283 |
values:#(1 2 3 4) |
|
5284 |
buttons:#('five' 'six' 'seven') |
|
5285 |
values:#(5 6 7) |
|
5286 |
lines:10 |
|
5287 |
cancel:nil |
|
5288 |
) |
|
5289 |
||
5290 |
||
5291 |
no buttons: |
|
5292 |
||
5293 |
Transcript showCR:( |
|
5294 |
Dialog |
|
5295 |
choose:'choose any' |
|
5296 |
fromList:#('one' 'two' 'three' 'four') |
|
5297 |
values:#(1 2 3 4) |
|
5298 |
buttons:nil |
|
5299 |
values:nil |
|
5300 |
lines:4 |
|
5301 |
cancel:nil |
|
5302 |
) |
|
5303 |
||
5304 |
||
5305 |
no list (lines argument is ignored): |
|
5306 |
||
5307 |
Transcript showCR:( |
|
5308 |
Dialog |
|
5309 |
choose:'choose any' |
|
5310 |
fromList:nil |
|
5311 |
values:nil |
|
5312 |
buttons:#('one' 'two' 'three' 'four') |
|
5313 |
values:#(1 2 3 4) |
|
5314 |
lines:nil |
|
5315 |
cancel:nil |
|
5316 |
) |
|
5317 |
||
5318 |
||
5319 |
full including cancel value: |
|
5320 |
||
5321 |
Transcript showCR:( |
|
5322 |
Dialog |
|
5323 |
choose:'choose example' |
|
5324 |
fromList:#('one' 'two' 'three' 'four') |
|
5325 |
values:#(1 2 3 4) |
|
5326 |
buttons:#('five' 'six' 'seven') |
|
5327 |
values:#(5 6 7) |
|
5328 |
lines:4 |
|
5329 |
cancel:[Transcript flash. #aborted] |
|
5330 |
) |
|
5331 |
||
5332 |
||
5333 |
degenerated: |
|
5334 |
||
5335 |
Transcript showCR:( |
|
5336 |
Dialog |
|
5337 |
choose:'choose any' |
|
5338 |
fromList:nil |
|
5339 |
values:nil |
|
5340 |
buttons:nil |
|
5341 |
values:nil |
|
5342 |
lines:nil |
|
5343 |
cancel:nil |
|
5344 |
) |
|
5345 |
||
5346 |
||
5347 |
" |
|
5348 |
||
3455 | 5349 |
"Modified: / 02-03-2007 / 12:08:12 / cg" |
2111 | 5350 |
! |
5351 |
||
5352 |
choose:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock multiple:multiple |
|
5353 |
"launch a Dialog showing the message and list. |
|
5354 |
The user can select an item and click ok; in this case, the corresponding value |
|
5355 |
from listValues is returned (doubleclick works as well). |
|
5356 |
The list may be suppressed (if the list arg is nil). |
|
5357 |
If a list is present, multiple controls if multiple selections are allowed. |
|
5358 |
Below the list, an optional row of buttons is shown, which can also be |
|
5359 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
5360 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4642 | 5361 |
Pressing ok without a selection returns nil or an empty collection (if multiple is true)." |
2111 | 5362 |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5363 |
^ self |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5364 |
choose:aString |
3455 | 5365 |
fromList:list values:listValues |
5366 |
buttons:buttonLabels values:buttonValues |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5367 |
lines:maxLines |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5368 |
cancel:cancelBlock |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5369 |
multiple:multiple |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5370 |
postBuildBlock:nil |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5371 |
|
3455 | 5372 |
"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
|
5373 |
! |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5374 |
|
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5375 |
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
|
5376 |
"launch a Dialog showing the message and list. |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5377 |
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
|
5378 |
from listValues is returned (doubleclick works as well). |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5379 |
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
|
5380 |
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
|
5381 |
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
|
5382 |
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
|
5383 |
If cancel is pressed, the value of cancelBlock is returned. |
4642 | 5384 |
Pressing ok without a selection returns nil or an empty collection (if multiple is true)." |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5385 |
|
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5386 |
^ self |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5387 |
choose:aString |
3455 | 5388 |
fromList:list values:listValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5389 |
initialSelection:nil |
3455 | 5390 |
buttons:buttonLabels values:buttonValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5391 |
default:nil |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5392 |
lines:maxLines |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5393 |
cancel:cancelBlock |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5394 |
multiple:multiple |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5395 |
title:nil |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5396 |
postBuildBlock:aBlockOrNil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5397 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5398 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5399 |
full example: |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5400 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5401 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5402 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5403 |
choose:'choose any' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5404 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5405 |
values:#(1 2 3 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5406 |
buttons:#('five' 'six' 'seven') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5407 |
values:#(5 6 7) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5408 |
lines:10 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5409 |
cancel:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5410 |
multiple:true |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5411 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5412 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5413 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5414 |
no buttons: |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5415 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5416 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5417 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5418 |
choose:'choose any' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5419 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5420 |
values:#(1 2 3 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5421 |
buttons:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5422 |
values:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5423 |
lines:4 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5424 |
cancel:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5425 |
multiple:true |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5426 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5427 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5428 |
|
3455 | 5429 |
"Modified: / 02-03-2007 / 12:08:02 / cg" |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5430 |
! |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5431 |
|
4058
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5432 |
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
|
5433 |
"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
|
5434 |
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
|
5435 |
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
|
5436 |
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
|
5437 |
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
|
5438 |
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
|
5439 |
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
|
5440 |
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
|
5441 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5442 |
^ self |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5443 |
choose:aString |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5444 |
fromList:list values:listValues |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5445 |
buttons:buttonLabels values:buttonValues |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5446 |
lines:maxLines |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5447 |
cancel:cancelBlock |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5448 |
multiple:false |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5449 |
postBuildBlock:postBuildBlock. |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5450 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5451 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5452 |
" |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5453 |
full example: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5454 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5455 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5456 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5457 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5458 |
fromList:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5459 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5460 |
buttons:#('five' 'six' 'seven') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5461 |
values:#(5 6 7) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5462 |
lines:10 |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5463 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5464 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5465 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5466 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5467 |
no buttons: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5468 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5469 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5470 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5471 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5472 |
fromList:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5473 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5474 |
buttons:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5475 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5476 |
lines:4 |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5477 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5478 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5479 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5480 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5481 |
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
|
5482 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5483 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5484 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5485 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5486 |
fromList:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5487 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5488 |
buttons:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5489 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5490 |
lines:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5491 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5492 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5493 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5494 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5495 |
full including cancel value: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5496 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5497 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5498 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5499 |
choose:'choose example' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5500 |
fromList:#('one' 'two' 'three' 'four') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5501 |
values:#(1 2 3 4) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5502 |
buttons:#('five' 'six' 'seven') |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5503 |
values:#(5 6 7) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5504 |
lines:4 |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5505 |
cancel:[Transcript flash. #aborted] |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5506 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5507 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5508 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5509 |
degenerated: |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5510 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5511 |
Transcript showCR:( |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5512 |
Dialog |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5513 |
choose:'choose any' |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5514 |
fromList:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5515 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5516 |
buttons:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5517 |
values:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5518 |
lines:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5519 |
cancel:nil |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5520 |
) |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5521 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5522 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5523 |
" |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5524 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5525 |
"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
|
5526 |
! |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5527 |
|
3340 | 5528 |
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
|
5529 |
"launch a Dialog showing the message and list. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5530 |
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
|
5531 |
from listValues is returned (doubleclick works as well). |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5532 |
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
|
5533 |
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
|
5534 |
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
|
5535 |
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
|
5536 |
If cancel is pressed, the value of cancelBlock is returned. |
4642 | 5537 |
Pressing ok without a selection returns nil or an empty collection (if multiple is true)." |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5538 |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5539 |
^ self |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5540 |
choose:aString |
3455 | 5541 |
fromList:list values:listValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5542 |
initialSelection:initialListSelectionOrNil |
3455 | 5543 |
buttons:buttonLabels values:buttonValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5544 |
default:defaultValue |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5545 |
lines:maxLines |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5546 |
cancel:cancelBlock |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5547 |
multiple:multiple |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5548 |
title:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5549 |
postBuildBlock:aBlockOrNil |
3455 | 5550 |
|
5551 |
"Modified: / 02-03-2007 / 12:07:57 / cg" |
|
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5552 |
! |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5553 |
|
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5554 |
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
|
5555 |
"launch a Dialog showing the message and list. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5556 |
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
|
5557 |
from listValues is returned (doubleclick works as well). |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5558 |
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
|
5559 |
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
|
5560 |
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
|
5561 |
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
|
5562 |
If cancel is pressed, the value of cancelBlock is returned. |
4642 | 5563 |
Pressing ok without a selection returns nil or an empty collection (if multiple is true)." |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5564 |
|
4329
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5565 |
^ self |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5566 |
choose:aString |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5567 |
fromList:list values:listValues |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5568 |
initialSelection:initialListSelectionOrNil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5569 |
buttons:buttonLabels values:buttonValues |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5570 |
default:defaultValue |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5571 |
lines:maxLines width:nil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5572 |
cancel:cancelBlock |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5573 |
multiple:multiple |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5574 |
title:windowTitle |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5575 |
postBuildBlock:aBlockOrNil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5576 |
|
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5577 |
" |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5578 |
full example: |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5579 |
|
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5580 |
Transcript showCR:( |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5581 |
Dialog |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5582 |
choose:'choose any' |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5583 |
fromList:#('one' 'two' 'three' 'four') values:#(1 2 3 4) |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5584 |
initialSelection: nil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5585 |
buttons:#('five' 'six' 'seven') values:#(5 6 7) |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5586 |
default:6 |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5587 |
lines:10 |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5588 |
cancel:nil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5589 |
multiple:true |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5590 |
postBuildBlock:nil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5591 |
) |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5592 |
|
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5593 |
|
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5594 |
no buttons: |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5595 |
|
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5596 |
Transcript showCR:( |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5597 |
Dialog |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5598 |
choose:'choose any' |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5599 |
fromList:#('one' 'two' 'three' 'four') |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5600 |
values:#(1 2 3 4) |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5601 |
buttons:nil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5602 |
values:nil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5603 |
lines:4 |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5604 |
cancel:nil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5605 |
multiple:true |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5606 |
) |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5607 |
" |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5608 |
|
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5609 |
"Created: / 22-08-2006 / 16:10:19 / cg" |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5610 |
! |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5611 |
|
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5612 |
choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues default:defaultValue lines:maxLines width:boxWidthOrNil cancel:cancelBlock multiple:multiple title:windowTitle postBuildBlock:aBlockOrNil |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5613 |
"launch a Dialog showing the message and list. |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5614 |
The user can select an item and click ok; in this case, the corresponding value |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5615 |
from listValues is returned (doubleclick works as well). |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5616 |
The list may be suppressed (if the list arg is nil). |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5617 |
If a list is present, multiple controls if multiple selections are allowed. |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5618 |
Below the list, an optional row of buttons is shown, which can also be |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5619 |
clicked upon, and a corresponding value from buttonValues is returned. |
4332
ca24b6bb63b5
comment/format in: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4331
diff
changeset
|
5620 |
The buttonValue may be a block of up to 3 arguments; it gets the selection, the box and selIndices as args. |
4329
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5621 |
If cancel is pressed, the value of cancelBlock is returned. |
4642 | 5622 |
Pressing ok without a selection returns nil or an empty collection (if multiple is true)." |
4329
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5623 |
|
3469 | 5624 |
|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
|
5625 |
|
4871 | 5626 |
haveDefault := false. |
5627 |
||
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
|
5628 |
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
|
5629 |
(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
|
5630 |
|
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
|
5631 |
list notNil ifTrue:[ |
4137
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5632 |
listView := HVScrollableView for:SelectionInListView. |
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5633 |
listView autoHideScrollBars:true. |
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5634 |
"/ maxLines <= list size ifTrue:[ |
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5635 |
"/ listView := HVScrollableView for:SelectionInListView. |
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5636 |
"/ ] ifFalse:[ |
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5637 |
"/ listView := SelectionInListView new. |
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5638 |
"/ listView level:-1. |
4b259f245421
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4132
diff
changeset
|
5639 |
"/ ]. |
2111 | 5640 |
listView list:list. |
2116 | 5641 |
listView doubleClickAction:[:selectionIndex | |
4530 | 5642 |
|val okButton| |
2111 | 5643 |
|
2116 | 5644 |
multiple ifTrue:[ |
5645 |
val := selectionIndex collect:[:idx | listValues at:idx]. |
|
5646 |
] ifFalse:[ |
|
5647 |
val := listValues at:selectionIndex. |
|
5648 |
]. |
|
4530 | 5649 |
(box okButton notNil and:[box okButton isReturnButton]) ifTrue:[ |
5650 |
box destroy. |
|
5651 |
] ifFalse:[ |
|
5652 |
okButton := box allSubViewsDetect:[:v | v isDefault] ifNone:nil. |
|
5653 |
okButton notNil ifTrue:[ |
|
5654 |
okButton controller performAction |
|
5655 |
] |
|
5656 |
]. |
|
2111 | 5657 |
^ val |
5658 |
]. |
|
5659 |
listView multipleSelectOk:multiple. |
|
4530 | 5660 |
|
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5661 |
initialListSelectionOrNil notNil ifTrue:[ |
3005 | 5662 |
multiple ifTrue:[ |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5663 |
listView selection:(initialListSelectionOrNil collect:[:each| listValues indexOf:each]) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5664 |
] ifFalse:[ |
3005 | 5665 |
listView selection:(listValues indexOf:initialListSelectionOrNil) |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5666 |
] |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
5667 |
]. |
2111 | 5668 |
box addComponent:listView indent:(ViewSpacing // 2) withHeight:(listView heightForLines:maxLines). |
5669 |
box makeTabable:listView. |
|
3340 | 5670 |
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
|
5671 |
]. |
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
|
5672 |
|
2112 | 5673 |
buttonLabels size > 0 ifTrue:[ |
2111 | 5674 |
panel := HorizontalPanelView new. |
5675 |
panel horizontalLayout:#fitSpace. |
|
5676 |
buttonLabels keysAndValuesDo:[:index :label | |
|
5677 |
|b| |
|
5678 |
||
5679 |
b := Button label:label. |
|
5680 |
b action:[ |
|
4387
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5681 |
|val selectionValues listSelection| |
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5682 |
|
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5683 |
listSelection := listView selection. |
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5684 |
listSelection notNil ifTrue:[ |
4871 | 5685 |
listSelection isCollection ifFalse:[ listSelection := Array with:listSelection ]. |
4387
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5686 |
selectionValues := listValues isNil |
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5687 |
ifTrue:[ listSelection ] |
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5688 |
ifFalse:[ listSelection collect:[:idx | listValues at:idx]]. |
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
5689 |
]. |
2111 | 5690 |
val := buttonValues at:index. |
4330
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5691 |
val isBlock ifTrue:[ |
4331
ee5133add66d
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4330
diff
changeset
|
5692 |
val := val valueWithOptionalArgument:selectionValues and:box and:listView selection |
4330
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5693 |
] ifFalse:[ |
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5694 |
multiple ifTrue:[ |
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5695 |
val := Array with:val |
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5696 |
]. |
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5697 |
]. |
2111 | 5698 |
box destroy. |
5699 |
^ val |
|
5700 |
]. |
|
3340 | 5701 |
haveDefault ifFalse:[ |
5702 |
defaultValue notNil ifTrue:[ |
|
5703 |
(buttonValues at:index) = defaultValue ifTrue:[ |
|
5704 |
b isReturnButton:true. |
|
5705 |
haveDefault := true. |
|
5706 |
]. |
|
5707 |
]. |
|
5708 |
]. |
|
2111 | 5709 |
panel add:b. |
5710 |
box makeTabable:b. |
|
5711 |
]. |
|
5712 |
box addComponent:panel indent:0. "/ panel has its own idea of indenting |
|
3340 | 5713 |
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
|
5714 |
]. |
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
|
5715 |
box addAbortButton. |
3340 | 5716 |
list notNil ifTrue:[ |
5717 |
haveDefault ifTrue:[ |
|
5718 |
(box addOkButton) isReturnButton:false. |
|
5719 |
] ifFalse:[ |
|
5720 |
box addOkButton. |
|
5721 |
]. |
|
5722 |
]. |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5723 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
5724 |
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
|
5725 |
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
|
5726 |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5727 |
aBlockOrNil notNil ifTrue:[ |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5728 |
aBlockOrNil value:box |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5729 |
]. |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5730 |
windowTitle notNil ifTrue:[ |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5731 |
box label:windowTitle. |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5732 |
]. |
4329
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5733 |
boxWidthOrNil notNil ifTrue:[ |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5734 |
box width:(boxWidthOrNil max:250). |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5735 |
] ifFalse:[ |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5736 |
box width < 250 ifTrue:[ |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5737 |
box width:250. |
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5738 |
] |
4104
279210ad5459
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4093
diff
changeset
|
5739 |
]. |
4058
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
5740 |
|
2439 | 5741 |
self showBox:box. |
4530 | 5742 |
|
4330
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5743 |
"/ notice: if one of the extra buttons is pressed, we do not arrive here, and the returned value |
9207417a6965
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4329
diff
changeset
|
5744 |
"/ is the value returned by the button-value (which might be a block) |
2111 | 5745 |
|
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
|
5746 |
box accepted ifTrue:[ |
2111 | 5747 |
(sel := listView selection) notNil ifTrue:[ |
5748 |
box destroy. |
|
5749 |
sel isInteger ifTrue:[ |
|
5750 |
^ listValues at:sel |
|
3340 | 5751 |
]. |
5752 |
^ sel collect:[:idx | listValues at:idx] |
|
5753 |
]. |
|
5754 |
box destroy. |
|
4642 | 5755 |
^ multiple ifTrue:[ #() ] ifFalse:[ 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
|
5756 |
]. |
2111 | 5757 |
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
|
5758 |
^ cancelBlock value |
197 | 5759 |
|
5760 |
" |
|
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
|
5761 |
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
|
5762 |
|
2111 | 5763 |
Transcript showCR:( |
5764 |
Dialog |
|
5765 |
choose:'choose any' |
|
3340 | 5766 |
fromList:#('one' 'two' 'three' 'four') values:#(1 2 3 4) |
5767 |
initialSelection: nil |
|
5768 |
buttons:#('five' 'six' 'seven') values:#(5 6 7) |
|
5769 |
default:6 |
|
2111 | 5770 |
lines:10 |
5771 |
cancel:nil |
|
5772 |
multiple:true |
|
3340 | 5773 |
postBuildBlock:nil |
2111 | 5774 |
) |
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
|
5775 |
|
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
|
5776 |
|
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
|
5777 |
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
|
5778 |
|
2111 | 5779 |
Transcript showCR:( |
5780 |
Dialog |
|
5781 |
choose:'choose any' |
|
5782 |
fromList:#('one' 'two' 'three' 'four') |
|
5783 |
values:#(1 2 3 4) |
|
5784 |
buttons:nil |
|
5785 |
values:nil |
|
5786 |
lines:4 |
|
5787 |
cancel:nil |
|
5788 |
multiple:true |
|
5789 |
) |
|
133 | 5790 |
" |
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
|
5791 |
|
4329
242be44c97ef
added: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4307
diff
changeset
|
5792 |
"Created: / 08-11-2011 / 12:15:20 / cg" |
3340 | 5793 |
! |
5794 |
||
5795 |
choose:aString fromList:list values:listValues initialSelection:initialListSelectionOrNil buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock multiple:multiple postBuildBlock:aBlockOrNil |
|
5796 |
"launch a Dialog showing the message and list. |
|
5797 |
The user can select an item and click ok; in this case, the corresponding value |
|
5798 |
from listValues is returned (doubleclick works as well). |
|
5799 |
The list may be suppressed (if the list arg is nil). |
|
5800 |
If a list is present, multiple controls if multiple selections are allowed. |
|
5801 |
Below the list, an optional row of buttons is shown, which can also be |
|
5802 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
5803 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4642 | 5804 |
Pressing ok without a selection returns nil or an empty collection (if multiple is true)." |
3340 | 5805 |
|
5806 |
^ self |
|
5807 |
choose:aString |
|
3455 | 5808 |
fromList:list values:listValues |
3340 | 5809 |
initialSelection:initialListSelectionOrNil |
3455 | 5810 |
buttons:buttonLabels values:buttonValues |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5811 |
default:nil |
3340 | 5812 |
lines:maxLines |
3393
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5813 |
cancel:cancelBlock |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5814 |
multiple:multiple |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5815 |
title:nil |
280482ccaab8
choose... got a title argument.
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5816 |
postBuildBlock:aBlockOrNil |
3340 | 5817 |
|
3455 | 5818 |
"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
|
5819 |
! |
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
|
5820 |
|
4581 | 5821 |
choose:aString fromList:list values:listValues lines:maxLines |
5822 |
"launch a Dialog showing the message and list. |
|
5823 |
The user can select an item and click ok; in this case, the corresponding value |
|
5824 |
from listValues is returned (doubleclick works as well). |
|
5825 |
If cancel is pressed, the value of cancelBlock is returned. |
|
5826 |
Pressing ok without a selection is treated like cancel." |
|
5827 |
||
5828 |
^ self |
|
5829 |
choose:aString |
|
5830 |
fromList:(list collect:[:each| each printString]) values:listValues |
|
5831 |
initialSelection:nil |
|
5832 |
buttons:nil values:nil |
|
5833 |
default:nil |
|
5834 |
lines:maxLines |
|
5835 |
cancel:nil |
|
5836 |
multiple:false |
|
5837 |
title:nil |
|
5838 |
postBuildBlock:nil |
|
5839 |
||
5840 |
" |
|
5841 |
Transcript showCR:( |
|
5842 |
Dialog |
|
5843 |
choose:'choose any' |
|
5844 |
fromList:#('one' 'two' 'three') |
|
5845 |
values:#(1 2 3) |
|
5846 |
lines:4 |
|
5847 |
) |
|
5848 |
" |
|
5849 |
||
5850 |
"Modified: / 02-03-2007 / 12:08:31 / cg" |
|
5851 |
! |
|
5852 |
||
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
|
5853 |
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
|
5854 |
"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
|
5855 |
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
|
5856 |
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
|
5857 |
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
|
5858 |
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
|
5859 |
|
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
|
5860 |
^ self |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5861 |
choose:aString |
3455 | 5862 |
fromList:list values:listValues |
5863 |
buttons:nil values:nil |
|
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5864 |
lines:maxLines |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5865 |
cancel:cancelBlock |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5866 |
multiple:false |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5867 |
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
|
5868 |
|
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
|
5869 |
" |
655 | 5870 |
Transcript showCR:( |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5871 |
Dialog |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5872 |
choose:'choose any' |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5873 |
fromList:#('one' 'two' 'three' 'four') |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5874 |
values:#(1 2 3 4) |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5875 |
lines:4 |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5876 |
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
|
5877 |
) |
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
|
5878 |
|
655 | 5879 |
Transcript showCR:( |
2183
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5880 |
Dialog |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5881 |
choose:'choose example' |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5882 |
fromList:#('one' 'two' 'three' 'four') |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5883 |
values:#(1 2 3 4) |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5884 |
lines:4 |
209de080ee24
postBuild callBack added to choose:fromList:...
Claus Gittinger <cg@exept.de>
parents:
2147
diff
changeset
|
5885 |
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
|
5886 |
) |
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
|
5887 |
" |
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
|
5888 |
|
3455 | 5889 |
"Modified: / 02-03-2007 / 12:07:42 / cg" |
5890 |
! |
|
5891 |
||
3630 | 5892 |
choose:aString fromList:list values:values lines:maxLines cancel:cancelBlock title:windowTitle |
5893 |
"launch a Dialog showing the message and list. |
|
5894 |
The user can select an item and click ok; in this case, the corresponding value |
|
5895 |
from listValues is returned (doubleclick works as well). |
|
5896 |
If cancel is pressed, the value of cancelBlock is returned. |
|
5897 |
Pressing ok without a selection is treated like cancel." |
|
5898 |
||
5899 |
^ self |
|
5900 |
choose:aString |
|
5901 |
fromList:list values:values |
|
5902 |
initialSelection:nil |
|
5903 |
buttons:nil values:nil |
|
5904 |
default:nil |
|
5905 |
lines:maxLines |
|
5906 |
cancel:cancelBlock |
|
5907 |
multiple:false |
|
5908 |
title:windowTitle |
|
5909 |
postBuildBlock:nil |
|
5910 |
||
5911 |
" |
|
5912 |
Transcript showCR:( |
|
5913 |
Dialog |
|
5914 |
choose:'choose any' |
|
5915 |
fromList:#(1 2 3 4 5 6 7) |
|
5916 |
lines:4 |
|
5917 |
title:'Choose' |
|
5918 |
) |
|
5919 |
" |
|
5920 |
||
5921 |
"Created: / 02-03-2007 / 12:07:32 / cg" |
|
5922 |
! |
|
5923 |
||
3455 | 5924 |
choose:aString fromList:list values:values lines:maxLines initialSelection:initialSelection title:windowTitle |
5925 |
"launch a Dialog showing the message and list. |
|
5926 |
The user can select an item and click ok; in this case, the corresponding value |
|
5927 |
from listValues is returned (doubleclick works as well). |
|
5928 |
If cancel is pressed, the value of cancelBlock is returned. |
|
5929 |
Pressing ok without a selection is treated like cancel." |
|
5930 |
||
5931 |
^ self |
|
5932 |
choose:aString |
|
5933 |
fromList:list values:values |
|
5934 |
initialSelection:initialSelection |
|
5935 |
buttons:nil values:nil |
|
5936 |
default:nil |
|
5937 |
lines:maxLines |
|
5938 |
cancel:nil |
|
5939 |
multiple:false |
|
5940 |
title:windowTitle |
|
5941 |
postBuildBlock:nil |
|
5942 |
||
5943 |
" |
|
5944 |
Transcript showCR:( |
|
5945 |
Dialog |
|
5946 |
choose:'choose any' |
|
5947 |
fromList:#(1 2 3 4 5 6 7) |
|
5948 |
lines:4 |
|
5949 |
title:'Choose' |
|
5950 |
) |
|
5951 |
" |
|
5952 |
||
5953 |
"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
|
5954 |
! |
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
|
5955 |
|
3630 | 5956 |
choose:aString fromList:list values:values lines:maxLines title:windowTitle |
5957 |
"launch a Dialog showing the message and list. |
|
5958 |
The user can select an item and click ok; in this case, the corresponding value |
|
5959 |
from listValues is returned (doubleclick works as well). |
|
5960 |
If cancel is pressed, the value of cancelBlock is returned. |
|
5961 |
Pressing ok without a selection is treated like cancel." |
|
5962 |
||
5963 |
^ self |
|
5964 |
choose:aString |
|
5965 |
fromList:list values:values |
|
5966 |
initialSelection:nil |
|
5967 |
buttons:nil values:nil |
|
5968 |
default:nil |
|
5969 |
lines:maxLines |
|
5970 |
cancel:nil |
|
5971 |
multiple:false |
|
5972 |
title:windowTitle |
|
5973 |
postBuildBlock:nil |
|
5974 |
||
5975 |
" |
|
5976 |
Transcript showCR:( |
|
5977 |
Dialog |
|
5978 |
choose:'choose any' |
|
5979 |
fromList:#(1 2 3 4 5 6 7) |
|
5980 |
lines:4 |
|
5981 |
title:'Choose' |
|
5982 |
) |
|
5983 |
" |
|
5984 |
||
5985 |
"Created: / 02-03-2007 / 12:07:32 / cg" |
|
5986 |
! |
|
5987 |
||
2473 | 5988 |
choose:aString label:windowLabel image:imageOrNil labels:buttonLabels values:values default:default onCancel:cancelValue |
2472 | 5989 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
5990 |
Returning a corresponding value from the values-array. |
|
5991 |
The default entries button is marked as a return button and entering |
|
5992 |
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
|
5993 |
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
|
5994 |
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
|
5995 |
|
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
|
5996 |
|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
|
5997 |
|
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
|
5998 |
box := OptionBox title:aString numberOfOptions:buttonLabels size. |
803 | 5999 |
windowLabel notNil ifTrue:[ |
2439 | 6000 |
box label:windowLabel |
803 | 6001 |
]. |
2473 | 6002 |
imageOrNil notNil ifTrue:[ |
6003 |
box image:imageOrNil |
|
6004 |
]. |
|
6005 |
||
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
|
6006 |
box buttonTitles:(self classResources array:buttonLabels) |
2439 | 6007 |
actions:(values collect:[:val | [answer := val]]). |
2472 | 6008 |
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
|
6009 |
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
|
6010 |
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
|
6011 |
idx ~~ 0 ifTrue:[box defaultButtonIndex:idx]. |
2439 | 6012 |
|
6013 |
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
|
6014 |
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
|
6015 |
^ 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
|
6016 |
|
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
|
6017 |
"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
|
6018 |
|
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
|
6019 |
Dialog |
2439 | 6020 |
choose:'choose any' |
2472 | 6021 |
label:'Foo Bar Baz' |
2439 | 6022 |
labels:#('one' 'two' 'three' 'four') |
6023 |
values:#(1 2 3 4) |
|
2472 | 6024 |
default:2 |
6025 |
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
|
6026 |
|
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
|
6027 |
Dialog |
2439 | 6028 |
choose:'choose any' |
6029 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
6030 |
values:#(nil foo bar baz) |
|
6031 |
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
|
6032 |
|
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
|
6033 |
Dialog |
2439 | 6034 |
choose:'choose any' |
6035 |
labels:#('one' 'two' 'three' 'four') |
|
6036 |
values:#(1 2 3 4) |
|
6037 |
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
|
6038 |
" |
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
|
6039 |
|
2473 | 6040 |
"Modified: / 16.11.2001 / 14:55:33 / cg" |
6041 |
"Created: / 16.11.2001 / 15:04:16 / cg" |
|
6042 |
! |
|
6043 |
||
6044 |
choose:aString label:windowLabel labels:buttonLabels values:values default:default |
|
6045 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
6046 |
Returning a corresponding value from the values-array. |
|
6047 |
The default entries button is marked as a return button and entering |
|
6048 |
return will choose that value; hitting escape returns nil. |
|
6049 |
For a good userInterface style, we recommend this being the last |
|
6050 |
entry (to make the right-most button the default button)." |
|
6051 |
||
6052 |
^ self |
|
6053 |
choose:aString |
|
3455 | 6054 |
label:windowLabel image:nil |
6055 |
labels:buttonLabels values:values |
|
2473 | 6056 |
default:default |
6057 |
onCancel:nil |
|
6058 |
||
6059 |
"no good style (default button is not the rightmost one) |
|
6060 |
||
6061 |
Dialog |
|
6062 |
choose:'choose any' |
|
6063 |
labels:#('one' 'two' 'three' 'four') |
|
6064 |
values:#(1 2 3 4) |
|
6065 |
default:2 |
|
6066 |
||
6067 |
Dialog |
|
6068 |
choose:'choose any' |
|
6069 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
6070 |
values:#(nil foo bar baz) |
|
6071 |
default:#baz |
|
6072 |
||
6073 |
Dialog |
|
6074 |
choose:'choose any' |
|
6075 |
labels:#('one' 'two' 'three' 'four') |
|
6076 |
values:#(1 2 3 4) |
|
6077 |
default:nil |
|
6078 |
" |
|
6079 |
||
3455 | 6080 |
"Created: / 22-07-1996 / 11:44:27 / cg" |
6081 |
"Modified: / 02-03-2007 / 12:09:01 / cg" |
|
2473 | 6082 |
! |
6083 |
||
6084 |
choose:aString label:windowLabel labels:buttonLabels values:values default:default onCancel:cancelValue |
|
6085 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
6086 |
Returning a corresponding value from the values-array. |
|
6087 |
The default entries button is marked as a return button and entering |
|
6088 |
return will choose that value; hitting escape returns cancelValue. |
|
6089 |
For a good userInterface style, we recommend this being the last |
|
6090 |
entry (to make the right-most button the default button)." |
|
6091 |
||
6092 |
^ self |
|
3455 | 6093 |
choose:aString |
6094 |
label:windowLabel image:nil |
|
2473 | 6095 |
labels:buttonLabels values:values |
6096 |
default:default onCancel:cancelValue |
|
6097 |
||
6098 |
"no good style (default button is not the rightmost one) |
|
6099 |
||
6100 |
Dialog |
|
6101 |
choose:'choose any' |
|
6102 |
label:'Foo Bar Baz' |
|
6103 |
labels:#('one' 'two' 'three' 'four') |
|
6104 |
values:#(1 2 3 4) |
|
6105 |
default:2 |
|
6106 |
onCancel:1 |
|
6107 |
||
6108 |
Dialog |
|
6109 |
choose:'choose any' |
|
6110 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
6111 |
values:#(nil foo bar baz) |
|
6112 |
default:#baz |
|
6113 |
||
6114 |
Dialog |
|
6115 |
choose:'choose any' |
|
6116 |
labels:#('one' 'two' 'three' 'four') |
|
6117 |
values:#(1 2 3 4) |
|
6118 |
default:nil |
|
6119 |
" |
|
6120 |
||
3455 | 6121 |
"Created: / 16-11-2001 / 14:53:55 / cg" |
6122 |
"Modified: / 02-03-2007 / 12:08:44 / cg" |
|
803 | 6123 |
! |
6124 |
||
6125 |
choose:aString labels:buttonLabels values:values default:default |
|
6126 |
"launch a Dialog, which allows user to enter any of buttonLabels. |
|
6127 |
Returning a corresponding value from the values-array. |
|
6128 |
The default entries button is marked as a return button and entering |
|
6129 |
return will choose that value. |
|
6130 |
For a good userInterface style, we recommend this being the last |
|
6131 |
entry (to make the right-most button the default button)." |
|
6132 |
||
6133 |
^ self |
|
2473 | 6134 |
choose:aString |
3455 | 6135 |
label:nil image:nil |
6136 |
labels:buttonLabels values:values |
|
2473 | 6137 |
default:default |
6138 |
onCancel:nil |
|
803 | 6139 |
|
6140 |
||
6141 |
"no good style (default button is not the rightmost one) |
|
6142 |
||
6143 |
Dialog |
|
2473 | 6144 |
choose:'choose any' |
6145 |
labels:#('one' 'two' 'three' 'four') |
|
6146 |
values:#(1 2 3 4) |
|
6147 |
default:2 |
|
803 | 6148 |
|
6149 |
Dialog |
|
2473 | 6150 |
choose:'choose any' |
6151 |
labels:#('cancel' 'foo' 'bar' 'baz') |
|
6152 |
values:#(nil foo bar baz) |
|
6153 |
default:#baz |
|
803 | 6154 |
|
6155 |
Dialog |
|
2473 | 6156 |
choose:'choose any' |
6157 |
labels:#('one' 'two' 'three' 'four') |
|
6158 |
values:#(1 2 3 4) |
|
6159 |
default:nil |
|
6160 |
" |
|
6161 |
||
3455 | 6162 |
"Modified: / 02-03-2007 / 12:08:55 / cg" |
2111 | 6163 |
! |
6164 |
||
4642 | 6165 |
chooseMultiple:aString fromList:list lines:maxLines |
6166 |
"launch a Dialog showing the message and list. |
|
6167 |
The user can select any combination of items and click ok; |
|
6168 |
in this case, the values from list is returned (doubleclick works as well). |
|
6169 |
If cancel is pressed, the value of cancelBlock is returned. |
|
6170 |
Pressing ok without a selection returns an empty collection." |
|
6171 |
||
6172 |
^ self |
|
6173 |
choose:aString |
|
6174 |
fromList:(list collect:[:each| each printString]) values:list |
|
6175 |
initialSelection:nil |
|
6176 |
buttons:nil values:nil |
|
6177 |
default:#() |
|
6178 |
lines:maxLines |
|
6179 |
cancel:nil |
|
6180 |
multiple:true |
|
6181 |
title:nil |
|
6182 |
postBuildBlock:nil |
|
6183 |
||
6184 |
" |
|
6185 |
Transcript showCR:( |
|
6186 |
Dialog |
|
6187 |
chooseMultiple:'choose any combination' |
|
6188 |
fromList:#(1 2 3 4 5 6 7) |
|
6189 |
lines:4 |
|
6190 |
) |
|
6191 |
" |
|
6192 |
||
6193 |
"Modified: / 02-03-2007 / 12:08:31 / cg" |
|
6194 |
! |
|
6195 |
||
2111 | 6196 |
chooseMultiple:aString fromList:list values:listValues buttons:buttonLabels values:buttonValues lines:maxLines cancel:cancelBlock |
6197 |
"launch a Dialog showing the message and list. |
|
6198 |
The user can select an item and click ok; in this case, the corresponding value |
|
6199 |
from listValues is returned (doubleclick works as well). |
|
6200 |
The list may be suppressed (if the list arg is nil). |
|
6201 |
Below the list, an optional row of buttons is shown, which can also be |
|
6202 |
clicked upon, and a corresponding value from buttonValues is returned. |
|
6203 |
If cancel is pressed, the value of cancelBlock is returned. |
|
4642 | 6204 |
Pressing ok without a selection returns an empty collection." |
2111 | 6205 |
|
6206 |
^ self |
|
6207 |
choose:aString |
|
3455 | 6208 |
fromList:list values:listValues |
6209 |
buttons:buttonLabels values:buttonValues |
|
2111 | 6210 |
lines:maxLines |
6211 |
cancel:cancelBlock |
|
6212 |
multiple:true |
|
6213 |
||
6214 |
" |
|
6215 |
full example: |
|
6216 |
||
6217 |
Transcript showCR:( |
|
6218 |
Dialog |
|
2112 | 6219 |
chooseMultiple:'choose selected' |
2111 | 6220 |
fromList:#('one' 'two' 'three' 'four') |
6221 |
values:#(1 2 3 4) |
|
6222 |
buttons:nil |
|
6223 |
values:nil |
|
6224 |
lines:10 |
|
6225 |
cancel:nil |
|
6226 |
) |
|
2112 | 6227 |
|
6228 |
Transcript showCR:( |
|
6229 |
Dialog |
|
6230 |
chooseMultiple:'choose selected' |
|
6231 |
fromList:#('one' 'two' 'three' 'four') |
|
6232 |
values:#(1 2 3 4) |
|
6233 |
buttons:#() |
|
6234 |
values:#() |
|
6235 |
lines:10 |
|
6236 |
cancel:nil |
|
6237 |
) |
|
2111 | 6238 |
" |
6239 |
||
3455 | 6240 |
"Modified: / 02-03-2007 / 12:09:10 / cg" |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6241 |
! |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6242 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6243 |
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
|
6244 |
"launch a Dialog showing the message and list. |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6245 |
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
|
6246 |
from listValues is returned (doubleclick works as well). |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6247 |
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
|
6248 |
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
|
6249 |
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
|
6250 |
If cancel is pressed, the value of cancelBlock is returned. |
4642 | 6251 |
Pressing ok without a selection returns an empty collection." |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6252 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6253 |
^ self |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6254 |
choose:aString |
3455 | 6255 |
fromList:list values:listValues |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6256 |
initialSelection:initialListSelectionOrNil |
3455 | 6257 |
buttons:nil values:nil |
2222
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6258 |
lines:maxLines |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6259 |
cancel:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6260 |
multiple:true |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6261 |
postBuildBlock:nil |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6262 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6263 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6264 |
full example: |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6265 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6266 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6267 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6268 |
chooseMultiple:'choose selected' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6269 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6270 |
values:#(1 2 3 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6271 |
initialSelection:#(2 4) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6272 |
lines:10 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6273 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6274 |
|
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6275 |
Transcript showCR:( |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6276 |
Dialog |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6277 |
chooseMultiple:'choose selected' |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6278 |
fromList:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6279 |
values:#('one' 'two' 'three' 'four') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6280 |
initialSelection:#( 'two' 'three') |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6281 |
lines:10 |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6282 |
) |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6283 |
" |
c3fb44421dda
list selectBox with initial selection
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
6284 |
|
3455 | 6285 |
"Created: / 18-08-2000 / 22:38:13 / cg" |
6286 |
"Modified: / 02-03-2007 / 12:09:15 / cg" |
|
100 | 6287 |
! ! |
6288 |
||
5289 | 6289 |
!DialogBox class methodsFor:'on the fly modifications'! |
6290 |
||
6291 |
modifyingBoxWith:modifyBlock do:openingBlock |
|
6292 |
"perform openingBlock (which usually creates a standard dialog box), |
|
6293 |
but call modifyBlock right before the dialog is actually opened. |
|
6294 |
This allows modifyBlock to add additional controls to the dialog. |
|
6295 |
ModifyBlock is called with the box as argument." |
|
6296 |
||
6297 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | |
|
6298 |
|box| |
|
6299 |
||
6300 |
box := ex box. |
|
6301 |
modifyBlock value:box. |
|
6302 |
ex proceed. |
|
6303 |
] do:openingBlock. |
|
6304 |
||
6305 |
" |
|
6306 |
Dialog |
|
6307 |
modifyingBoxWith:[:box | |
|
6308 |
box allViewBackground:Color red. |
|
6309 |
] do:[ |
|
6310 |
Dialog information:'hello' |
|
6311 |
]. |
|
6312 |
" |
|
6313 |
! |
|
6314 |
||
5968 | 6315 |
withOptoutOption:optOutAction1 labelled:labelString1 |
6316 |
andOptoutOption:optOutAction2 labelled:labelString2 |
|
6317 |
do:boxOpeningBlock |
|
6318 |
||
6319 |
"launch a Dialog to warn user. |
|
6320 |
Add two 'do not show this dialog again'-like checkboxes, |
|
6321 |
and call optOutActionX after the dialog, if the checkbox was indeed checked." |
|
6322 |
||
6323 |
|optOutHolder1 optOutHolder2| |
|
6324 |
||
6325 |
optOutHolder1 := false asValue. |
|
6326 |
optOutHolder2 := false asValue. |
|
5975 | 6327 |
[ |
6036 | 6328 |
self |
6329 |
modifyingBoxWith:[:box | |
|
6330 |
box verticalPanel |
|
6331 |
add:((CheckBox label:labelString1) model:optOutHolder1); |
|
6332 |
add:((CheckBox label:labelString2) model:optOutHolder2). |
|
6333 |
] |
|
6334 |
do:boxOpeningBlock |
|
5975 | 6335 |
] ensure:[ |
6336 |
optOutHolder1 value ifTrue:[ optOutAction1 value ]. |
|
6337 |
optOutHolder2 value ifTrue:[ optOutAction2 value ]. |
|
6338 |
]. |
|
5968 | 6339 |
|
6340 |
" |
|
6341 |
Dialog |
|
6342 |
withOptoutOption:[Transcript flash] labelled:'opt out1' |
|
6343 |
andOptoutOption:[Transcript show:'wow'] labelled:'opt out2' |
|
6344 |
do:[ Dialog confirm:'some question' ]. |
|
6345 |
" |
|
6346 |
||
6347 |
"Created: / 18-11-2016 / 11:26:06 / cg" |
|
5975 | 6348 |
"Modified: / 22-11-2016 / 04:21:10 / cg" |
5968 | 6349 |
! |
6350 |
||
5289 | 6351 |
withOptoutOption:optOutAction labelled:labelString do:boxOpeningBlock |
6352 |
"launch a Dialog to warn user. |
|
6353 |
Add a 'do not show this dialog again'-like checkbox, |
|
6354 |
and call optOutAction after the dialog, if the checkbox was indeed checked." |
|
6355 |
||
6356 |
|holder| |
|
6357 |
||
6358 |
holder := false asValue. |
|
5975 | 6359 |
[ |
6036 | 6360 |
self |
6361 |
modifyingBoxWith:[:box | |
|
6362 |
box verticalPanel add:((CheckBox label:labelString) model:holder). |
|
6363 |
] |
|
6364 |
do:boxOpeningBlock. |
|
5975 | 6365 |
] ensure:[ |
6366 |
holder value ifTrue:[optOutAction value] |
|
6367 |
] |
|
5289 | 6368 |
|
6369 |
" |
|
6370 |
Dialog |
|
6371 |
withOptoutOption:[Transcript flash] |
|
6372 |
labelled:'opt out' |
|
6373 |
do:[ Dialog confirm:'some question' ]. |
|
6374 |
" |
|
5974 | 6375 |
|
5975 | 6376 |
"Modified: / 22-11-2016 / 04:20:38 / cg" |
5289 | 6377 |
! |
6378 |
||
6379 |
withOptoutOption:optOutAction labelled:labelString warn:warnString |
|
6380 |
"launch a Dialog to warn user. |
|
6381 |
Add a 'do not show this dialog again'-like checkbox, |
|
6382 |
and call optOutAction after the warning, if the checkbox was indeed checked." |
|
6383 |
||
6384 |
self |
|
6385 |
withOptoutOption:optOutAction |
|
6386 |
labelled:labelString |
|
6387 |
do:[self warn:warnString] |
|
6388 |
||
6389 |
" |
|
5940 | 6390 |
Dialog |
6391 |
withOptoutOption:[Transcript flash] |
|
6392 |
labelled:'opt out' |
|
6393 |
warn:'some warning'. |
|
5289 | 6394 |
" |
6395 |
! ! |
|
6396 |
||
2439 | 6397 |
!DialogBox class methodsFor:'private'! |
6398 |
||
6399 |
showAndThenDestroyBox:aBox |
|
4502 | 6400 |
[ |
6401 |
self showBox:aBox. |
|
6402 |
] ensure:[ |
|
6403 |
aBox destroy |
|
6404 |
] |
|
2439 | 6405 |
! |
6406 |
||
6407 |
showBox:aBox |
|
2666
4e5cf41990d6
show (some dialogs) centered
Claus Gittinger <cg@exept.de>
parents:
2640
diff
changeset
|
6408 |
|wg v| |
4e5cf41990d6
show (some dialogs) centered
Claus Gittinger <cg@exept.de>
parents:
2640
diff
changeset
|
6409 |
|
2439 | 6410 |
ForceModalBoxesToOpenAtCenter == true ifTrue:[ |
6411 |
aBox showAtCenter. |
|
3888 | 6412 |
^ self. |
6413 |
]. |
|
6414 |
ForceModalBoxesToOpenAtPointer == true ifTrue:[ |
|
6415 |
aBox showAtPointer. |
|
6416 |
^ self. |
|
6417 |
]. |
|
6418 |
||
6419 |
wg := WindowGroup activeGroup. |
|
6420 |
wg isNil ifTrue:[ |
|
6421 |
aBox showAtCenter. |
|
6422 |
^ self. |
|
6423 |
]. |
|
4690 | 6424 |
wg isDebugged ifTrue:[ |
6425 |
aBox showAtPointer. |
|
6426 |
^ self. |
|
6427 |
]. |
|
6428 |
||
3888 | 6429 |
wg isModal ifTrue:[ |
6430 |
v := wg mainView. |
|
6431 |
v notNil ifTrue:[ |
|
6432 |
aBox showCenteredIn:v. |
|
6433 |
^ self. |
|
6434 |
]. |
|
6435 |
]. |
|
6436 |
||
6437 |
v := wg mainGroup mainView. |
|
6438 |
v isNil ifTrue:[ |
|
6439 |
aBox showAtCenter. |
|
6440 |
^ self. |
|
6441 |
]. |
|
6442 |
||
6443 |
aBox showCenteredIn:v. |
|
4690 | 6444 |
|
6445 |
"Modified: / 29-08-2013 / 16:39:29 / cg" |
|
2439 | 6446 |
! ! |
6447 |
||
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6448 |
!DialogBox class methodsFor:'queries'! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6449 |
|
2197
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
6450 |
defaultOKButtonAtLeft |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
6451 |
"somewhat of a kludge: |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
6452 |
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
|
6453 |
|
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
6454 |
^ (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
|
6455 |
|
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
6456 |
" |
2694 | 6457 |
DialogBox defaultOKButtonAtLeft |
6458 |
" |
|
2197
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
6459 |
! |
5b3dd41c21ac
added query if ok button should be at left
Claus Gittinger <cg@exept.de>
parents:
2183
diff
changeset
|
6460 |
|
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6461 |
defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6462 |
"return a default parent (top-) window for the dialog. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6463 |
Here, the currently active view is returned, if there |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6464 |
is one; otherwise, the first encountered topView is |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6465 |
returned." |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6466 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6467 |
|activeGroup| |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6468 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6469 |
activeGroup := WindowGroup activeGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6470 |
activeGroup isNil ifTrue:[ |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6471 |
"/ mhmh - looks like I am a background process ... |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6472 |
activeGroup := Transcript windowGroup. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6473 |
activeGroup isNil ifTrue:[^ nil]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6474 |
]. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6475 |
^ activeGroup topViews first. |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6476 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6477 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6478 |
self defaultParentWindow |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6479 |
" |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6480 |
|
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6481 |
"Modified: / 16.6.1998 / 12:36:15 / cg" |
5619 | 6482 |
! |
6483 |
||
6484 |
patternForFilters:filtersOrNil |
|
6485 |
"argument #filtersOrNil is window specific, |
|
6486 |
it is an array of arrays with filter (*.zip) and its description (ZIP compressed archive file) |
|
6487 |
to support a call with just #filtersOrNil and no #patternOrNil the pattern will be extracted from the #filtersOrNil for linux |
|
6488 |
||
6489 |
which is done here" |
|
6490 |
||
6491 |
filtersOrNil isEmptyOrNil ifTrue:[ |
|
6492 |
^ nil |
|
6493 |
]. |
|
6494 |
||
6495 |
^ (filtersOrNil |
|
6496 |
collect:[:each | each last]) |
|
6497 |
asStringWith:'; ' |
|
1573
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6498 |
! ! |
63a7b74f45be
added #defaultParentWindow for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
1488
diff
changeset
|
6499 |
|
6028 | 6500 |
!DialogBox class methodsFor:'smalltalk dialogs'! |
6027 | 6501 |
|
6502 |
imageSaveDialog:title image:image default:defaultFileName pattern:pattern |
|
6503 |
"a complete bitmap image save dialog. |
|
6504 |
Offers edit and save as button options. |
|
6505 |
Returns the fileName if saved, nil if not" |
|
6506 |
||
6507 |
|fileName| |
|
6508 |
||
6509 |
fileName := self |
|
6510 |
requestFileNameForImageSave:title |
|
6511 |
image:image |
|
6512 |
default:defaultFileName |
|
6513 |
pattern:pattern. |
|
6514 |
||
6515 |
fileName isEmptyOrNil ifTrue:[^ nil]. |
|
6516 |
||
6517 |
image saveOn:fileName. |
|
6518 |
ImageEditView notNil ifTrue:[ |
|
6519 |
ImageEditView lastSaveDirectory:(fileName asFilename directory pathName). |
|
6520 |
]. |
|
6521 |
^ fileName |
|
6522 |
||
6523 |
" |
|
6524 |
Dialog |
|
6525 |
imageSaveDialog:'save screen image' |
|
6526 |
image:(Image fromScreen:(0@0 corner:100@100)) |
|
6527 |
default:'screen.png' |
|
6528 |
pattern:'*.png;*.gif;*.bmp' |
|
6529 |
" |
|
6028 | 6530 |
! |
2486 | 6531 |
|
3276 | 6532 |
requestClass:aString |
6533 |
"launch a Dialog, which allows user to enter an existing classes name. |
|
6534 |
Return the entered class or nil (if cancel was pressed). |
|
6535 |
The entryField does classNameCompletion on TAB." |
|
6536 |
||
6537 |
^ self requestClass:aString okLabel:'OK' initialAnswer:nil. |
|
6538 |
||
6539 |
" |
|
6540 |
Dialog |
|
6541 |
requestClass:'Enter a class:' |
|
6542 |
" |
|
6543 |
! |
|
6544 |
||
3282 | 6545 |
requestClass:aString initialAnswer:initialAnswer |
6546 |
"launch a Dialog, which allows user to enter an existing classes name. |
|
6547 |
Return the entered class or nil (if cancel was pressed). |
|
6548 |
The entryField does classNameCompletion on TAB." |
|
6549 |
||
6550 |
^ self requestClass:aString okLabel:'OK' initialAnswer:initialAnswer. |
|
6551 |
||
6552 |
" |
|
6553 |
Dialog |
|
6554 |
requestClass:'Enter a class:' |
|
6555 |
initialAnswer:'Array' |
|
6556 |
" |
|
6557 |
! |
|
6558 |
||
3532 | 6559 |
requestClass:aString list:list okLabel:okLabel initialAnswer:initial |
3276 | 6560 |
"launch a Dialog, which allows user to enter an existing classes name. |
6561 |
Return the entered class or nil (if cancel was pressed). |
|
3181 | 6562 |
The entryField does classNameCompletion on TAB." |
6563 |
||
6564 |
|className| |
|
6565 |
||
3532 | 6566 |
className := self requestClassName:aString list:list okLabel:okLabel initialAnswer:initial. |
3276 | 6567 |
className isEmptyOrNil ifTrue:[^ nil]. |
3181 | 6568 |
^ Smalltalk classNamed:className |
6569 |
||
6570 |
" |
|
6571 |
Dialog |
|
3276 | 6572 |
requestClass:'Enter a class:' |
5028 | 6573 |
list:(View withAllSubclasses copy sortBySelector:#name) |
3181 | 6574 |
okLabel:'OK' |
6575 |
initialAnswer:'Arr' |
|
6576 |
" |
|
3532 | 6577 |
|
6578 |
"Created: / 12-01-2008 / 23:02:28 / cg" |
|
6579 |
! |
|
6580 |
||
6581 |
requestClass:aString okLabel:okLabel initialAnswer:initial |
|
5191 | 6582 |
"launch a Dialog, which allows user to enter an existing class's name. |
3532 | 6583 |
Return the entered class or nil (if cancel was pressed). |
6584 |
The entryField does classNameCompletion on TAB." |
|
6585 |
||
6586 |
^ self requestClass:aString list:nil okLabel:okLabel initialAnswer:initial |
|
6587 |
||
6588 |
" |
|
6589 |
Dialog |
|
6590 |
requestClass:'Enter a class:' |
|
6591 |
okLabel:'OK' |
|
6592 |
initialAnswer:'Arr' |
|
6593 |
" |
|
6594 |
||
6595 |
"Modified: / 12-01-2008 / 23:02:42 / cg" |
|
6596 |
! |
|
6597 |
||
4541 | 6598 |
requestClassName:aString initialAnswer:initial |
6599 |
"launch a Dialog, which allows user to enter a class name. |
|
6600 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
6601 |
The entryField does classNameCompletion on TAB." |
|
6602 |
||
6603 |
^ self requestClassName:aString list:nil okLabel:'OK' initialAnswer:initial |
|
6604 |
||
6605 |
" |
|
6606 |
Dialog |
|
6607 |
requestClassName:'enter a class:' |
|
6608 |
initialAnswer:'Arr' |
|
6609 |
" |
|
6610 |
||
6611 |
"Modified: / 12-01-2008 / 22:58:13 / cg" |
|
6612 |
! |
|
6613 |
||
3532 | 6614 |
requestClassName:aString list:list okLabel:okLabel initialAnswer:initial |
3181 | 6615 |
"launch a Dialog, which allows user to enter a class name. |
6616 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
6617 |
The entryField does classNameCompletion on TAB." |
|
6618 |
||
6619 |
^ self |
|
6620 |
request:aString |
|
6621 |
displayAt:nil |
|
6622 |
centered:nil |
|
6623 |
action:nil |
|
6624 |
initialAnswer:initial |
|
6625 |
okLabel:okLabel |
|
6626 |
cancelLabel:nil |
|
6627 |
title:nil |
|
6628 |
onCancel:nil |
|
3532 | 6629 |
list:list |
3181 | 6630 |
initialSelection:nil |
3182 | 6631 |
entryCompletionBlock:DoWhatIMeanSupport classNameEntryCompletionBlock |
3181 | 6632 |
|
6633 |
" |
|
6634 |
Dialog |
|
3532 | 6635 |
requestClassName:'Enter a class:' |
6636 |
list:(Array with:Array with:String with:Point) |
|
6637 |
okLabel:'OK' |
|
6638 |
initialAnswer:'Arr' |
|
6639 |
" |
|
6640 |
||
6641 |
"Created: / 12-01-2008 / 22:58:01 / cg" |
|
6642 |
! |
|
6643 |
||
6644 |
requestClassName:aString okLabel:okLabel initialAnswer:initial |
|
6645 |
"launch a Dialog, which allows user to enter a class name. |
|
6646 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
6647 |
The entryField does classNameCompletion on TAB." |
|
6648 |
||
6649 |
^ self requestClassName:aString list:nil okLabel:okLabel initialAnswer:initial |
|
6650 |
||
6651 |
" |
|
6652 |
Dialog |
|
3181 | 6653 |
requestClassName:'enter a class:' |
6654 |
okLabel:'OK' |
|
6655 |
initialAnswer:'Arr' |
|
6656 |
" |
|
3532 | 6657 |
|
6658 |
"Modified: / 12-01-2008 / 22:58:13 / cg" |
|
3181 | 6659 |
! |
6660 |
||
3538 | 6661 |
requestName:title fromList:nameList title:boxTitle initialAnswer:initialTextOrNil |
6662 |
"Ask for a name from a list (used for namespaces and sharedPools)" |
|
6663 |
||
6664 |
|newName box| |
|
6665 |
||
6666 |
box := ListSelectionBox new. |
|
6667 |
box title:title. |
|
6668 |
box list:nameList. |
|
6669 |
box okAction:[:sel | newName := sel]. |
|
6670 |
box initialText:initialTextOrNil. |
|
6671 |
boxTitle notNil ifTrue:[ box label:boxTitle ]. |
|
6672 |
box showAtPointer. |
|
6673 |
||
6674 |
newName notNil ifTrue:[ |
|
6675 |
newName := newName withoutSeparators. |
|
6676 |
]. |
|
6677 |
^ newName |
|
6678 |
||
6679 |
" |
|
6680 |
Dialog |
|
6681 |
requestName:'Select a Name' |
|
6682 |
fromList:#('foo' 'bar' 'baz') |
|
6683 |
title:'blabla' |
|
6684 |
initialAnswer:nil |
|
6685 |
" |
|
6686 |
! |
|
6687 |
||
2486 | 6688 |
requestNameSpace:title initialAnswer:initialTextOrNil |
6689 |
"Ask for a namespaces name" |
|
6690 |
||
2996 | 6691 |
^ self |
6692 |
requestNameSpace:title |
|
3538 | 6693 |
title:title |
2996 | 6694 |
initialAnswer:initialTextOrNil |
6695 |
||
6696 |
" |
|
3538 | 6697 |
Dialog |
6698 |
requestNameSpace:'Select a NameSpace' |
|
6699 |
initialAnswer:nil |
|
2996 | 6700 |
" |
6701 |
! |
|
6702 |
||
6703 |
requestNameSpace:title title:boxTitle initialAnswer:initialTextOrNil |
|
6704 |
"Ask for a namespaces name" |
|
6705 |
||
3538 | 6706 |
|allNameSpaces| |
2486 | 6707 |
|
3282 | 6708 |
allNameSpaces := NameSpace allNameSpaces collect:[:each | each name]. |
2486 | 6709 |
allNameSpaces := allNameSpaces asOrderedCollection sort. |
6710 |
||
3538 | 6711 |
^ self |
6712 |
requestName:title |
|
6713 |
fromList:allNameSpaces |
|
6714 |
title:boxTitle |
|
6715 |
initialAnswer:initialTextOrNil |
|
6716 |
||
6717 |
" |
|
6718 |
Dialog |
|
6719 |
requestNameSpace:'Select a NameSpace' |
|
6720 |
initialAnswer:nil |
|
2486 | 6721 |
" |
6722 |
! |
|
6723 |
||
5993 | 6724 |
requestProject:title from:listOfProjectsIn initialAnswer:initialTextOrNil suggestions:suggestionsOrNil |
3384 | 6725 |
"Ask for a project (package-id)" |
6726 |
||
5993 | 6727 |
|suggestions listOfProjects newProject box more| |
6728 |
||
6729 |
suggestions := suggestionsOrNil ? #(). |
|
6730 |
||
5889 | 6731 |
listOfProjects := listOfProjectsIn. |
6732 |
||
6733 |
more := suggestions reject:[:each | (listOfProjects includes:each)]. |
|
6734 |
more notEmpty ifTrue:[ |
|
6735 |
listOfProjects := (listOfProjects , more) sort |
|
6736 |
]. |
|
6737 |
||
3384 | 6738 |
box := ListSelectionBox new. |
6739 |
box useComboBoxWithList:suggestions. |
|
6740 |
box title:title. |
|
3736 | 6741 |
box list:listOfProjects. |
3384 | 6742 |
box okAction:[:sel | newProject := sel]. |
6743 |
box initialText:initialTextOrNil. |
|
6744 |
box entryCompletionBlock:(DoWhatIMeanSupport packageNameEntryCompletionBlock). |
|
4307
f7c4d912269c
changed: #requestProject:from:initialAnswer:suggestions:
Claus Gittinger <cg@exept.de>
parents:
4302
diff
changeset
|
6745 |
box label:'Enter Project/PackageID'. |
3384 | 6746 |
box showAtPointer. |
6747 |
||
6748 |
newProject notNil ifTrue:[ |
|
6749 |
newProject := newProject withoutSeparators asSymbol. |
|
6750 |
]. |
|
6751 |
^ newProject |
|
6752 |
||
6753 |
" |
|
6754 |
Dialog |
|
6755 |
requestProject:'enter a project' |
|
6756 |
initialAnswer:'stx:libbasic' |
|
6757 |
suggestions:#('foo' 'bar' 'baz') |
|
6758 |
" |
|
6759 |
||
6760 |
"Created: / 07-09-2006 / 11:40:17 / cg" |
|
6761 |
! |
|
6762 |
||
3736 | 6763 |
requestProject:title initialAnswer:initialTextOrNil suggestions:suggestions |
6764 |
"Ask for a project (package-id)" |
|
6765 |
||
6766 |
|allProjects| |
|
6767 |
||
5615 | 6768 |
allProjects := Smalltalk allPackageIDs. |
3736 | 6769 |
^ self |
6770 |
requestProject:title |
|
6771 |
from:allProjects |
|
6772 |
initialAnswer:initialTextOrNil |
|
6773 |
suggestions:suggestions |
|
6774 |
! |
|
6775 |
||
2486 | 6776 |
requestSelector:aString initialAnswer:initial |
6777 |
"launch a Dialog, which allows user to enter a method selector. |
|
6778 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
6779 |
The entryField does selectorCompletion on TAB." |
|
6780 |
||
6781 |
^ self requestSelector:aString okLabel:nil initialAnswer:initial |
|
6782 |
||
6783 |
" |
|
6784 |
Dialog |
|
6785 |
requestSelector:'enter a selector:' |
|
6786 |
initialAnswer:'at:p' |
|
6787 |
" |
|
6788 |
! |
|
6789 |
||
6790 |
requestSelector:aString okLabel:okLabel initialAnswer:initial |
|
6791 |
"launch a Dialog, which allows user to enter a method selector. |
|
6792 |
Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
6793 |
The entryField does selectorCompletion on TAB." |
|
6794 |
||
6795 |
^ self |
|
6796 |
request:aString |
|
6797 |
displayAt:nil |
|
6798 |
centered:nil |
|
6799 |
action:nil |
|
6800 |
initialAnswer:initial |
|
6801 |
okLabel:okLabel |
|
6802 |
cancelLabel:nil |
|
6803 |
title:nil |
|
6804 |
onCancel:nil |
|
6805 |
list:nil |
|
6806 |
initialSelection:nil |
|
5712 | 6807 |
entryCompletionBlock: |
6808 |
[:s :field| |
|
6809 |
|completion| |
|
6810 |
||
6811 |
completion := Smalltalk selectorCompletion:s. |
|
6812 |
completion second size > 1 ifTrue:[ |
|
6813 |
UserPreferences current beepInEditor ifTrue:[ |
|
6814 |
Screen current beep |
|
6815 |
]. |
|
6816 |
]. |
|
6817 |
field contents:(completion first) |
|
6818 |
] |
|
2486 | 6819 |
|
6820 |
" |
|
6821 |
Dialog |
|
6822 |
requestSelector:'enter a selector:' |
|
6823 |
initialAnswer:'at:p' |
|
6824 |
" |
|
3538 | 6825 |
! |
6826 |
||
6827 |
requestSharedPool:title title:boxTitle initialAnswer:initialTextOrNil |
|
6828 |
"Ask for a sharedPools name" |
|
6829 |
||
6830 |
|allPools| |
|
6831 |
||
6832 |
allPools := SharedPool allSubclasses collect:[:each | each name]. |
|
6833 |
allPools := allPools asOrderedCollection sort. |
|
6834 |
||
6835 |
^ self |
|
6836 |
requestName:title |
|
6837 |
fromList:allPools |
|
6838 |
title:boxTitle |
|
6839 |
initialAnswer:initialTextOrNil |
|
6840 |
||
6841 |
" |
|
6842 |
Dialog |
|
6843 |
requestSharedPool:'Select a SharedPool' |
|
6844 |
title:nil |
|
6845 |
initialAnswer:nil |
|
6846 |
" |
|
2486 | 6847 |
! ! |
6848 |
||
197 | 6849 |
!DialogBox methodsFor:'accessing-behavior'! |
6850 |
||
6851 |
abortAction:aBlock |
|
6852 |
"define the action to be performed when abort is pressed" |
|
6853 |
||
6854 |
abortAction := aBlock |
|
125 | 6855 |
! |
6856 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6857 |
acceptCheck:aBlock |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6858 |
"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
|
6859 |
accepted (ok-button or Return-key). If it returns true, the box is closed, |
2106 | 6860 |
otherwise not. Of course, you may also use a valueHolder instead of a block |
6861 |
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
|
6862 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6863 |
acceptCheck := aBlock |
2106 | 6864 |
|
6865 |
"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
|
6866 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6867 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6868 |
acceptOnLeave:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6869 |
"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
|
6870 |
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
|
6871 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6872 |
acceptOnLeave := aBoolean. |
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6873 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6874 |
"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
|
6875 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6876 |
|
197 | 6877 |
acceptReturnAsOK:aBoolean |
6878 |
"turn on/off interpretation of return-key as ok. |
|
6879 |
Default is on" |
|
6880 |
||
6881 |
acceptReturnAsOK := aBoolean. |
|
6882 |
okButton notNil ifTrue:[ |
|
6883 |
okButton isReturnButton:aBoolean. |
|
6884 |
] |
|
6885 |
! |
|
6886 |
||
6887 |
action:aBlock |
|
6888 |
"set the action to be performed when user presses ok-button; |
|
6889 |
aBlock must be nil or a block. This method simply |
|
6890 |
reuses okAction: and has been added for a consistent action-setting |
|
6891 |
protocol." |
|
76 | 6892 |
|
197 | 6893 |
self okAction:aBlock |
6894 |
! |
|
6895 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6896 |
focusOnField:anInputField |
1646 | 6897 |
"arrange for the argument to get the focus (initially)" |
6898 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6899 |
inputFieldGroup makeActive:anInputField |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6900 |
|
1646 | 6901 |
"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
|
6902 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6903 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6904 |
focusToOKOnLeave:aBoolean |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6905 |
"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
|
6906 |
or cursor key. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6907 |
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
|
6908 |
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
|
6909 |
the dialog is accepted & closed." |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6910 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6911 |
focusToOKOnLeave := aBoolean. |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6912 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6913 |
"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
|
6914 |
"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
|
6915 |
! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
6916 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6917 |
hideOnAccept:aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6918 |
"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
|
6919 |
The default is true" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6920 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6921 |
hideOnAccept := aBoolean |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6922 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
6923 |
|
593 | 6924 |
makeTabable:aComponentOrSubcomponent |
6925 |
"add a component (usually a subcomponent, of which the dialog |
|
6926 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
6927 |
stepped through via FocusNext/FocusPrevious). |
|
6928 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
6929 |
||
3467 | 6930 |
aComponentOrSubcomponent canTab:true. |
6931 |
||
6932 |
"/ tabableElements isNil ifTrue:[ |
|
6933 |
"/ tabableElements := OrderedCollection new |
|
6934 |
"/ ]. |
|
6935 |
"/ (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
|
6936 |
"/ tabableElements add:aComponentOrSubcomponent. |
|
6937 |
"/ ]. |
|
6938 |
||
6939 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
6940 |
self addToInputFieldGroup:aComponentOrSubcomponent |
|
593 | 6941 |
]. |
6942 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
6943 |
"Modified: 31.5.1996 / 21:22:13 / cg" |
593 | 6944 |
! |
6945 |
||
1843 | 6946 |
makeTabable:aComponentOrSubcomponent after:anotherComponent |
6947 |
"add a component (usually a subcomponent, of which the dialog |
|
6948 |
does not know) to the list of tabable ones (i.e. those, that can be |
|
6949 |
stepped through via FocusNext/FocusPrevious). |
|
6950 |
Toplevel tabable components are usually added with #addComponent:tabable:" |
|
6951 |
||
3467 | 6952 |
<resource: #obsolete> |
6953 |
self obsoleteMethodWarning. "/ focusSequence has been eliminated |
|
6954 |
||
6955 |
aComponentOrSubcomponent canTab:true. |
|
6956 |
||
6957 |
"/ tabableElements isNil ifTrue:[ |
|
6958 |
"/ tabableElements := OrderedCollection new |
|
6959 |
"/ ]. |
|
6960 |
"/ tabableElements removeIdentical:aComponentOrSubcomponent ifAbsent:nil. |
|
6961 |
"/ |
|
6962 |
"/ anotherComponent isNil ifTrue:[ |
|
6963 |
"/ tabableElements addLast:aComponentOrSubcomponent |
|
6964 |
"/ ] ifFalse:[ |
|
6965 |
"/ tabableElements add:aComponentOrSubcomponent after:anotherComponent. |
|
6966 |
"/ ]. |
|
6967 |
"/ |
|
1843 | 6968 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
6969 |
self addToInputFieldGroup:aComponentOrSubcomponent after:anotherComponent |
|
6970 |
]. |
|
6971 |
||
6972 |
"Modified: 18.10.1997 / 03:08:20 / cg" |
|
6973 |
! |
|
6974 |
||
1355 | 6975 |
makeUntabable:aComponentOrSubcomponent |
3467 | 6976 |
aComponentOrSubcomponent canTab:false. |
6977 |
||
6978 |
"/ (tabableElements includesIdentical:aComponentOrSubcomponent) ifFalse:[ |
|
6979 |
"/ tabableElements removeIdentical:aComponentOrSubcomponent. |
|
6980 |
"/ ]. |
|
6981 |
||
6982 |
(aComponentOrSubcomponent isInputField) ifTrue:[ |
|
6983 |
self removeFromInputFieldGroup:aComponentOrSubcomponent |
|
1355 | 6984 |
]. |
6985 |
||
6986 |
"Modified: 18.10.1997 / 02:50:05 / cg" |
|
593 | 6987 |
! |
6988 |
||
2361 | 6989 |
noAction:aBlock |
6990 |
"define the action to be performed when 'no' is pressed" |
|
6991 |
||
6992 |
abortAction := aBlock |
|
6993 |
||
6994 |
"Modified: 16.1.1997 / 11:29:18 / cg" |
|
6995 |
! |
|
6996 |
||
197 | 6997 |
okAction:aBlock |
6998 |
"define the action to be performed when ok is pressed" |
|
133 | 6999 |
|
197 | 7000 |
okAction := aBlock |
2361 | 7001 |
! |
7002 |
||
7003 |
title:aString yesAction:yesBlock noAction:noBlock |
|
7004 |
"define title and actions" |
|
7005 |
||
7006 |
self title:aString. |
|
7007 |
okAction := yesBlock. |
|
7008 |
abortAction := noBlock |
|
7009 |
! |
|
7010 |
||
7011 |
yesAction:aBlock |
|
7012 |
"define the action to be performed when 'yes' is pressed" |
|
7013 |
||
7014 |
okAction := aBlock |
|
7015 |
||
7016 |
"Modified: 16.1.1997 / 11:31:21 / cg" |
|
7017 |
! |
|
7018 |
||
7019 |
yesAction:yesBlock noAction:noBlock |
|
7020 |
"define both actions" |
|
7021 |
||
7022 |
okAction := yesBlock. |
|
7023 |
abortAction := noBlock |
|
197 | 7024 |
! ! |
7025 |
||
7026 |
!DialogBox methodsFor:'accessing-components'! |
|
7027 |
||
7028 |
abortButton |
|
7029 |
"return the abortButton - this access is provided to allow |
|
7030 |
setting the buttons look (for example: colors or font)" |
|
7031 |
||
7032 |
^ abortButton |
|
76 | 7033 |
! |
7034 |
||
2327 | 7035 |
buttonPanel |
7036 |
"return the buttonPanel - this access is provided to allow |
|
7037 |
setting the buttons look (for example: colors or font)" |
|
7038 |
||
7039 |
^ buttonPanel |
|
7040 |
! |
|
7041 |
||
2147
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7042 |
cancelButton |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7043 |
"same as #abortButton; |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7044 |
return the abortButton - this access is provided to allow |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7045 |
setting the buttons look (for example: colors or font)" |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7046 |
|
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7047 |
^ self abortButton |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7048 |
! |
3d1a7c11592b
added #cancelButton (for convenience)
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7049 |
|
2361 | 7050 |
noButton |
7051 |
"return the no-button" |
|
7052 |
||
7053 |
^ abortButton |
|
7054 |
! |
|
7055 |
||
197 | 7056 |
okButton |
7057 |
"return the okButton - this access is provided to allow |
|
7058 |
setting the buttons look (for example: colors or font)" |
|
76 | 7059 |
|
197 | 7060 |
^ okButton |
2361 | 7061 |
! |
7062 |
||
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7063 |
verticalPanel |
3944
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
7064 |
"if there is none yet, create and add a vertical panel. |
4384
cd3a12b6fbf1
comment/format in: #verticalPanel
Claus Gittinger <cg@exept.de>
parents:
4380
diff
changeset
|
7065 |
This can be used to add 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
|
7066 |
|
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7067 |
|savedY| |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7068 |
|
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7069 |
verticalPanel isNil ifTrue:[ |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7070 |
savedY := yPosition. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7071 |
self addComponent:(verticalPanel := VerticalPanelView new). |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7072 |
verticalPanel horizontalLayout:#fit. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7073 |
verticalPanel verticalLayout:#top. |
5401 | 7074 |
"/ verticalPanel height:25. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7075 |
yPosition := savedY. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7076 |
]. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7077 |
^ verticalPanel |
4384
cd3a12b6fbf1
comment/format in: #verticalPanel
Claus Gittinger <cg@exept.de>
parents:
4380
diff
changeset
|
7078 |
|
cd3a12b6fbf1
comment/format in: #verticalPanel
Claus Gittinger <cg@exept.de>
parents:
4380
diff
changeset
|
7079 |
"Modified (comment): / 28-02-2012 / 15:46:23 / cg" |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7080 |
! |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7081 |
|
2361 | 7082 |
yesButton |
7083 |
"return the 'yes'-button" |
|
7084 |
||
7085 |
^ okButton |
|
7086 |
||
7087 |
"Modified: 16.1.1997 / 11:31:27 / cg" |
|
197 | 7088 |
! ! |
155 | 7089 |
|
197 | 7090 |
!DialogBox methodsFor:'accessing-elements'! |
7091 |
||
7092 |
componentAt:name |
|
680 | 7093 |
"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
|
7094 |
named previously with #name:as:" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7095 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7096 |
namedComponents isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7097 |
^ namedComponents at:name ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7098 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7099 |
"Modified: 16.1.1997 / 11:40:50 / cg" |
76 | 7100 |
! |
7101 |
||
197 | 7102 |
name:element as:name |
680 | 7103 |
"assign a name to a component. This can be done during construction, |
7104 |
to allow later access to the components (i.e. without a need to |
|
7105 |
remember them in some instVars)" |
|
7106 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7107 |
namedComponents isNil ifTrue:[ |
1401 | 7108 |
namedComponents := Dictionary new. |
197 | 7109 |
]. |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7110 |
namedComponents at:name put:element |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7111 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7112 |
"Modified: 16.1.1997 / 11:41:03 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7113 |
! ! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7114 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7115 |
!DialogBox methodsFor:'accessing-look'! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7116 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7117 |
abortText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7118 |
"define the label in the abort-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7119 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7120 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7121 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7122 |
aString ~= abortButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7123 |
oldSize := abortButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7124 |
abortButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7125 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7126 |
abortButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7127 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7128 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7129 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7130 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7131 |
|
1702 | 7132 |
hideButtons |
7133 |
"hides the buttonPanel (i.e. the ok and cancel buttons if any)" |
|
7134 |
||
7135 |
buttonPanel notNil ifTrue:[buttonPanel beInvisible] |
|
7136 |
! |
|
7137 |
||
2361 | 7138 |
noLabel:aString |
7139 |
"define the label of the 'no'-button. |
|
7140 |
And alias for #noText: - for backward compatibility" |
|
7141 |
||
7142 |
self noText:aString. |
|
7143 |
||
7144 |
"Created: 13.12.1995 / 16:21:57 / cg" |
|
7145 |
"Modified: 16.1.1997 / 11:30:25 / cg" |
|
7146 |
! |
|
7147 |
||
7148 |
noText:aString |
|
7149 |
"define the label of the no-button. |
|
7150 |
If not set, it defaults to the resource-string for 'no'." |
|
7151 |
||
7152 |
aString ~= abortButton label ifTrue:[ |
|
7153 |
abortButton label:aString. |
|
7154 |
abortButton resize. |
|
7155 |
shown ifTrue:[self resize] |
|
7156 |
] |
|
7157 |
! |
|
7158 |
||
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7159 |
okText:aString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7160 |
"define the text in the ok-button" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7161 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7162 |
|oldSize| |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7163 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7164 |
aString ~= okButton label ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7165 |
oldSize := okButton extent. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7166 |
okButton label:aString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7167 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7168 |
okButton extent ~= oldSize ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7169 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7170 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7171 |
] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7172 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7173 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7174 |
okText:okString abortText:abortString |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7175 |
"set both texts displayed in the buttons" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7176 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7177 |
(abortString ~= abortButton label |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7178 |
or:[okString ~= okButton label]) ifTrue:[ |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7179 |
okButton label:okString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7180 |
abortButton label:abortString. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7181 |
okButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7182 |
abortButton resize. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7183 |
shown ifTrue:[self resize] |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7184 |
] |
2361 | 7185 |
! |
7186 |
||
7187 |
okText:yesString noText:noString |
|
7188 |
"define the labels of both buttons. |
|
7189 |
Alias for yesText:noText: for backward compatibility." |
|
7190 |
||
7191 |
^ self yesText:yesString noText:noString |
|
7192 |
||
7193 |
"Modified: 16.1.1997 / 11:30:58 / cg" |
|
7194 |
! |
|
7195 |
||
4627 | 7196 |
title:aString |
7197 |
"define title" |
|
7198 |
||
7199 |
self label:aString. |
|
7200 |
||
7201 |
" |
|
7202 |
DialogBox new open |
|
7203 |
(DialogBox new title:'Foo') open |
|
7204 |
" |
|
7205 |
! |
|
7206 |
||
2361 | 7207 |
title:aString yesText:yesString noText:noString |
7208 |
"define title and button labels" |
|
7209 |
||
7210 |
self title:aString. |
|
7211 |
self yesText:yesString noText:noString |
|
7212 |
! |
|
7213 |
||
7214 |
yesLabel:aString |
|
7215 |
"define the label of the 'yes'-button. |
|
7216 |
An alias for #yesText: for backward compatibility." |
|
7217 |
||
7218 |
self yesText:aString. |
|
7219 |
||
7220 |
"Created: 13.12.1995 / 16:22:05 / cg" |
|
7221 |
"Modified: 16.1.1997 / 11:31:58 / cg" |
|
7222 |
! |
|
7223 |
||
7224 |
yesText:aString |
|
7225 |
"define the label of the 'yes'-button" |
|
7226 |
||
7227 |
self okText:aString |
|
7228 |
||
7229 |
"Modified: 16.1.1997 / 11:31:39 / cg" |
|
7230 |
! |
|
7231 |
||
7232 |
yesText:yesString noText:noString |
|
7233 |
"define the labels of both buttons" |
|
7234 |
||
7235 |
((yesString ~= okButton label) or:[noString ~= abortButton label]) ifTrue:[ |
|
7236 |
okButton label:yesString. |
|
7237 |
abortButton label:noString. |
|
7238 |
okButton resize. |
|
7239 |
abortButton resize. |
|
7240 |
shown ifTrue:[self resize] |
|
7241 |
] |
|
7242 |
||
7243 |
"Modified: 21.2.1996 / 00:58:38 / cg" |
|
197 | 7244 |
! ! |
7245 |
||
7246 |
!DialogBox methodsFor:'accessing-models'! |
|
76 | 7247 |
|
197 | 7248 |
accept |
7249 |
"return the valueHolder holding true when the box |
|
7250 |
is accepted, false if closed via the windowManager or |
|
7251 |
the cancel button. |
|
7252 |
This is confusing: this method was originally called #acceptValue, |
|
7253 |
but renamed for compatibility with ST-80. |
|
7254 |
This looks like a bad name to me, since in most other situations, #accept |
|
7255 |
is used to force an accept, not to return some valueHolder ...)." |
|
7256 |
||
7257 |
^ acceptValue |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
7258 |
! |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
7259 |
|
2221
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7260 |
acceptChannel |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7261 |
"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
|
7262 |
is accepted" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7263 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7264 |
^ acceptValue |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7265 |
|
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7266 |
"Created: / 18.8.2000 / 21:44:24 / cg" |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7267 |
! |
9510bfb6912c
additional interface to create a textBox
Claus Gittinger <cg@exept.de>
parents:
2220
diff
changeset
|
7268 |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
7269 |
acceptChannel:aValueHolder |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
7270 |
"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
|
7271 |
is accepted" |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
7272 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
7273 |
acceptValue := aValueHolder |
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7274 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7275 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7276 |
aspectAt:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7277 |
"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
|
7278 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7279 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7280 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7281 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7282 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7283 |
bindings isNil ifTrue:[bindings := IdentityDictionary new]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7284 |
bindings at:anAspectSymbol put:aDataModel |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7285 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7286 |
"Created: 16.1.1997 / 11:38:46 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7287 |
"Modified: 16.1.1997 / 11:41:28 / cg" |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7288 |
! |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7289 |
|
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7290 |
aspectFor:anAspectSymbol |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7291 |
"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
|
7292 |
requires that a corresponding dataModel has been set (usually during |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7293 |
initialization) via the #aspectAt:put: message. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7294 |
Allows users of boxes to access individual values - especially useful, |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7295 |
in multi-field dialogs." |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7296 |
|
3404
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
7297 |
"/ subclasses may redefine some aspects... |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
7298 |
(self respondsTo:anAspectSymbol) ifTrue:[ |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
7299 |
^ self perform:anAspectSymbol |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
7300 |
]. |
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
7301 |
|
950
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7302 |
bindings isNil ifTrue:[^ nil]. |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7303 |
^ bindings at:anAspectSymbol ifAbsent:nil |
09baff873688
added aspect dictionary facility.
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
7304 |
|
3404
7c42d37d18ea
allow for subclasses to define an aspect method
Claus Gittinger <cg@exept.de>
parents:
3393
diff
changeset
|
7305 |
"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
|
7306 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7307 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7308 |
cancel |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7309 |
^ BlockValue forLogicalNot:(acceptValue) |
76 | 7310 |
! ! |
7311 |
||
120 | 7312 |
!DialogBox methodsFor:'construction-adding'! |
7313 |
||
593 | 7314 |
addComponent:aComponent |
7315 |
"add any component with its preferred height and full width. |
|
7316 |
Returns the component." |
|
7317 |
||
7318 |
^ self addComponent:aComponent indent:nil tabable:false |
|
7319 |
||
7320 |
"Modified: 9.2.1996 / 22:22:41 / cg" |
|
7321 |
! |
|
7322 |
||
7323 |
addComponent:aComponent indent:indent |
|
7324 |
"add any component with its preferred height and full width. |
|
7325 |
The indent is temporarily changed to indent. |
|
7326 |
Returns the component." |
|
7327 |
||
7328 |
^ self addComponent:aComponent indent:indent tabable:false |
|
7329 |
||
7330 |
"Modified: 9.2.1996 / 22:22:44 / cg" |
|
7331 |
! |
|
7332 |
||
7333 |
addComponent:aComponent indent:indent tabable:tabable |
|
7334 |
"add any component with its preferred height and full width. |
|
7335 |
The indent is temporarily changed to indent. |
|
7336 |
Returns the component." |
|
7337 |
||
7338 |
|oldLeft oldRight result| |
|
7339 |
||
7340 |
oldLeft := leftIndent. |
|
7341 |
oldRight := rightIndent. |
|
7342 |
indent notNil ifTrue:[ |
|
1401 | 7343 |
leftIndent := rightIndent := indent. |
593 | 7344 |
]. |
7345 |
result := self addComponent:aComponent tabable:tabable tabbedComponent:aComponent. |
|
7346 |
leftIndent := oldLeft. |
|
7347 |
rightIndent := oldRight. |
|
7348 |
^ result |
|
7349 |
||
7350 |
"Modified: 9.2.1996 / 22:22:50 / cg" |
|
7351 |
! |
|
7352 |
||
7353 |
addComponent:aComponent indent:indent withExtent:ext |
|
7354 |
"add any component with some given extent. |
|
7355 |
Returns the component." |
|
7356 |
||
7357 |
|fullSize lI rI| |
|
7358 |
||
7359 |
indent isNil ifTrue:[ |
|
2801 | 7360 |
lI := leftIndent. |
7361 |
rI := rightIndent. |
|
593 | 7362 |
] ifFalse:[ |
2801 | 7363 |
lI := rI := indent |
593 | 7364 |
]. |
7365 |
||
7366 |
self basicAddComponent:aComponent. |
|
4155
1edd671b6485
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4146
diff
changeset
|
7367 |
(ext x isInteger) ifTrue:[ |
1edd671b6485
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4146
diff
changeset
|
7368 |
fullSize := ext + (lI + rI @ 0). |
1edd671b6485
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4146
diff
changeset
|
7369 |
width := fullSize x max:width. |
1edd671b6485
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4146
diff
changeset
|
7370 |
] ifFalse:[ |
1edd671b6485
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4146
diff
changeset
|
7371 |
fullSize := ext. |
1edd671b6485
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4146
diff
changeset
|
7372 |
]. |
593 | 7373 |
aComponent extent:fullSize. |
2801 | 7374 |
aComponent origin:(0.0 @ yPosition); |
7375 |
leftInset:lI; |
|
7376 |
rightInset:rI. |
|
4294
f635b66d4b27
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4293
diff
changeset
|
7377 |
|
f635b66d4b27
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4293
diff
changeset
|
7378 |
yPosition := aComponent corner y + ViewSpacing. |
f635b66d4b27
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4293
diff
changeset
|
7379 |
"/ yPosition := yPosition + aComponent height + ViewSpacing. |
593 | 7380 |
needResize := true. |
7381 |
^ aComponent |
|
7382 |
||
4294
f635b66d4b27
changed: #addComponent:indent:withExtent:
Claus Gittinger <cg@exept.de>
parents:
4293
diff
changeset
|
7383 |
"Modified: / 29-07-2011 / 12:28:47 / cg" |
593 | 7384 |
! |
7385 |
||
7386 |
addComponent:aComponent indent:indent withHeight:height |
|
7387 |
"add any component with some given height and full width. |
|
7388 |
Returns the component." |
|
7389 |
||
7390 |
|lI rI| |
|
7391 |
||
7392 |
indent isNil ifTrue:[ |
|
2801 | 7393 |
lI := leftIndent. |
7394 |
rI := rightIndent. |
|
593 | 7395 |
] ifFalse:[ |
2801 | 7396 |
lI := rI := indent |
593 | 7397 |
]. |
7398 |
self basicAddComponent:aComponent. |
|
3283 | 7399 |
aComponent |
4387
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
7400 |
height:height; |
3283 | 7401 |
origin:0.0@yPosition; |
4387
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
7402 |
width:1.0; |
3283 | 7403 |
leftInset:lI; |
7404 |
rightInset:rI. |
|
2801 | 7405 |
yPosition := yPosition + height + ViewSpacing. |
593 | 7406 |
^ aComponent |
7407 |
||
4387
91f02f4d71dd
changed: #choose:fromList:values:initialSelection:buttons:values:default:lines:width:cancel:multiple:title:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
4384
diff
changeset
|
7408 |
"Modified: 9.2.1996 / 22:22:58 / cg" |
593 | 7409 |
! |
7410 |
||
7411 |
addComponent:aComponent tabable:tabable |
|
7412 |
"add any component with its preferred height and full width. |
|
7413 |
Returns the component." |
|
7414 |
||
7415 |
^ self addComponent:aComponent tabable:tabable tabbedComponent:aComponent |
|
7416 |
||
7417 |
"Modified: 9.2.1996 / 22:23:04 / cg" |
|
7418 |
! |
|
7419 |
||
7420 |
addComponent:aComponent tabable:tabable tabbedComponent:subComponent |
|
7421 |
"add any component with its preferred height and full width. |
|
7422 |
Returns the component." |
|
7423 |
||
7424 |
tabable ifTrue:[ |
|
3467 | 7425 |
aComponent canTab:true. |
7426 |
||
7427 |
"/ tabableElements isNil ifTrue:[ |
|
7428 |
"/ tabableElements := OrderedCollection new |
|
7429 |
"/ ]. |
|
7430 |
"/ tabableElements add:subComponent |
|
593 | 7431 |
]. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
7432 |
^ self addComponent:aComponent withHeight:(aComponent preferredHeight). |
593 | 7433 |
|
7434 |
"Modified: 9.2.1996 / 22:23:07 / cg" |
|
7435 |
! |
|
7436 |
||
7437 |
addComponent:aComponent withExtent:ext |
|
7438 |
"add any component with some given extent. |
|
7439 |
Returns the component." |
|
7440 |
||
7441 |
^ self addComponent:aComponent indent:nil withExtent:ext |
|
7442 |
||
7443 |
"Modified: 9.2.1996 / 22:23:11 / cg" |
|
7444 |
! |
|
7445 |
||
7446 |
addComponent:aComponent withHeight:height |
|
7447 |
"add any component with some given height and full width. |
|
7448 |
Returns the component." |
|
7449 |
||
7450 |
^ self addComponent:aComponent indent:nil withHeight:height |
|
7451 |
||
7452 |
"Modified: 9.2.1996 / 22:23:15 / cg" |
|
7453 |
! |
|
7454 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7455 |
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
|
7456 |
"add a label and some view side-by-side. |
5242 | 7457 |
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
7458 |
The label's string is defined by labelString and adjusted according to labelAdjust. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7459 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7460 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7461 |
|
795 | 7462 |
^ self |
5242 | 7463 |
addLabelledField:aView |
7464 |
label:labelString |
|
7465 |
adjust:labelAdjust |
|
7466 |
tabable:tabable |
|
7467 |
from:leftX to:rightX separateAtX:relativeX |
|
7468 |
nameAs:nil |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7469 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7470 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7471 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7472 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7473 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7474 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7475 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7476 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7477 |
field := dialog |
5242 | 7478 |
addLabelledField:(EditField on:model) label:'input here:' |
7479 |
adjust:#left |
|
7480 |
tabable:true |
|
7481 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7482 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7483 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7484 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7485 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7486 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7487 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7488 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7489 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7490 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7491 |
model := SelectionInList new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7492 |
model list:#('foo' 'bar' 'baz'). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7493 |
model selectionIndex:2. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7494 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7495 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7496 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7497 |
field := dialog |
5242 | 7498 |
addLabelledField:(PopUpList on:model) label:'select here:' |
7499 |
adjust:#left |
|
7500 |
tabable:true |
|
7501 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7502 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7503 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7504 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7505 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7506 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7507 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7508 |
"Created: 3.6.1996 / 11:03:24 / cg" |
795 | 7509 |
"Modified: 17.7.1996 / 15:04:07 / cg" |
7510 |
! |
|
7511 |
||
4146
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7512 |
addLabelledField:aView label:labelString adjust:labelAdjust |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7513 |
tabable:tabable from:leftX to:rightX separateAtX:relativeX nameAs:aName |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7514 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7515 |
"add a label and some view side-by-side. |
5242 | 7516 |
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
7517 |
The label's string is defined by labelString and adjusted according to labelAdjust. |
|
4146
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7518 |
The inputField gets model as its model. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7519 |
Return the inputField." |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7520 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7521 |
^ self |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7522 |
addLabelledField:aView |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7523 |
label:labelString |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7524 |
adjust:labelAdjust |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7525 |
tabable:tabable |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7526 |
from:leftX to:rightX |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7527 |
separateAtX:relativeX |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7528 |
nameAs:aName |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7529 |
foregroundColor:nil |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7530 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7531 |
" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7532 |
|dialog model field| |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7533 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7534 |
model := '' asValue. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7535 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7536 |
dialog := DialogBox new. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7537 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7538 |
field := dialog |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7539 |
addLabelledField:(EditField on:model) |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7540 |
label:'input here:' |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7541 |
adjust:#left |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7542 |
tabable:true |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7543 |
separateAtX:0.3. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7544 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7545 |
dialog addAbortButton; addOkButton. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7546 |
dialog open. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7547 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7548 |
" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7549 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7550 |
" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7551 |
|dialog model field| |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7552 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7553 |
model := '' asValue. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7554 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7555 |
dialog := DialogBox new. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7556 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7557 |
field := dialog |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7558 |
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz')) |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7559 |
label:'select foo:' |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7560 |
adjust:#left |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7561 |
tabable:true |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7562 |
separateAtX:0.3. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7563 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7564 |
dialog addAbortButton; addOkButton. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7565 |
dialog open. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7566 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7567 |
" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7568 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7569 |
" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7570 |
|dialog model field| |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7571 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7572 |
model := SelectionInList new. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7573 |
model list:#('foo' 'bar' 'baz'). |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7574 |
model selectionIndex:2. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7575 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7576 |
dialog := DialogBox new. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7577 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7578 |
field := dialog |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7579 |
addLabelledField:(PopUpList on:model) |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7580 |
label:'select here:' |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7581 |
adjust:#left |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7582 |
tabable:true |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7583 |
separateAtX:0.3. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7584 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7585 |
dialog addAbortButton; addOkButton. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7586 |
dialog open. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7587 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7588 |
" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7589 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7590 |
"Created: 17.7.1996 / 15:03:32 / cg" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7591 |
"Modified: 26.7.1996 / 18:11:12 / cg" |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7592 |
! |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7593 |
|
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7594 |
addLabelledField:aView label:labelString adjust:labelAdjust |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7595 |
tabable:tabable from:leftX to:rightX separateAtX:relativeX nameAs:aName |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7596 |
foregroundColor:fgColor |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7597 |
|
795 | 7598 |
"add a label and some view side-by-side. |
5242 | 7599 |
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
7600 |
The label's string is defined by labelString and adjusted according to labelAdjust. |
|
795 | 7601 |
The inputField gets model as its model. |
7602 |
Return the inputField." |
|
7603 |
||
4193
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7604 |
|y lbl max relW wLabel| |
795 | 7605 |
|
7606 |
y := self yPosition. |
|
7607 |
lbl := Label label:labelString. |
|
4216
4d5603687943
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4208
diff
changeset
|
7608 |
|
4d5603687943
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4208
diff
changeset
|
7609 |
max := lbl preferredHeight max:(aView preferredHeight max:aView height). |
795 | 7610 |
|
7611 |
relW := rightX - leftX. |
|
7612 |
||
7613 |
self addComponent:lbl indent:leftIndent withHeight:max. |
|
7614 |
lbl rightInset:0. |
|
4193
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7615 |
relativeX isInteger ifTrue:[ |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7616 |
wLabel := relativeX. |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7617 |
] ifFalse:[ |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7618 |
wLabel := relW*relativeX. |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7619 |
]. |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7620 |
|
795 | 7621 |
lbl |
4193
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7622 |
width:wLabel; |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7623 |
left:leftX; |
4193
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7624 |
adjust:labelAdjust; |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7625 |
borderWidth:0. |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7626 |
|
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7627 |
relativeX isInteger ifTrue:[ |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7628 |
lbl preferredExtent:(wLabel @ lbl preferredExtent y). |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7629 |
lbl extent:(wLabel @ lbl preferredExtent y). |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7630 |
lbl sizeFixed:true. |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7631 |
]. |
795 | 7632 |
|
4146
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7633 |
fgColor notNil ifTrue:[ |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7634 |
lbl foregroundColor:fgColor |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7635 |
]. |
dac4342e6797
added: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4145
diff
changeset
|
7636 |
|
795 | 7637 |
self yPosition:y. |
4216
4d5603687943
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4208
diff
changeset
|
7638 |
|
4217
9453a5aa3fcf
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4216
diff
changeset
|
7639 |
"/ aView preferredExtent:(aView preferredExtent x @ max). |
9453a5aa3fcf
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4216
diff
changeset
|
7640 |
"/ aView height:max. |
4216
4d5603687943
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4208
diff
changeset
|
7641 |
|
795 | 7642 |
self addComponent:aView tabable:tabable. |
4193
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7643 |
|
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7644 |
relativeX isInteger ifTrue:[ |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7645 |
aView |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7646 |
leftInset:(ViewSpacing + relativeX); |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7647 |
left:0.0; |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7648 |
rightInset:ViewSpacing; |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7649 |
right:1.0. |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7650 |
] ifFalse:[ |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7651 |
aView |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7652 |
leftInset:ViewSpacing; |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7653 |
rightInset:ViewSpacing; |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7654 |
width:relW*(1.0 - relativeX); |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7655 |
left:leftX+(relW*relativeX). |
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7656 |
]. |
4218
7b0e5dd511e9
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4217
diff
changeset
|
7657 |
|
4219
c83b708345f7
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4218
diff
changeset
|
7658 |
"/ self todo. "/ someone changes this later, back to a too small height !!!!!! |
4222
53a2a6433f59
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
7659 |
aView setHeight:max. |
795 | 7660 |
|
7661 |
aView isInputField ifTrue:[ |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7662 |
self addToInputFieldGroup:aView |
795 | 7663 |
]. |
7664 |
||
7665 |
aName notNil ifTrue:[ |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7666 |
self name:lbl as:(aName , '.label'). |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7667 |
self name:aView as:aName |
795 | 7668 |
]. |
4216
4d5603687943
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4208
diff
changeset
|
7669 |
|
4d5603687943
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4208
diff
changeset
|
7670 |
^ aView |
795 | 7671 |
|
7672 |
" |
|
7673 |
|dialog model field| |
|
7674 |
||
7675 |
model := '' asValue. |
|
7676 |
||
7677 |
dialog := DialogBox new. |
|
7678 |
||
7679 |
field := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7680 |
addLabelledField:(EditField on:model) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7681 |
label:'input here:' |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7682 |
adjust:#left |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7683 |
tabable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7684 |
separateAtX:0.3. |
807 | 7685 |
|
7686 |
dialog addAbortButton; addOkButton. |
|
7687 |
dialog open. |
|
7688 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
7689 |
" |
|
7690 |
||
7691 |
" |
|
7692 |
|dialog model field| |
|
7693 |
||
7694 |
model := '' asValue. |
|
7695 |
||
7696 |
dialog := DialogBox new. |
|
7697 |
||
7698 |
field := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7699 |
addLabelledField:((ComboListView on:model) list:#('foo' 'bar' 'baz')) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7700 |
label:'select foo:' |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7701 |
adjust:#left |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7702 |
tabable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7703 |
separateAtX:0.3. |
795 | 7704 |
|
7705 |
dialog addAbortButton; addOkButton. |
|
7706 |
dialog open. |
|
7707 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
7708 |
" |
|
7709 |
||
7710 |
" |
|
7711 |
|dialog model field| |
|
7712 |
||
7713 |
model := SelectionInList new. |
|
7714 |
model list:#('foo' 'bar' 'baz'). |
|
7715 |
model selectionIndex:2. |
|
7716 |
||
7717 |
dialog := DialogBox new. |
|
7718 |
||
7719 |
field := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7720 |
addLabelledField:(PopUpList on:model) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7721 |
label:'select here:' |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7722 |
adjust:#left |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7723 |
tabable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
7724 |
separateAtX:0.3. |
795 | 7725 |
|
7726 |
dialog addAbortButton; addOkButton. |
|
7727 |
dialog open. |
|
7728 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
|
7729 |
" |
|
7730 |
||
4193
bfcc66744c84
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4183
diff
changeset
|
7731 |
"Created: / 17-07-1996 / 15:03:32 / cg" |
4222
53a2a6433f59
changed: #addLabelledField:label:adjust:tabable:from:to:separateAtX:nameAs:foregroundColor:
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
7732 |
"Modified: / 02-02-2011 / 12:17:55 / cg" |
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7733 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7734 |
|
593 | 7735 |
addLabelledField:aView label:labelString adjust:labelAdjust tabable:tabable separateAtX:relativeX |
7736 |
"add a label and some view side-by-side. |
|
5242 | 7737 |
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
7738 |
The label's string is defined by labelString and adjusted according to labelAdjust. |
|
593 | 7739 |
The inputField gets model as its model. |
7740 |
Return the inputField." |
|
7741 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7742 |
^ self |
5242 | 7743 |
addLabelledField:aView |
7744 |
label:labelString |
|
7745 |
adjust:labelAdjust |
|
7746 |
tabable:tabable |
|
7747 |
from:0.0 to:1.0 |
|
7748 |
separateAtX:relativeX |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7749 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7750 |
"/ |y lbl max| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7751 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7752 |
"/ y := self yPosition. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7753 |
"/ lbl := Label label:labelString. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7754 |
"/ max := lbl preferredExtent y max:(aView preferredExtent y). |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7755 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7756 |
"/ self addComponent:lbl indent:leftIndent withHeight:max. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7757 |
"/ lbl rightInset:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7758 |
"/ lbl width:relativeX; adjust:labelAdjust; borderWidth:0. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7759 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7760 |
"/ self yPosition:y. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7761 |
"/ self addComponent:aView tabable:tabable. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7762 |
"/ aView leftInset:ViewSpacing; rightInset:ViewSpacing. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7763 |
"/ aView width:(1.0 - relativeX); left:relativeX. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7764 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7765 |
"/ aView isInputField ifTrue:[ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7766 |
"/ self addToInputFieldGroup:aView |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7767 |
"/ ]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7768 |
"/ |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7769 |
"/ ^ aView |
593 | 7770 |
|
7771 |
" |
|
7772 |
|dialog model field| |
|
7773 |
||
7774 |
model := '' asValue. |
|
7775 |
||
7776 |
dialog := DialogBox new. |
|
7777 |
||
7778 |
field := dialog |
|
5242 | 7779 |
addLabelledField:(EditField on:model) label:'input here:' |
7780 |
adjust:#left |
|
7781 |
tabable:true |
|
7782 |
separateAtX:0.3. |
|
593 | 7783 |
|
7784 |
dialog addAbortButton; addOkButton. |
|
7785 |
dialog open. |
|
655 | 7786 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 7787 |
" |
7788 |
||
7789 |
" |
|
7790 |
|dialog model field| |
|
7791 |
||
7792 |
model := SelectionInList new. |
|
7793 |
model list:#('foo' 'bar' 'baz'). |
|
7794 |
model selectionIndex:2. |
|
7795 |
||
7796 |
dialog := DialogBox new. |
|
7797 |
||
7798 |
field := dialog |
|
5242 | 7799 |
addLabelledField:(PopUpList on:model) label:'select here:' |
7800 |
adjust:#left |
|
7801 |
tabable:true |
|
7802 |
separateAtX:0.3. |
|
593 | 7803 |
|
7804 |
dialog addAbortButton; addOkButton. |
|
7805 |
dialog open. |
|
655 | 7806 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 7807 |
" |
7808 |
||
7809 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
7810 |
"Modified: 3.6.1996 / 18:48:49 / cg" |
593 | 7811 |
! |
7812 |
||
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7813 |
addMessage:labelString centered:centered |
4653 | 7814 |
|l| |
7815 |
||
7816 |
l := self addTextLabel:labelString. |
|
7817 |
l adjust:(centered ifTrue:[#center] ifFalse:[#left]). |
|
7818 |
^ l |
|
2116 | 7819 |
|
7820 |
"Created: / 4.2.2000 / 00:03:24 / cg" |
|
7821 |
! |
|
7822 |
||
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7823 |
addMessage:labelString textLine:valueHolder boundary:fraction |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7824 |
^ self |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7825 |
addMessage:labelString |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7826 |
textLine:valueHolder |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7827 |
type:nil |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7828 |
boundary:fraction |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7829 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7830 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7831 |
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
|
7832 |
|pos lbl field| |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7833 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7834 |
pos := self yPosition. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7835 |
lbl := self addTextLabel:labelString. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7836 |
lbl width:fraction. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7837 |
self yPosition:pos. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7838 |
field := self addInputFieldOn:valueHolder tabable:true. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7839 |
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
|
7840 |
typeSymbolOrNil == #password ifTrue:[ |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7841 |
field bePassword |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7842 |
]. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7843 |
^ field |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7844 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
7845 |
|
593 | 7846 |
addTextLabel:aString |
7847 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
7848 |
however, ST/X labels allow image labels too. |
|
7849 |
Returns the label." |
|
7850 |
||
7851 |
|l| |
|
7852 |
||
7853 |
l := Label new label:aString. |
|
7854 |
l borderWidth:0. |
|
7855 |
self addComponent:l. |
|
7856 |
^ l |
|
7857 |
||
7858 |
" |
|
7859 |
|b| |
|
7860 |
||
7861 |
b := DialogBox new. |
|
7862 |
b addTextLabel:'hello'. |
|
7863 |
b showAtPointer |
|
7864 |
" |
|
7865 |
" |
|
7866 |
|b| |
|
7867 |
||
7868 |
b := DialogBox new. |
|
7869 |
b leftIndent:100. |
|
7870 |
b addTextLabel:'hello'. |
|
7871 |
b leftIndent:0. |
|
7872 |
b addTextLabel:'world'. |
|
7873 |
b showAtPointer |
|
7874 |
" |
|
7875 |
" |
|
7876 |
|b| |
|
7877 |
||
7878 |
b := DialogBox new. |
|
7879 |
b addTextLabel:'hello'. |
|
7880 |
b addTextLabel:'world'. |
|
7881 |
b addOkButton. |
|
7882 |
b showAtPointer |
|
7883 |
" |
|
7884 |
" |
|
7885 |
|b| |
|
7886 |
||
7887 |
b := DialogBox new. |
|
7888 |
b addTextLabel:'hello'. |
|
7889 |
(b addTextLabel:'world') foregroundColor:Color red. |
|
7890 |
b addOkButton. |
|
7891 |
b showAtPointer |
|
7892 |
" |
|
7893 |
" |
|
7894 |
|b| |
|
7895 |
||
7896 |
b := DialogBox new. |
|
7897 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
7898 |
b addOkButton. |
|
7899 |
b showAtPointer |
|
7900 |
" |
|
7901 |
" |
|
7902 |
|b| |
|
7903 |
||
7904 |
b := DialogBox new. |
|
7905 |
b addTextLabel:'hello world\\How about this ?' withCRs. |
|
7906 |
b addTextLabel:'not bad'. |
|
7907 |
b addAbortButton. |
|
7908 |
b addOkButton. |
|
7909 |
b showAtPointer |
|
7910 |
" |
|
7911 |
! |
|
7912 |
||
4839 | 7913 |
addTextLabel:aString adjust:how |
7914 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
7915 |
however, ST/X labels allow image labels too. |
|
5245 | 7916 |
Returns the label. |
7917 |
The adjust argument must be one of #left, #right or #center (see Label for details)" |
|
4839 | 7918 |
|
7919 |
|l| |
|
7920 |
||
7921 |
l := self addTextLabel:aString. |
|
7922 |
l adjust:how. |
|
7923 |
^ l |
|
7924 |
||
7925 |
" |
|
7926 |
|b| |
|
7927 |
||
7928 |
b := DialogBox new. |
|
7929 |
b addTextLabel:'hello' adjust:#left. |
|
7930 |
b showAtPointer |
|
7931 |
" |
|
7932 |
" |
|
7933 |
|b| |
|
7934 |
||
7935 |
b := DialogBox new. |
|
7936 |
b addTextLabel:'hello' adjust:#right. |
|
7937 |
b showAtPointer |
|
7938 |
" |
|
7939 |
! |
|
7940 |
||
3908 | 7941 |
addTextLabelOn:aValueHolder |
7942 |
"create a text label showing the contents of a valueHolder. |
|
7943 |
Returns the label." |
|
7944 |
||
7945 |
|l| |
|
7946 |
||
7947 |
l := Label new labelChannel:aValueHolder. |
|
7948 |
l borderWidth:0. |
|
7949 |
self addComponent:l. |
|
7950 |
^ l |
|
7951 |
||
7952 |
" |
|
5245 | 7953 |
|holder b| |
7954 |
||
7955 |
holder := ValueHolder with:'hello'. |
|
3908 | 7956 |
|
7957 |
b := DialogBox new. |
|
5245 | 7958 |
b addTextLabelOn:holder asValue. |
7959 |
[ Delay waitForSeconds:2. holder value:'world' ] fork. |
|
3908 | 7960 |
b showAtPointer |
7961 |
" |
|
7962 |
" |
|
7963 |
|b| |
|
7964 |
||
7965 |
b := DialogBox new. |
|
7966 |
b leftIndent:100. |
|
7967 |
b addTextLabelOn:'hello' asValue. |
|
7968 |
b leftIndent:0. |
|
7969 |
b addTextLabelOn:'world' asValue. |
|
7970 |
b showAtPointer |
|
7971 |
" |
|
7972 |
! |
|
7973 |
||
5245 | 7974 |
addTextLabelOn:aStringHolder adjust:how |
7975 |
"create a text label - the name has been choosen for ST-80 compatibility; |
|
7976 |
however, ST/X labels allow image labels too. |
|
7977 |
Returns the label. |
|
7978 |
The adjust argument must be one of #left, #right or #center (see Label for details)" |
|
7979 |
||
7980 |
|l| |
|
7981 |
||
7982 |
l := self addTextLabelOn:aStringHolder. |
|
7983 |
l adjust:how. |
|
7984 |
^ l |
|
7985 |
||
7986 |
" |
|
7987 |
|holder b| |
|
7988 |
||
7989 |
holder := ValueHolder with:'hello'. |
|
7990 |
||
7991 |
b := DialogBox new. |
|
7992 |
b addTextLabelOn:holder asValue adjust:#left. |
|
7993 |
[ Delay waitForSeconds:2. holder value:'world' ] fork. |
|
7994 |
b showAtPointer |
|
7995 |
" |
|
7996 |
! |
|
7997 |
||
593 | 7998 |
addToInputFieldGroup:aComponentOrSubcomponent |
7999 |
"add a component to the input group. |
|
8000 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
8001 |
a topLevel component." |
|
8002 |
||
1355 | 8003 |
self |
1401 | 8004 |
addToInputFieldGroup:aComponentOrSubcomponent before:nil |
1355 | 8005 |
|
8006 |
"Modified: 18.10.1997 / 03:09:17 / cg" |
|
8007 |
! |
|
8008 |
||
8009 |
addToInputFieldGroup:aComponentOrSubcomponent before:anotherComponent |
|
8010 |
"add a component to the input group. |
|
8011 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
8012 |
a topLevel component." |
|
8013 |
||
593 | 8014 |
inputFieldGroup isNil ifTrue:[ |
1759 | 8015 |
inputFieldGroup := EnterFieldGroup new. |
8016 |
inputFieldGroup leaveAction:[self lastFieldLeft]. |
|
8017 |
"/ |
|
8018 |
"/ the first inputField gets the focus initially |
|
8019 |
"/ |
|
8020 |
aComponentOrSubcomponent hasKeyboardFocus:true. |
|
593 | 8021 |
]. |
1355 | 8022 |
inputFieldGroup add:aComponentOrSubcomponent before:anotherComponent. |
593 | 8023 |
self delegate:(KeyboardForwarder to:inputFieldGroup condition:#noFocus). |
8024 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8025 |
"/ inputFields isNil ifTrue:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8026 |
"/ inputFields := OrderedCollection new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8027 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8028 |
"/ "/ 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
|
8029 |
"/ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8030 |
"/ aComponentOrSubcomponent showCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8031 |
"/ aComponentOrSubcomponent hasKeyboardFocus:true. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8032 |
"/ ] ifFalse:[ |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8033 |
"/ aComponentOrSubcomponent hideCursor. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8034 |
"/ aComponentOrSubcomponent hasKeyboardFocus:false. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8035 |
"/ ]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8036 |
"/ inputFields add:aComponentOrSubcomponent |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8037 |
|
1355 | 8038 |
"Modified: 18.10.1997 / 02:47:20 / cg" |
8039 |
"Created: 18.10.1997 / 03:08:51 / cg" |
|
8040 |
! |
|
8041 |
||
8042 |
removeFromInputFieldGroup:aComponentOrSubcomponent |
|
8043 |
"remove a component from the input group. |
|
8044 |
The argument, aComponentOrSubcomponent may even be a nested subcomponent of |
|
8045 |
a topLevel component." |
|
8046 |
||
8047 |
inputFieldGroup isNil ifTrue:[^ self]. |
|
8048 |
inputFieldGroup remove:aComponentOrSubcomponent. |
|
8049 |
||
8050 |
"Created: 18.10.1997 / 02:51:30 / cg" |
|
593 | 8051 |
! ! |
8052 |
||
8053 |
!DialogBox methodsFor:'construction-buttons'! |
|
8054 |
||
1763 | 8055 |
addAbortAndOkButtons |
8056 |
"create both abort- and Ok Buttons" |
|
8057 |
||
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8058 |
self |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8059 |
addAbortButtonLabelled:nil; |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8060 |
addOkButtonLabelled:nil |
1763 | 8061 |
! |
8062 |
||
197 | 8063 |
addAbortButton |
8064 |
"create an abortButton - to be sent from redefined initialize |
|
162 | 8065 |
methods in subclasses or when creating a box programmatically. |
8066 |
Returns the button." |
|
8067 |
||
197 | 8068 |
^ self addAbortButtonLabelled:nil |
122 | 8069 |
! |
120 | 8070 |
|
162 | 8071 |
addAbortButton:aButton |
8072 |
"add an already created abortButton - to be sent from redefined initialize |
|
8073 |
methods in subclasses or when creating a box programmatically. |
|
8074 |
Returns the button." |
|
8075 |
||
8076 |
abortButton := aButton. |
|
8077 |
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
|
8078 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8079 |
"/ changed: |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8080 |
"/ 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
|
8081 |
|
2698 | 8082 |
"/ (Dialog defaultOKButtonAtLeft) ifTrue:[ |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8083 |
"/ 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
|
8084 |
"/ ] ifFalse:[ |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8085 |
"/ 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
|
8086 |
"/ ]. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8087 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8088 |
self addButton:aButton before:nil. |
1763 | 8089 |
^ aButton. |
162 | 8090 |
|
8091 |
"Created: 17.9.1995 / 20:17:26 / claus" |
|
8092 |
! |
|
8093 |
||
122 | 8094 |
addAbortButtonLabelled:buttonLabel |
8095 |
"create an abortButton with a label - to be sent from redefined initialize |
|
8096 |
methods in subclasses or when creating a box programmatically. |
|
8097 |
A nil argument creates one with the default label. |
|
8098 |
Returns the button." |
|
8099 |
||
162 | 8100 |
|aButton| |
8101 |
||
8102 |
aButton := Button abortButton. |
|
8103 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
8104 |
^ self addAbortButton:aButton |
|
8105 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8106 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8107 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8108 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8109 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8110 |
dialog addAbortButtonLabelled:'get out of here'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8111 |
dialog addOkButtonLabelled:'yes thats ok'. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8112 |
dialog open. |
655 | 8113 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8114 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8115 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8116 |
"Modified: 9.2.1996 / 22:09:40 / cg" |
120 | 8117 |
! |
76 | 8118 |
|
197 | 8119 |
addButton:aButton |
8120 |
"add a button into the buttonPanel. |
|
122 | 8121 |
Returns the button." |
120 | 8122 |
|
3050 | 8123 |
"/ ^ self addButton:aButton after:nil |
8124 |
(self class defaultOKButtonAtLeft) ifFalse:[ |
|
8125 |
^ self addButton:aButton before:nil |
|
8126 |
] ifTrue:[ |
|
8127 |
^ self addButton:aButton after:nil |
|
8128 |
]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8129 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8130 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8131 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8132 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8133 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8134 |
dialog addAbortButton. |
655 | 8135 |
dialog addButton:(Button label:'foo' action:[Transcript showCR:'foo']). |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8136 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8137 |
dialog open. |
655 | 8138 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8139 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8140 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8141 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8142 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8143 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8144 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8145 |
dialog addAbortButton. |
655 | 8146 |
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
|
8147 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8148 |
dialog open. |
655 | 8149 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8150 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8151 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8152 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8153 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8154 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8155 |
dialog := DialogBox new. |
655 | 8156 |
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
|
8157 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8158 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8159 |
dialog open. |
655 | 8160 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8161 |
" |
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 |
"Modified: 9.2.1996 / 22:14:17 / cg" |
197 | 8164 |
! |
8165 |
||
8166 |
addButton:aButton after:someOtherButtonOrNil |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8167 |
"add a button into the buttonPanel. |
197 | 8168 |
If the argument someOtherButtonOrNil is nil, the button is |
8169 |
added at the end." |
|
8170 |
||
8171 |
|h| |
|
8172 |
||
8173 |
buttonPanel addSubView:aButton after:someOtherButtonOrNil. |
|
8174 |
buttonPanel subViews size > 1 ifTrue:[ |
|
1843 | 8175 |
buttonPanel horizontalLayout:#fitSpace. |
197 | 8176 |
]. |
8177 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
|
1843 | 8178 |
buttonPanel topInset:h negated |
197 | 8179 |
]. |
5917 | 8180 |
preferredExtent := nil. |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8181 |
needResize := true. |
197 | 8182 |
^ aButton |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
8183 |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8184 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8185 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8186 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8187 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8188 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8189 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8190 |
dialog addButton:(Button |
1843 | 8191 |
label:'foo' |
8192 |
action:[dialog hide. Transcript showCR:'foo']) |
|
8193 |
after:(dialog okButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8194 |
dialog open. |
655 | 8195 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8196 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8197 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8198 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8199 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8200 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8201 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8202 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8203 |
dialog addButton:(Button |
1843 | 8204 |
label:'foo' |
8205 |
action:[dialog hide. Transcript showCR:'foo']) |
|
8206 |
after:(dialog abortButton). |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8207 |
dialog open. |
655 | 8208 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8209 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8210 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8211 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8212 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8213 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8214 |
dialog addAbortButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8215 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8216 |
dialog addButton:(Button |
1843 | 8217 |
label:'foo' |
8218 |
action:[dialog hide. Transcript showCR:'foo']) |
|
8219 |
after:nil. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8220 |
dialog open. |
655 | 8221 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8222 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8223 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8224 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
197 | 8225 |
! |
8226 |
||
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8227 |
addButton:aButton before:someOtherButtonOrNil |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8228 |
"add a button into the buttonPanel. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8229 |
If the argument someOtherButtonOrNil is nil, the button is |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8230 |
added upFront." |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8231 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8232 |
|h| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8233 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8234 |
buttonPanel addSubView:aButton before:someOtherButtonOrNil. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8235 |
buttonPanel subViews size > 1 ifTrue:[ |
1843 | 8236 |
buttonPanel horizontalLayout:#fitSpace. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8237 |
]. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8238 |
(h := (aButton heightIncludingBorder + (ViewSpacing * 2))) > buttonPanel topInset ifTrue:[ |
1843 | 8239 |
buttonPanel topInset:h negated |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8240 |
]. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
8241 |
preferredExtent := nil. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8242 |
needResize := true. |
4640 | 8243 |
shown ifTrue:[ aButton realize ]. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8244 |
^ aButton |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8245 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8246 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8247 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8248 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8249 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8250 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8251 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8252 |
dialog addButton:(Button |
1843 | 8253 |
label:'foo' |
8254 |
action:[dialog hide. Transcript showCR:'foo']) |
|
8255 |
before:(dialog okButton). |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8256 |
dialog open. |
655 | 8257 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8258 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8259 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8260 |
|dialog| |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8261 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8262 |
dialog := DialogBox new. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8263 |
dialog addAbortButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8264 |
dialog addOkButton. |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8265 |
dialog addButton:(Button |
1843 | 8266 |
label:'foo' |
8267 |
action:[dialog hide. Transcript showCR:'foo']) |
|
8268 |
before:nil. |
|
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8269 |
dialog open. |
655 | 8270 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
353
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8271 |
" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8272 |
|
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8273 |
"Modified: 9.2.1996 / 22:13:51 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8274 |
"Created: 10.2.1996 / 16:04:35 / cg" |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8275 |
! |
f93d08174b61
added #addHelpButton; added #addButton:before:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
8276 |
|
593 | 8277 |
addHelpButtonFor:pathToHelpText |
8278 |
"add a help button to the buttonPanel. |
|
8279 |
The argument, pathToHelpText should specify the path to the help |
|
8280 |
text under either the doc/online/<language> or the help/<language> |
|
8281 |
directory." |
|
8282 |
||
4220
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8283 |
^ self addHelpButtonWithAction:[HTMLDocumentView openFullOnHelpFile:pathToHelpText]. |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8284 |
|
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8285 |
" |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8286 |
|box| |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8287 |
|
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8288 |
box := DialogBox new. |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8289 |
box |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8290 |
addHelpButtonFor:'Launcher/compilerSettings.html'; |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8291 |
addAbortButton; |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8292 |
addOkButton. |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8293 |
|
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8294 |
box open |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8295 |
" |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8296 |
|
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8297 |
"Modified: / 09-09-1996 / 22:40:21 / stefan" |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8298 |
"Modified: / 26-01-2011 / 18:04:53 / cg" |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8299 |
! |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8300 |
|
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8301 |
addHelpButtonWithAction:helpAction |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8302 |
"add a help button to the buttonPanel. |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8303 |
The argument, helpAction is avaluated when clicked" |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8304 |
|
593 | 8305 |
|helpButton| |
8306 |
||
2478 | 8307 |
helpButton := Button label:(resources string:'Help'). |
593 | 8308 |
helpButton action:[ |
4220
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8309 |
self withWaitCursorDo:helpAction |
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
8310 |
]. |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8311 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8312 |
"/ changed: |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8313 |
"/ 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
|
8314 |
|
2698 | 8315 |
"/ (Dialog defaultOKButtonAtLeft) ifTrue:[ |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8316 |
"/ 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
|
8317 |
"/ ] ifFalse:[ |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8318 |
"/ 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
|
8319 |
"/ ]. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8320 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8321 |
self addButton:helpButton before:nil. |
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
8322 |
^ helpButton |
593 | 8323 |
|
8324 |
" |
|
8325 |
|box| |
|
8326 |
||
8327 |
box := DialogBox new. |
|
8328 |
box |
|
4220
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8329 |
addHelpButtonWithAction:[ Transcript flash ]; |
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
8330 |
addAbortButton; |
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
8331 |
addOkButton. |
593 | 8332 |
|
8333 |
box open |
|
8334 |
" |
|
8335 |
||
4220
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8336 |
"Modified: / 09-09-1996 / 22:40:21 / stefan" |
9d4156203a02
added: #addHelpButtonWithAction:
Claus Gittinger <cg@exept.de>
parents:
4219
diff
changeset
|
8337 |
"Created: / 26-01-2011 / 18:04:16 / cg" |
593 | 8338 |
! |
8339 |
||
2116 | 8340 |
addOK:checkBlock |
8341 |
|butt| |
|
8342 |
||
8343 |
butt := self addOkButton. |
|
8344 |
"/ what is checkBlock ? |
|
8345 |
^ butt |
|
8346 |
||
8347 |
"Modified: / 4.2.2000 / 00:09:15 / cg" |
|
8348 |
! |
|
8349 |
||
593 | 8350 |
addOkButton |
8351 |
"create an okButton - to be sent from redefined initialize |
|
8352 |
methods in subclasses or when creating a box programmatically. |
|
8353 |
Returns the button." |
|
8354 |
||
8355 |
^ self addOkButtonLabelled:nil |
|
8356 |
||
8357 |
" |
|
8358 |
|dialog| |
|
8359 |
||
8360 |
dialog := DialogBox new. |
|
8361 |
dialog addOkButton. |
|
8362 |
dialog open. |
|
655 | 8363 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 8364 |
" |
8365 |
||
8366 |
"Modified: 9.2.1996 / 21:37:02 / cg" |
|
8367 |
! |
|
8368 |
||
8369 |
addOkButton:aButton |
|
8370 |
"add an already created okButton - to be sent from redefined initialize |
|
8371 |
methods in subclasses or when creating a box programmatically. |
|
8372 |
Returns the button." |
|
8373 |
||
1764 | 8374 |
"/ okButton isNil ifTrue:[ |
8375 |
okButton := aButton. |
|
8376 |
"/ ]. |
|
593 | 8377 |
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
|
8378 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8379 |
"/ changed: |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8380 |
"/ 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
|
8381 |
|
2698 | 8382 |
"/ (Dialog defaultOKButtonAtLeft) ifTrue:[ |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8383 |
"/ 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
|
8384 |
"/ ] ifFalse:[ |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8385 |
"/ 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
|
8386 |
"/ ]. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8387 |
|
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
8388 |
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
|
8389 |
|
1760
631f902aaabe
care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents:
1759
diff
changeset
|
8390 |
^ aButton. |
593 | 8391 |
|
8392 |
" |
|
8393 |
|dialog b| |
|
8394 |
||
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2361
diff
changeset
|
8395 |
b := Button label:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedBy:0.5). |
593 | 8396 |
|
8397 |
dialog := DialogBox new. |
|
8398 |
dialog addOkButton:b. |
|
8399 |
dialog open. |
|
655 | 8400 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 8401 |
" |
8402 |
||
8403 |
"Modified: 17.9.1995 / 20:20:41 / claus" |
|
8404 |
"Modified: 9.2.1996 / 21:38:48 / cg" |
|
8405 |
! |
|
8406 |
||
8407 |
addOkButtonLabelled:buttonLabel |
|
8408 |
"create an okButton with a label - to be sent from redefined initialize |
|
8409 |
methods in subclasses or when creating a box programmatically. |
|
8410 |
A nil argument creates one with the default text. |
|
8411 |
Returns the button." |
|
8412 |
||
8413 |
|aButton| |
|
8414 |
||
8415 |
aButton := Button okButton. |
|
8416 |
buttonLabel notNil ifTrue:[aButton label:buttonLabel]. |
|
8417 |
aButton isReturnButton:acceptReturnAsOK. |
|
8418 |
^ self addOkButton:aButton. |
|
8419 |
||
8420 |
" |
|
8421 |
|dialog| |
|
8422 |
||
8423 |
dialog := DialogBox new. |
|
8424 |
dialog addOkButtonLabelled:'get out of here'. |
|
8425 |
dialog open. |
|
655 | 8426 |
dialog accepted ifTrue:[Transcript showCR:'yes']. |
593 | 8427 |
" |
8428 |
||
8429 |
"Modified: 9.2.1996 / 21:39:34 / cg" |
|
5011 | 8430 |
! |
8431 |
||
8432 |
removeAbortButton |
|
8433 |
"remove an already added okButton - only useful to change some already created |
|
8434 |
dialog afterwards" |
|
8435 |
||
8436 |
abortButton destroy |
|
8437 |
! |
|
8438 |
||
8439 |
removeOkButton |
|
8440 |
"remove an already added okButton - only useful to change some already created |
|
8441 |
dialog afterwards" |
|
8442 |
||
8443 |
okButton destroy |
|
593 | 8444 |
! ! |
8445 |
||
8446 |
!DialogBox methodsFor:'construction-check & comboboxes'! |
|
8447 |
||
197 | 8448 |
addCheckBox:label on:aModel |
8449 |
"create a checkBox with label on aModel and add it. |
|
8450 |
Returns the box." |
|
8451 |
||
8452 |
^ self addCheckBox:label on:aModel tabable:true |
|
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 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8455 |
|dialog check| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8456 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8457 |
check := true asValue. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8458 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8459 |
dialog := DialogBox new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8460 |
dialog addCheckBox:'on or off' on:check. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8461 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8462 |
dialog open. |
655 | 8463 |
dialog accepted ifTrue:[Transcript showCR:check value]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8464 |
" |
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 |
"Modified: 9.2.1996 / 22:15:38 / cg" |
197 | 8467 |
! |
8468 |
||
600 | 8469 |
addCheckBox:label on:aModel tabable:tabable |
8470 |
"create a checkBox with label on aModel and add it. |
|
8471 |
Returns the box." |
|
8472 |
||
8473 |
|b| |
|
8474 |
||
8475 |
b := CheckBox on:aModel. |
|
8476 |
b label:label. |
|
8477 |
self addComponent:b tabable:tabable. |
|
8478 |
^ b |
|
8479 |
||
8480 |
" |
|
8481 |
|dialog check1 check2 check3| |
|
8482 |
||
8483 |
check1 := true asValue. |
|
8484 |
check2 := false asValue. |
|
8485 |
check3 := true asValue. |
|
8486 |
||
8487 |
dialog := DialogBox new. |
|
8488 |
dialog addCheckBox:'on or off' on:check1 tabable:false. |
|
8489 |
dialog addHorizontalLine. |
|
8490 |
||
8491 |
dialog addCheckBox:'on or off' on:check2 tabable:true. |
|
8492 |
dialog addCheckBox:'on or off' on:check3 tabable:true. |
|
8493 |
dialog addOkButton. |
|
8494 |
dialog open. |
|
8495 |
" |
|
8496 |
||
8497 |
"Modified: 9.2.1996 / 22:16:49 / cg" |
|
8498 |
! |
|
8499 |
||
4380
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8500 |
addCheckBoxAtBottom:checkLabel on:aValueHolder |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8501 |
"add a checkbox and make it stick at the bottom" |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8502 |
|
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8503 |
|box| |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8504 |
|
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8505 |
box := here addCheckBox:checkLabel on:aValueHolder. |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8506 |
|
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8507 |
box layout:((0.0 @ 1.0 corner:1.0 @ 1.0) asLayout |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8508 |
topOffset:(buttonPanel preferredHeight |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8509 |
+ box preferredHeight |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8510 |
+ ViewSpacing ) negated; |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8511 |
bottomOffset:(buttonPanel preferredHeight |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8512 |
+ ViewSpacing ) negated). |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8513 |
^ box. |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8514 |
|
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8515 |
"Created: / 28-02-2012 / 09:03:22 / cg" |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8516 |
! |
d06865ef4fc9
added: #addCheckBoxAtBottom:on:
Claus Gittinger <cg@exept.de>
parents:
4357
diff
changeset
|
8517 |
|
593 | 8518 |
addComboBoxOn:aModel |
8519 |
"create a comboBoxView on aModel and add it. |
|
8520 |
Returns the comboBoxView." |
|
8521 |
||
8522 |
^ self addComboBoxOn:aModel tabable:true |
|
8523 |
||
8524 |
" |
|
8525 |
without a list, the comboBox is disabled: |
|
8526 |
||
8527 |
|box val| |
|
8528 |
||
8529 |
val := 'some input' asValue. |
|
8530 |
||
8531 |
box := Dialog new. |
|
8532 |
||
8533 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8534 |
box addVerticalSpace. |
|
8535 |
(box addComboBoxOn:val). |
|
8536 |
box addOkButton. |
|
8537 |
box open. |
|
8538 |
box accepted ifTrue:[ |
|
1401 | 8539 |
Transcript showCR:val value |
593 | 8540 |
]. |
8541 |
" |
|
8542 |
||
8543 |
"with a list, it can be pulled: |
|
8544 |
||
8545 |
|box val| |
|
8546 |
||
8547 |
val := '' asValue. |
|
8548 |
||
8549 |
box := Dialog new. |
|
8550 |
||
8551 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8552 |
box addVerticalSpace. |
|
8553 |
(box addComboBoxOn:val) list:#('one' 'two' 'three' 'four'). |
|
8554 |
box addOkButton. |
|
8555 |
box open. |
|
8556 |
box accepted ifTrue:[ |
|
1401 | 8557 |
Transcript showCR:val value |
593 | 8558 |
]. |
8559 |
" |
|
8560 |
||
8561 |
"Modified: 28.2.1996 / 15:17:39 / cg" |
|
8562 |
"Created: 4.3.1996 / 17:21:45 / cg" |
|
8563 |
! |
|
8564 |
||
5334 | 8565 |
addComboBoxOn:aModel list:list tabable:tabable |
8566 |
"create a comboBoxView on aModel and add it. |
|
8567 |
Returns the comboBoxView." |
|
8568 |
||
8569 |
^ (self addComboBoxOn:aModel tabable:tabable) list:list |
|
8570 |
||
8571 |
" |
|
8572 |
without a list, the comboBox is disabled: |
|
8573 |
||
8574 |
|box val| |
|
8575 |
||
8576 |
val := 'some input' asValue. |
|
8577 |
||
8578 |
box := Dialog new. |
|
8579 |
||
8580 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8581 |
box addVerticalSpace. |
|
8582 |
(box addComboBoxOn:val tabable:true). |
|
8583 |
box addOkButton. |
|
8584 |
box open. |
|
8585 |
box accepted ifTrue:[ |
|
8586 |
Transcript showCR:val value |
|
8587 |
]. |
|
8588 |
" |
|
8589 |
||
8590 |
"with a list, it can be pulled: |
|
8591 |
||
8592 |
|box val| |
|
8593 |
||
8594 |
val := '' asValue. |
|
8595 |
||
8596 |
box := Dialog new. |
|
8597 |
||
8598 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8599 |
box addVerticalSpace. |
|
8600 |
(box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
8601 |
box addOkButton. |
|
8602 |
box open. |
|
8603 |
box accepted ifTrue:[ |
|
8604 |
Transcript showCR:val value |
|
8605 |
]. |
|
8606 |
" |
|
8607 |
||
8608 |
"Modified: 4.3.1996 / 17:21:57 / cg" |
|
8609 |
! |
|
8610 |
||
593 | 8611 |
addComboBoxOn:aModel tabable:tabable |
8612 |
"create a comboBoxView on aModel and add it. |
|
8613 |
Returns the comboBoxView." |
|
8614 |
||
8615 |
|f| |
|
8616 |
||
8617 |
f := ComboBoxView new. |
|
8618 |
f model:aModel. |
|
8619 |
self addComponent:f tabable:tabable. |
|
8620 |
tabable ifTrue:[ |
|
1401 | 8621 |
self addToInputFieldGroup:f editor. |
593 | 8622 |
]. |
8623 |
^ f |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8624 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8625 |
" |
593 | 8626 |
without a list, the comboBox is disabled: |
8627 |
||
8628 |
|box val| |
|
8629 |
||
8630 |
val := 'some input' asValue. |
|
8631 |
||
8632 |
box := Dialog new. |
|
8633 |
||
8634 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8635 |
box addVerticalSpace. |
|
8636 |
(box addComboBoxOn:val tabable:true). |
|
8637 |
box addOkButton. |
|
8638 |
box open. |
|
8639 |
box accepted ifTrue:[ |
|
1401 | 8640 |
Transcript showCR:val value |
593 | 8641 |
]. |
8642 |
" |
|
8643 |
||
8644 |
"with a list, it can be pulled: |
|
8645 |
||
8646 |
|box val| |
|
8647 |
||
8648 |
val := '' asValue. |
|
8649 |
||
8650 |
box := Dialog new. |
|
8651 |
||
8652 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8653 |
box addVerticalSpace. |
|
8654 |
(box addComboBoxOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
8655 |
box addOkButton. |
|
8656 |
box open. |
|
8657 |
box accepted ifTrue:[ |
|
1401 | 8658 |
Transcript showCR:val value |
593 | 8659 |
]. |
8660 |
" |
|
8661 |
||
8662 |
"Modified: 4.3.1996 / 17:21:57 / cg" |
|
8663 |
! |
|
8664 |
||
8665 |
addComboListOn:aModel |
|
8666 |
"create a comboListView on aModel and add it. |
|
8667 |
Returns the comboListView." |
|
8668 |
||
8669 |
^ self addComboListOn:aModel tabable:true |
|
8670 |
||
8671 |
"without a list, the comboList is disabled: |
|
8672 |
||
8673 |
|box val| |
|
8674 |
||
8675 |
val := 'some input' asValue. |
|
8676 |
||
8677 |
box := Dialog new. |
|
8678 |
||
8679 |
(box addTextLabel:'combo list example') adjust:#left. |
|
8680 |
box addVerticalSpace. |
|
8681 |
(box addComboListOn:val). |
|
8682 |
box addOkButton. |
|
8683 |
box open. |
|
8684 |
box accepted ifTrue:[ |
|
1401 | 8685 |
Transcript showCR:val value |
593 | 8686 |
]. |
8687 |
" |
|
8688 |
||
8689 |
"with a list, it can be pulled: |
|
8690 |
||
8691 |
|box val| |
|
8692 |
||
8693 |
val := '' asValue. |
|
8694 |
||
8695 |
box := Dialog new. |
|
8696 |
||
8697 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8698 |
box addVerticalSpace. |
|
8699 |
(box addComboListOn:val) list:#('one' 'two' 'three' 'four'). |
|
8700 |
box addOkButton. |
|
8701 |
box open. |
|
8702 |
box accepted ifTrue:[ |
|
1401 | 8703 |
Transcript showCR:val value |
593 | 8704 |
]. |
8705 |
" |
|
8706 |
||
8707 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
8708 |
"Modified: 4.3.1996 / 17:22:59 / cg" |
|
8709 |
! |
|
8710 |
||
4653 | 8711 |
addComboListOn:aModel list:list tabable:tabable |
8712 |
"create a comboListView on aModel and add it. |
|
8713 |
Returns the comboListView." |
|
8714 |
||
8715 |
^ (self addComboListOn:aModel tabable:tabable) list:list |
|
8716 |
||
8717 |
" |
|
8718 |
|box val| |
|
8719 |
||
8720 |
val := '' asValue. |
|
8721 |
||
8722 |
box := Dialog new. |
|
8723 |
||
8724 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8725 |
box addVerticalSpace. |
|
8726 |
(box addComboListOn:val list:#('one' 'two' 'three' 'four') tabable:true). |
|
8727 |
box addOkButton. |
|
8728 |
box open. |
|
8729 |
box accepted ifTrue:[ |
|
8730 |
Transcript showCR:val value |
|
8731 |
]. |
|
8732 |
" |
|
8733 |
! |
|
8734 |
||
593 | 8735 |
addComboListOn:aModel tabable:tabable |
8736 |
"create a comboListView on aModel and add it. |
|
8737 |
Returns the comboListView." |
|
8738 |
||
8739 |
|f| |
|
8740 |
||
8741 |
f := ComboListView new. |
|
8742 |
f model:aModel. |
|
8743 |
self addComponent:f tabable:tabable. |
|
8744 |
^ f |
|
8745 |
||
8746 |
"without a list, the comboList is disabled: |
|
8747 |
||
8748 |
|box val| |
|
8749 |
||
8750 |
val := 'some input' asValue. |
|
8751 |
||
8752 |
box := Dialog new. |
|
8753 |
||
8754 |
(box addTextLabel:'combo list example') adjust:#left. |
|
8755 |
box addVerticalSpace. |
|
8756 |
(box addComboListOn:val tabable:true). |
|
8757 |
box addOkButton. |
|
8758 |
box open. |
|
8759 |
box accepted ifTrue:[ |
|
1401 | 8760 |
Transcript showCR:val value |
593 | 8761 |
]. |
8762 |
" |
|
8763 |
||
8764 |
"with a list, it can be pulled: |
|
8765 |
||
8766 |
|box val| |
|
8767 |
||
8768 |
val := '' asValue. |
|
8769 |
||
8770 |
box := Dialog new. |
|
8771 |
||
8772 |
(box addTextLabel:'combo box example') adjust:#left. |
|
8773 |
box addVerticalSpace. |
|
8774 |
(box addComboListOn:val tabable:true) list:#('one' 'two' 'three' 'four'). |
|
8775 |
box addOkButton. |
|
8776 |
box open. |
|
8777 |
box accepted ifTrue:[ |
|
1401 | 8778 |
Transcript showCR:val value |
593 | 8779 |
]. |
8780 |
" |
|
8781 |
||
8782 |
"Created: 28.2.1996 / 15:16:34 / cg" |
|
8783 |
"Modified: 4.3.1996 / 17:23:38 / cg" |
|
4777 | 8784 |
! |
8785 |
||
8786 |
addTriggerBox:label action:aBlock |
|
8787 |
"create a triggerBox with label and action and add it. |
|
8788 |
Returns the box." |
|
8789 |
||
8790 |
|b| |
|
8791 |
||
8792 |
b := TriggerBox new action:aBlock. |
|
8793 |
b label:label. |
|
8794 |
self addComponent:b tabable:false. |
|
8795 |
^ b |
|
8796 |
||
8797 |
" |
|
8798 |
|dialog trigger1 trigger2 trigger3| |
|
8799 |
||
8800 |
trigger1 := true asValue. |
|
8801 |
trigger2 := false asValue. |
|
8802 |
trigger3 := true asValue. |
|
8803 |
||
8804 |
dialog := DialogBox new. |
|
8805 |
dialog addTriggerBox:'go' action:[Transcript showCR:'1']. |
|
8806 |
dialog addHorizontalLine. |
|
8807 |
||
8808 |
dialog addTriggerBox:'go go' action:[Transcript showCR:'2']. |
|
8809 |
dialog addTriggerBox:'trigger' action:[Transcript showCR:'3']. |
|
8810 |
dialog addOkButton. |
|
8811 |
dialog open. |
|
8812 |
" |
|
8813 |
||
8814 |
"Modified: 9.2.1996 / 22:16:49 / cg" |
|
593 | 8815 |
! ! |
8816 |
||
8817 |
!DialogBox methodsFor:'construction-inputfields'! |
|
8818 |
||
8819 |
addFilenameInputFieldOn:aModel in:aDirectory tabable:tabable |
|
8820 |
"create a fileName input field on aModel and add it. |
|
8821 |
Returns the field. This is much like a normal input field, |
|
8822 |
but supports filename completion." |
|
8823 |
||
8824 |
|f| |
|
8825 |
||
8826 |
f := FilenameEditField new. |
|
8827 |
aDirectory notNil ifTrue:[f directory:aDirectory]. |
|
8828 |
f model:aModel. |
|
8829 |
self addInputField:f tabable:tabable. |
|
8830 |
^ f |
|
8831 |
! |
|
8832 |
||
8833 |
addInputField:aField |
|
8834 |
"add an already created input field. |
|
8835 |
Returns the field." |
|
8836 |
||
8837 |
^ self addInputField:aField tabable:true |
|
8838 |
||
8839 |
"Modified: 9.2.1996 / 20:46:16 / cg" |
|
8840 |
! |
|
8841 |
||
8842 |
addInputField:aField tabable:tabable |
|
8843 |
"add an already created input field. |
|
8844 |
If tabable is true, the field is put into a group, to allow |
|
8845 |
stepping through the fields with #Cursor/#Return keys. |
|
8846 |
Returns the field." |
|
8847 |
||
8848 |
self addComponent:aField tabable:tabable. |
|
8849 |
tabable ifTrue:[ |
|
1401 | 8850 |
self addToInputFieldGroup:aField. |
593 | 8851 |
]. |
8852 |
^ aField |
|
8853 |
||
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
8854 |
"Modified: 31.5.1996 / 21:22:29 / cg" |
593 | 8855 |
! |
8856 |
||
8857 |
addInputFieldOn:aModel |
|
8858 |
"create an input field on aModel and add it. |
|
8859 |
Returns the field." |
|
8860 |
||
8861 |
^ self addInputFieldOn:aModel tabable:true |
|
8862 |
||
8863 |
" |
|
8864 |
|dialog model field| |
|
8865 |
||
8866 |
model := '' asValue. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8867 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
8868 |
dialog := DialogBox new. |
593 | 8869 |
(dialog addTextLabel:'enter a string') adjust:#left. |
8870 |
||
8871 |
field := dialog addInputFieldOn:model. |
|
8872 |
||
8873 |
dialog addAbortButton; addOkButton. |
|
8874 |
dialog open. |
|
655 | 8875 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 8876 |
" |
8877 |
||
8878 |
"Modified: 9.2.1996 / 21:34:14 / cg" |
|
8879 |
! |
|
8880 |
||
8881 |
addInputFieldOn:aModel tabable:tabable |
|
8882 |
"create an input field on aModel and add it. |
|
8883 |
If tabable is false, the field cannot be tabbed into |
|
8884 |
and return does not close the box. |
|
8885 |
(pointer must be moved into it). |
|
8886 |
Returns the field." |
|
8887 |
||
8888 |
|f| |
|
8889 |
||
913 | 8890 |
f := EditField model:aModel. |
593 | 8891 |
self addInputField:f tabable:tabable. |
8892 |
^ f |
|
8893 |
||
8894 |
" a non-tabable field: |
|
8895 |
||
8896 |
|dialog model field| |
|
8897 |
||
8898 |
model := '' asValue. |
|
8899 |
||
8900 |
dialog := DialogBox new. |
|
8901 |
(dialog addTextLabel:'enter a string') adjust:#left. |
|
8902 |
||
8903 |
field := dialog addInputFieldOn:model tabable:false. |
|
8904 |
||
8905 |
dialog addAbortButton; addOkButton. |
|
8906 |
dialog open. |
|
655 | 8907 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 8908 |
" |
8909 |
||
8910 |
"Modified: 9.2.1996 / 21:36:16 / cg" |
|
913 | 8911 |
"Modified: 3.1.1997 / 10:24:04 / stefan" |
593 | 8912 |
! |
8913 |
||
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8914 |
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
|
8915 |
"add a label and an inputField side-by-side. |
5242 | 8916 |
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
8917 |
The label's string is defined by labelString and adjusted according to labelAdjust. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8918 |
The inputField gets model as its model. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8919 |
Return the inputField." |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8920 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8921 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8922 |
^ self |
5242 | 8923 |
addLabelledField:(EditField on:model) label:labelString |
8924 |
adjust:labelAdjust |
|
8925 |
tabable:tabable |
|
8926 |
from:leftX to:rightX |
|
8927 |
separateAtX:relativeX. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8928 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8929 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8930 |
|dialog model field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8931 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8932 |
model := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8933 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8934 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8935 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8936 |
field := dialog |
5242 | 8937 |
addLabelledInputField:'enter a string' |
8938 |
adjust:#left |
|
8939 |
on:model |
|
8940 |
tabable:true |
|
8941 |
separateAtX:0.3. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8942 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8943 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8944 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8945 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8946 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8947 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8948 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8949 |
|dialog model1 model2 field| |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8950 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8951 |
model1 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8952 |
model2 := '' asValue. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8953 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8954 |
dialog := DialogBox new. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8955 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8956 |
dialog addTextLabel:'a two-input box'. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8957 |
dialog addHorizontalLine. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8958 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8959 |
field := dialog |
5242 | 8960 |
addLabelledInputField:'string1:' |
8961 |
adjust:#right |
|
8962 |
on:model1 |
|
8963 |
tabable:true |
|
8964 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8965 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8966 |
field := dialog |
5242 | 8967 |
addLabelledInputField:'string2:' |
8968 |
adjust:#right |
|
8969 |
on:model2 |
|
8970 |
tabable:true |
|
8971 |
separateAtX:0.4. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8972 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8973 |
dialog addAbortButton; addOkButton. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8974 |
dialog open. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8975 |
dialog accepted ifTrue:[ |
5242 | 8976 |
Transcript showCR:model1 value. |
8977 |
Transcript showCR:model2 value. |
|
745
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8978 |
]. |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8979 |
" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8980 |
|
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8981 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8982 |
"Created: 3.6.1996 / 11:04:23 / cg" |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8983 |
! |
9838e65744d0
allow partial-labelled inputFields
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
8984 |
|
593 | 8985 |
addLabelledInputField:labelString adjust:labelAdjust on:model tabable:tabable separateAtX:relativeX |
8986 |
"add a label and an inputField side-by-side. |
|
5242 | 8987 |
The label goes from 0.0 to relativeX; the inputField from relativeX to 1.0. |
8988 |
The label's string is defined by labelString and adjusted according to labelAdjust. |
|
593 | 8989 |
The inputField gets model as its model. |
8990 |
Return the inputField." |
|
8991 |
||
8992 |
||
8993 |
^ self |
|
5242 | 8994 |
addLabelledField:(EditField on:model) label:labelString |
8995 |
adjust:labelAdjust |
|
8996 |
tabable:tabable |
|
8997 |
separateAtX:relativeX. |
|
593 | 8998 |
|
8999 |
" |
|
9000 |
|dialog model field| |
|
9001 |
||
9002 |
model := '' asValue. |
|
9003 |
||
9004 |
dialog := DialogBox new. |
|
9005 |
||
9006 |
field := dialog |
|
5242 | 9007 |
addLabelledInputField:'enter a string' |
9008 |
adjust:#left |
|
9009 |
on:model |
|
9010 |
tabable:true |
|
9011 |
separateAtX:0.3. |
|
593 | 9012 |
|
9013 |
dialog addAbortButton; addOkButton. |
|
9014 |
dialog open. |
|
655 | 9015 |
dialog accepted ifTrue:[Transcript showCR:model value]. |
593 | 9016 |
" |
9017 |
||
9018 |
" |
|
9019 |
|dialog model1 model2 field| |
|
9020 |
||
9021 |
model1 := '' asValue. |
|
9022 |
model2 := '' asValue. |
|
9023 |
||
9024 |
dialog := DialogBox new. |
|
9025 |
||
9026 |
dialog addTextLabel:'a two-input box'. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9027 |
dialog addHorizontalLine. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9028 |
|
593 | 9029 |
field := dialog |
5242 | 9030 |
addLabelledInputField:'string1:' |
9031 |
adjust:#right |
|
9032 |
on:model1 |
|
9033 |
tabable:true |
|
9034 |
separateAtX:0.4. |
|
593 | 9035 |
|
9036 |
field := dialog |
|
5242 | 9037 |
addLabelledInputField:'string2:' |
9038 |
adjust:#right |
|
9039 |
on:model2 |
|
9040 |
tabable:true |
|
9041 |
separateAtX:0.4. |
|
593 | 9042 |
|
9043 |
dialog addAbortButton; addOkButton. |
|
9044 |
dialog open. |
|
9045 |
dialog accepted ifTrue:[ |
|
5242 | 9046 |
Transcript showCR:model1 value. |
9047 |
Transcript showCR:model2 value. |
|
593 | 9048 |
]. |
9049 |
" |
|
9050 |
||
9051 |
"Created: 13.4.1996 / 13:41:31 / cg" |
|
9052 |
"Modified: 19.4.1996 / 17:39:46 / cg" |
|
9053 |
! ! |
|
9054 |
||
9055 |
!DialogBox methodsFor:'construction-layout'! |
|
9056 |
||
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
9057 |
addGap |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
9058 |
"VW compatibility" |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
9059 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
9060 |
self addGap:4 |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
9061 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
9062 |
|
2116 | 9063 |
addGap:pixels |
9064 |
"VW compatibility" |
|
9065 |
||
9066 |
self addVerticalSpace:pixels |
|
9067 |
||
9068 |
"Created: / 4.2.2000 / 00:03:58 / cg" |
|
9069 |
"Modified: / 5.2.2000 / 15:30:26 / cg" |
|
9070 |
! |
|
9071 |
||
593 | 9072 |
addHorizontalLine |
9073 |
"add a horizontal line as separator" |
|
9074 |
||
9075 |
^ self addComponent:(Separator new extent:1.0 @ 5). |
|
9076 |
||
9077 |
" |
|
9078 |
|dialog| |
|
9079 |
||
9080 |
dialog := DialogBox new. |
|
9081 |
dialog |
|
1401 | 9082 |
addTextLabel:'some title string'; |
9083 |
addHorizontalLine; |
|
9084 |
addTextLabel:'more text'; |
|
9085 |
addOkButton; |
|
9086 |
open. |
|
593 | 9087 |
" |
9088 |
||
9089 |
" |
|
9090 |
|dialog| |
|
9091 |
||
9092 |
dialog := DialogBox new. |
|
9093 |
dialog |
|
1401 | 9094 |
addTextLabel:'some title string'; |
9095 |
addHorizontalLine; |
|
9096 |
addTextLabel:'more text'. |
|
593 | 9097 |
(dialog addHorizontalLine) width:20. |
9098 |
dialog addTextLabel:'more text'. |
|
9099 |
(dialog addHorizontalLine) width:20. |
|
9100 |
dialog |
|
1401 | 9101 |
addTextLabel:'more text'; |
9102 |
addHorizontalLine; |
|
9103 |
addOkButton; |
|
9104 |
open. |
|
593 | 9105 |
" |
9106 |
||
9107 |
"Modified: 19.4.1996 / 15:11:30 / cg" |
|
9108 |
! |
|
9109 |
||
9110 |
addVerticalSpace |
|
9111 |
"add a default vertical space (1 mm)" |
|
9112 |
||
9113 |
self addVerticalSpace:(ViewSpacing). |
|
9114 |
||
9115 |
" |
|
9116 |
|dialog| |
|
9117 |
||
9118 |
dialog := DialogBox new. |
|
9119 |
dialog addTextLabel:'some title string'. |
|
9120 |
dialog addVerticalSpace. |
|
9121 |
dialog addTextLabel:'more text'. |
|
9122 |
||
9123 |
dialog addOkButton. |
|
9124 |
dialog open. |
|
9125 |
" |
|
9126 |
||
9127 |
"Modified: 9.2.1996 / 21:41:10 / cg" |
|
9128 |
! |
|
9129 |
||
9130 |
addVerticalSpace:nPixel |
|
9131 |
"add some pixels of space to the next component" |
|
9132 |
||
9133 |
yPosition := yPosition + nPixel. |
|
9134 |
needResize := true. |
|
9135 |
||
9136 |
" |
|
9137 |
|dialog| |
|
9138 |
||
9139 |
dialog := DialogBox new. |
|
9140 |
dialog addTextLabel:'some title string'. |
|
9141 |
dialog addVerticalSpace:50. |
|
9142 |
dialog addTextLabel:'more text'. |
|
9143 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9144 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9145 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9146 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9147 |
|
593 | 9148 |
"Modified: 9.2.1996 / 21:41:23 / cg" |
9149 |
! ! |
|
9150 |
||
9151 |
!DialogBox methodsFor:'construction-lists'! |
|
9152 |
||
2116 | 9153 |
addList:listHolder lines:nLines validation:validateionBlock |
9154 |
^ self |
|
9155 |
addListBoxOn:listHolder |
|
9156 |
withNumberOfLines:nLines |
|
9157 |
hScrollable:true |
|
9158 |
vScrollable:true |
|
9159 |
||
9160 |
"Created: / 4.2.2000 / 00:04:49 / cg" |
|
9161 |
"Modified: / 4.2.2000 / 00:06:06 / cg" |
|
9162 |
! |
|
9163 |
||
593 | 9164 |
addListBoxOn:aModel |
9165 |
"add a selectionInListView to the box. |
|
9166 |
The listViews ScrollWrapper is returned" |
|
9167 |
||
9168 |
^ self |
|
1401 | 9169 |
addListBoxOn:aModel |
9170 |
withNumberOfLines:nil |
|
9171 |
hScrollable:false |
|
9172 |
vScrollable:true. |
|
593 | 9173 |
|
9174 |
" |
|
9175 |
|dialog model listView| |
|
9176 |
||
9177 |
model := SelectionInList new. |
|
9178 |
model list:#('one' 'two' 'three' 'four'). |
|
9179 |
model selectionIndex:2. |
|
9180 |
||
9181 |
dialog := DialogBox new. |
|
9182 |
(dialog addTextLabel:'select any') adjust:#left. |
|
9183 |
||
9184 |
listView := dialog addListBoxOn:model. |
|
9185 |
||
9186 |
dialog addAbortButton; addOkButton. |
|
9187 |
dialog open. |
|
9188 |
||
655 | 9189 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 9190 |
" |
9191 |
||
9192 |
"Modified: 27.4.1996 / 18:27:58 / cg" |
|
9193 |
! |
|
9194 |
||
9195 |
addListBoxOn:aModel class:aListViewClass |
|
9196 |
"create & add an instance of aListViewClass to the box. |
|
9197 |
The listViews ScrollWrapper is returned" |
|
9198 |
||
9199 |
^ self |
|
1401 | 9200 |
addListBoxOn:aModel |
9201 |
class:aListViewClass |
|
9202 |
withNumberOfLines:nil |
|
9203 |
hScrollable:false |
|
9204 |
vScrollable:true. |
|
593 | 9205 |
|
9206 |
"Created: 19.4.1996 / 13:06:14 / cg" |
|
9207 |
"Modified: 27.4.1996 / 18:27:53 / cg" |
|
9208 |
! |
|
9209 |
||
9210 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines |
|
9211 |
"create and add an instance of aListViewClass to the box. |
|
9212 |
The list has numLines (if nonNil) number of lines shown. |
|
9213 |
The listViews ScrollWrapper is returned" |
|
9214 |
||
9215 |
^ self |
|
1401 | 9216 |
addListBoxOn:aModel |
9217 |
class:aListViewClass |
|
9218 |
withNumberOfLines:numLines |
|
9219 |
hScrollable:false |
|
9220 |
vScrollable:true. |
|
593 | 9221 |
|
9222 |
"Created: 19.4.1996 / 13:05:05 / cg" |
|
9223 |
"Modified: 27.4.1996 / 18:27:48 / cg" |
|
9224 |
! |
|
9225 |
||
9226 |
addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
766 | 9227 |
"add an instance of aListViewClass (selectionInListView) to the box. |
593 | 9228 |
The list has numLines (if nonNil) number of lines shown. |
9229 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
9230 |
||
766 | 9231 |
|l| |
9232 |
||
9233 |
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
|
9234 |
(aListViewClass canUnderstand:#doubleClickAction:) ifTrue:[ |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
9235 |
l doubleClickAction:[:name | self okPressed]. |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
9236 |
]. |
766 | 9237 |
^ l |
593 | 9238 |
|
9239 |
" |
|
9240 |
|dialog listView| |
|
9241 |
||
9242 |
dialog := DialogBox new. |
|
9243 |
(dialog addTextLabel:'select any') adjust:#left. |
|
9244 |
||
9245 |
listView := dialog |
|
3812
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
9246 |
addListBoxOn:nil |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
9247 |
class:FileSelectionList |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
9248 |
withNumberOfLines:10 |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
9249 |
hScrollable:false |
712b5b68c378
changed #addListBoxOn:class:withNumberOfLines:hScrollable:vScrollable:
Stefan Vogel <sv@exept.de>
parents:
3809
diff
changeset
|
9250 |
vScrollable:false. |
593 | 9251 |
|
9252 |
listView directory:'/etc'. |
|
9253 |
||
9254 |
dialog addAbortButton; addOkButton. |
|
9255 |
dialog open. |
|
9256 |
||
655 | 9257 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView selectionValue]. |
593 | 9258 |
" |
9259 |
||
9260 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
9261 |
"Modified: 27.4.1996 / 18:26:15 / cg" |
|
766 | 9262 |
"Modified: 15.6.1996 / 00:31:20 / stefan" |
593 | 9263 |
! |
9264 |
||
9265 |
addListBoxOn:aModel withNumberOfLines:numLines |
|
9266 |
"add a selectionInListView to the box. |
|
9267 |
The list has numLines (if nonNil) number of lines shown. |
|
9268 |
The listViews ScrollWrapper is returned" |
|
9269 |
||
9270 |
^ self |
|
1401 | 9271 |
addListBoxOn:aModel |
9272 |
withNumberOfLines:numLines |
|
9273 |
hScrollable:false |
|
9274 |
vScrollable:true. |
|
593 | 9275 |
|
9276 |
" |
|
9277 |
|dialog model listView| |
|
9278 |
||
9279 |
model := SelectionInList new. |
|
9280 |
model list:#('one' 'two' 'three' 'four'). |
|
9281 |
model selectionIndex:2. |
|
9282 |
||
9283 |
dialog := DialogBox new. |
|
9284 |
(dialog addTextLabel:'select any') adjust:#left. |
|
9285 |
||
9286 |
listView := dialog addListBoxOn:model withNumberOfLines:3. |
|
9287 |
||
9288 |
dialog addAbortButton; addOkButton. |
|
9289 |
dialog open. |
|
9290 |
||
655 | 9291 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 9292 |
" |
9293 |
||
9294 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
9295 |
"Modified: 27.4.1996 / 18:27:42 / cg" |
|
9296 |
! |
|
9297 |
||
9298 |
addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
9299 |
"add a selectionInListView to the box. |
|
9300 |
The list has numLines (if nonNil) number of lines shown. |
|
9301 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
9302 |
||
9303 |
^ self |
|
1401 | 9304 |
addListBoxOn:aModel |
9305 |
class:SelectionInListView |
|
9306 |
withNumberOfLines:numLines |
|
9307 |
hScrollable:hs |
|
9308 |
vScrollable:vs |
|
593 | 9309 |
|
9310 |
" |
|
9311 |
|dialog model listView| |
|
9312 |
||
9313 |
model := SelectionInList new. |
|
9314 |
model list:#('one' 'two' 'three' 'four'). |
|
9315 |
model selectionIndex:2. |
|
9316 |
||
9317 |
dialog := DialogBox new. |
|
9318 |
(dialog addTextLabel:'select any') adjust:#left. |
|
9319 |
||
9320 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true. |
|
9321 |
||
9322 |
dialog addAbortButton; addOkButton. |
|
9323 |
dialog open. |
|
9324 |
||
655 | 9325 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 9326 |
" |
9327 |
||
9328 |
" |
|
9329 |
|dialog model listView| |
|
9330 |
||
9331 |
model := SelectionInList new. |
|
9332 |
model list:#('one' 'two' 'three' 'four'). |
|
9333 |
model selectionIndex:2. |
|
9334 |
||
9335 |
dialog := DialogBox new. |
|
9336 |
(dialog addTextLabel:'select any') adjust:#left. |
|
9337 |
||
9338 |
listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false. |
|
9339 |
||
9340 |
dialog addAbortButton; addOkButton. |
|
9341 |
dialog open. |
|
9342 |
||
655 | 9343 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:model selection]. |
593 | 9344 |
" |
9345 |
||
9346 |
"Created: 22.2.1996 / 15:40:07 / cg" |
|
9347 |
"Modified: 27.4.1996 / 18:26:36 / cg" |
|
9348 |
! |
|
9349 |
||
9350 |
addPopUpList:labelString on:aModel |
|
9351 |
"create a popUpList with a label on aModel and add it. |
|
9352 |
Returns the box." |
|
9353 |
||
9354 |
^ self addPopUpList:labelString on:aModel tabable:true |
|
9355 |
! |
|
9356 |
||
9357 |
addPopUpList:labelString on:aModel tabable:tabable |
|
9358 |
"create a popUpList on aModel and add it. |
|
9359 |
Returns the popUpList." |
|
9360 |
||
9361 |
|p box l| |
|
9362 |
||
9363 |
p := PopUpList on:aModel. |
|
9364 |
p resize; sizeFixed:true. |
|
9365 |
labelString notNil ifTrue:[ |
|
1401 | 9366 |
box := HorizontalPanelView new. |
9367 |
box borderWidth:0; horizontalLayout:#rightSpace. |
|
9368 |
box add:(l := Label label:labelString). |
|
9369 |
l borderWidth:0. |
|
9370 |
box add:p. |
|
593 | 9371 |
] ifFalse:[ |
1401 | 9372 |
box := p. |
593 | 9373 |
]. |
9374 |
self addComponent:box tabable:tabable tabbedComponent:p. |
|
9375 |
^ p |
|
735
2552463a8f34
place popUp at right (without extra space)
Claus Gittinger <cg@exept.de>
parents:
719
diff
changeset
|
9376 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9377 |
"Modified: 31.5.1996 / 21:25:17 / cg" |
593 | 9378 |
! |
9379 |
||
9380 |
addPopUpListOn:aModel |
|
9381 |
"create a popUpList on aModel and add it. |
|
9382 |
Returns the box." |
|
9383 |
||
9384 |
^ self addPopUpList:nil on:aModel tabable:true |
|
9385 |
! |
|
9386 |
||
9387 |
addPopUpListOn:aModel tabable:tabable |
|
9388 |
"create a popUpList on aModel and add it. |
|
9389 |
Returns the popUpList." |
|
9390 |
||
9391 |
^ self addPopUpList:nil on:aModel tabable:tabable |
|
766 | 9392 |
! |
9393 |
||
4293
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9394 |
addRadioButton:labelString on:aRadioButtonGroupModel value:radioValue tabable:tabable |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9395 |
"create a radio button on aModel and add it. |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9396 |
Returns the radio button." |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9397 |
|
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9398 |
|r| |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9399 |
|
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9400 |
r := RadioButton label:labelString. |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9401 |
aRadioButtonGroupModel add:r value:radioValue. |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9402 |
|
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9403 |
self addComponent:r tabable:tabable. |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9404 |
^ r |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9405 |
|
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9406 |
"Created: / 23-07-2011 / 17:28:08 / cg" |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9407 |
! |
05baa387d4a1
added: #addRadioButton:on:value:tabable:
Claus Gittinger <cg@exept.de>
parents:
4227
diff
changeset
|
9408 |
|
766 | 9409 |
addTextBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
9410 |
"add an instance of aListViewClass to the box. |
|
9411 |
The list has numLines (if nonNil) number of lines shown. |
|
9412 |
If scrolled, the ScrollWrapper is returned - otherwise the listView." |
|
9413 |
||
9414 |
|l scr h dH| |
|
9415 |
||
9416 |
l := aListViewClass new. |
|
9417 |
l model:aModel. |
|
9418 |
||
877 | 9419 |
(vs or:[hs]) ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9420 |
hs ifTrue:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9421 |
scr := HVScrollableView forView:l miniScrollerH:true . |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9422 |
] ifFalse:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9423 |
scr := ScrollableView forView:l |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9424 |
]. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9425 |
scr resize. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9426 |
"/ Transcript show:scr height; show:' '; showCR:l height. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9427 |
dH := scr height - l height. |
766 | 9428 |
] ifFalse:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9429 |
l level:-1. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9430 |
scr := l. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9431 |
dH := 0. |
766 | 9432 |
]. |
9433 |
||
9434 |
numLines notNil ifTrue:[ |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9435 |
h := l heightForLines:numLines. |
766 | 9436 |
] ifFalse:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9437 |
h := l preferredHeight |
766 | 9438 |
]. |
9439 |
self addComponent:scr withHeight:(h + dH). |
|
9440 |
^ scr |
|
9441 |
||
9442 |
" |
|
9443 |
|dialog listView| |
|
9444 |
||
9445 |
dialog := DialogBox new. |
|
9446 |
(dialog addTextLabel:'select any') adjust:#left. |
|
9447 |
||
9448 |
listView := dialog |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9449 |
addTextBoxOn:nil |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9450 |
class:EditTextView |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9451 |
withNumberOfLines:10 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9452 |
hScrollable:true |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9453 |
vScrollable:true. |
766 | 9454 |
|
9455 |
||
9456 |
dialog addAbortButton; addOkButton. |
|
9457 |
dialog open. |
|
9458 |
||
9459 |
dialog accepted ifTrue:[Transcript show:'selection is:'; showCR:listView contents]. |
|
9460 |
" |
|
9461 |
||
9462 |
"Created: 14.6.1996 / 23:33:47 / stefan" |
|
877 | 9463 |
"Modified: 8.11.1996 / 15:31:15 / cg" |
593 | 9464 |
! ! |
9465 |
||
9466 |
!DialogBox methodsFor:'construction-rows & columns'! |
|
9467 |
||
130 | 9468 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock |
9469 |
"add some elements in a vertical column. |
|
9470 |
Equally space elements as returned from aBlock." |
|
9471 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9472 |
self |
1401 | 9473 |
addColumn:aRow |
9474 |
fromX:leftX toX:rightX |
|
9475 |
collect:aBlock |
|
9476 |
tabable:false |
|
130 | 9477 |
|
9478 |
" |
|
9479 |
|dialog| |
|
9480 |
||
9481 |
dialog := Dialog new. |
|
9482 |
dialog |
|
1401 | 9483 |
addColumn:#('label1' 'label2' 'lbl3' 'l4' 'label5') |
9484 |
fromX:0.0 |
|
9485 |
toX:1.0 |
|
9486 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9487 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9488 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9489 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9490 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9491 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9492 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9493 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9494 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9495 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9496 |
dialog |
1401 | 9497 |
addColumn:#('label1' 'label2' 'label3' 'label4' 'label5') |
9498 |
fromX:0.25 |
|
9499 |
toX:0.75 |
|
9500 |
collect:[:label | (Label label:label) adjust:#left]. |
|
130 | 9501 |
|
9502 |
dialog addOkButton. |
|
9503 |
dialog open. |
|
9504 |
" |
|
9505 |
||
9506 |
" |
|
9507 |
|dialog y| |
|
9508 |
||
9509 |
dialog := Dialog new. |
|
9510 |
y := dialog yPosition. |
|
9511 |
dialog |
|
1401 | 9512 |
addColumn:#('a1' 'b1' 'c1' 'd1') |
9513 |
fromX:0 |
|
9514 |
toX:(1/3) |
|
9515 |
collect:[:label | Label label:label]. |
|
130 | 9516 |
|
9517 |
dialog yPosition:y. |
|
9518 |
dialog |
|
1401 | 9519 |
addColumn:#('a2' 'b2' 'c2' 'd2') |
9520 |
fromX:(1/3) |
|
9521 |
toX:(2/3) |
|
9522 |
collect:[:label | Label label:label]. |
|
130 | 9523 |
|
9524 |
dialog yPosition:y. |
|
9525 |
dialog |
|
1401 | 9526 |
addColumn:#('a3' 'b3' 'c3' 'd3') |
9527 |
fromX:(2/3) |
|
9528 |
toX:1 |
|
9529 |
collect:[:label | Label label:label]. |
|
130 | 9530 |
|
9531 |
dialog addOkButton. |
|
9532 |
dialog open. |
|
9533 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9534 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9535 |
"Modified: 9.2.1996 / 22:22:12 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9536 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9537 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9538 |
addColumn:aRow fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9539 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9540 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9541 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9542 |
self |
1401 | 9543 |
addColumn:aRow |
9544 |
fromX:leftX toX:rightX |
|
9545 |
collect:aBlock |
|
9546 |
tabable:tabable |
|
9547 |
horizontalLayout:#fitSpace |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9548 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9549 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9550 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9551 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9552 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9553 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9554 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9555 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9556 |
dialog |
1401 | 9557 |
addColumn:#('one' 'two' 'three' 'four') |
9558 |
fromX:0 |
|
9559 |
toX:0.3 |
|
9560 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9561 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9562 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9563 |
dialog |
1401 | 9564 |
addColumn:values |
9565 |
fromX:0.3 |
|
9566 |
toX:1.0 |
|
9567 |
collect:[:value | EditField on:value] |
|
9568 |
tabable:true. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9569 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9570 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9571 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9572 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9573 |
dialog accepted ifTrue:[ |
1401 | 9574 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9575 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9576 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9577 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9578 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9579 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9580 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9581 |
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
|
9582 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9583 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9584 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9585 |
dialog |
1401 | 9586 |
addColumn:(1 to:4) |
9587 |
fromX:0 |
|
9588 |
toX:0.5 |
|
9589 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
9590 |
tabable:true |
|
9591 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9592 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9593 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9594 |
dialog |
1401 | 9595 |
addColumn:(5 to:8) |
9596 |
fromX:0.5 |
|
9597 |
toX:1.0 |
|
9598 |
collect:[:idx | CheckToggle on:(values at:idx)] |
|
9599 |
tabable:true |
|
9600 |
horizontalLayout:#center. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9601 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9602 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9603 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9604 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9605 |
dialog accepted ifTrue:[ |
1401 | 9606 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9607 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9608 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9609 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9610 |
"Created: 9.2.1996 / 21:51:47 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9611 |
"Modified: 9.2.1996 / 22:22:02 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9612 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9613 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9614 |
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
|
9615 |
"add some elements in a vertical column. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9616 |
Equally space elements as returned from aBlock." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9617 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9618 |
|helper component| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9619 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9620 |
helper := VerticalPanelView new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9621 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9622 |
aRow do:[:el | |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9623 |
component := aBlock value:el. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9624 |
helper add:component. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9625 |
component resize. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9626 |
tabable ifTrue:[self makeTabable:component]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9627 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9628 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9629 |
helper resize. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9630 |
self addComponent:helper. |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9631 |
width < helper preferredWidth ifTrue:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9632 |
self width:helper preferredWidth. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9633 |
"/ Transcript show:'w now: '; showCR:helper preferredExtent x |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9634 |
]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9635 |
helper horizontalLayout:hLayout. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9636 |
helper left:leftX asFloat; |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9637 |
right:rightX asFloat; |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9638 |
leftInset:leftIndent; |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9639 |
rightInset:rightIndent. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9640 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9641 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9642 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9643 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9644 |
values := (1 to:4) collect:[:dummy | '' asValue]. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9645 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9646 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9647 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9648 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9649 |
addColumn:#('one' 'two' 'three' 'four') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9650 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9651 |
toX:0.3 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9652 |
collect:[:label | Label label:label]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9653 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9654 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9655 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9656 |
addColumn:values |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9657 |
fromX:0.3 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9658 |
toX:1.0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9659 |
collect:[:value | EditField on:value] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9660 |
tabable:true. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9661 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9662 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9663 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9664 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9665 |
dialog accepted ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9666 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9667 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9668 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9669 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9670 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9671 |
|dialog y values| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9672 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9673 |
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
|
9674 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9675 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9676 |
y := dialog yPosition. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9677 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9678 |
addColumn:(1 to:4) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9679 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9680 |
toX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9681 |
collect:[:idx | CheckToggle on:(values at:idx)]. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9682 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9683 |
dialog yPosition:y. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9684 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9685 |
addColumn:(5 to:8) |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9686 |
fromX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9687 |
toX:1.0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9688 |
collect:[:idx | CheckToggle on:(values at:idx)] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9689 |
tabable:true. |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9690 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9691 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9692 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9693 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9694 |
dialog accepted ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9695 |
Transcript showCR:(values collect:[:holder | holder value]) |
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9696 |
] |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9697 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9698 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9699 |
"Modified: 9.2.1996 / 22:02:22 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9700 |
"Created: 9.2.1996 / 22:20:31 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9701 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9702 |
|
130 | 9703 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock |
9704 |
"add some elements in a horizontal row. |
|
9705 |
Equally space elements as returned from aBlock. |
|
9706 |
Advance y." |
|
9707 |
||
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9708 |
self |
1401 | 9709 |
addRow:aCol |
9710 |
fromX:leftX toX:rightX |
|
9711 |
collect:aBlock |
|
9712 |
tabable:true |
|
9713 |
horizontalLayout:#spread |
|
130 | 9714 |
|
9715 |
" |
|
9716 |
|dialog| |
|
9717 |
||
9718 |
dialog := Dialog new. |
|
9719 |
dialog |
|
1401 | 9720 |
addRow:#('a' 'b' 'c' 'd') |
9721 |
fromX:0 |
|
9722 |
toX:1 |
|
9723 |
collect:[:label | Label label:label]. |
|
130 | 9724 |
|
9725 |
dialog addOkButton. |
|
9726 |
dialog open. |
|
9727 |
" |
|
9728 |
||
9729 |
" |
|
9730 |
|dialog| |
|
9731 |
||
9732 |
dialog := Dialog new. |
|
9733 |
dialog |
|
1401 | 9734 |
addRow:#('a1' 'b1' 'c1' 'd1') |
9735 |
fromX:0 |
|
9736 |
toX:1 |
|
9737 |
collect:[:label | Label label:label]. |
|
130 | 9738 |
|
9739 |
dialog |
|
1401 | 9740 |
addRow:#('a2' 'b2' 'c2' 'd2') |
9741 |
fromX:0 |
|
9742 |
toX:0.5 |
|
9743 |
collect:[:label | Label label:label]. |
|
130 | 9744 |
|
9745 |
dialog |
|
1401 | 9746 |
addRow:#('a3' 'b3' 'c3' 'd3') |
9747 |
fromX:0.5 |
|
9748 |
toX:1 |
|
9749 |
collect:[:label | Label label:label]. |
|
130 | 9750 |
|
9751 |
dialog addOkButton. |
|
9752 |
dialog open. |
|
9753 |
" |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9754 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9755 |
"Modified: 9.2.1996 / 22:25:16 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9756 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9757 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9758 |
addRow:aCol fromX:leftX toX:rightX collect:aBlock tabable:tabable |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9759 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9760 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9761 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9762 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9763 |
self |
1401 | 9764 |
addRow:aCol |
9765 |
fromX:leftX toX:rightX |
|
9766 |
collect:aBlock |
|
9767 |
tabable:tabable |
|
9768 |
horizontalLayout:#spread |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9769 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9770 |
"Created: 9.2.1996 / 22:25:35 / cg" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9771 |
! |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9772 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9773 |
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
|
9774 |
"add some elements in a horizontal row. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9775 |
Equally space elements as returned from aBlock. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9776 |
Advance y." |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9777 |
|
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9778 |
^ self |
1401 | 9779 |
addRow:aCol |
9780 |
fromX:leftX toX:rightX |
|
9781 |
collect:aBlock |
|
9782 |
tabable:tabable |
|
9783 |
horizontalLayout:hLayout |
|
9784 |
verticalLayout:#fit |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9785 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9786 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9787 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9788 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9789 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9790 |
dialog |
1401 | 9791 |
addRow:#('a' 'b' 'c' 'd') |
9792 |
fromX:0 |
|
9793 |
toX:1 |
|
9794 |
collect:[:label | Label label:label] |
|
9795 |
tabable:false |
|
9796 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9797 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9798 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9799 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9800 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9801 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9802 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9803 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9804 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9805 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9806 |
dialog |
1401 | 9807 |
addRow:#('one' 'two' 'three' 'four') |
9808 |
fromX:0 |
|
9809 |
toX:1 |
|
9810 |
collect:[:label | Button label:label] |
|
9811 |
tabable:false |
|
9812 |
horizontalLayout:#fit. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9813 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9814 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9815 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9816 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9817 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9818 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9819 |
|dialog| |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9820 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9821 |
dialog := Dialog new. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9822 |
dialog |
1401 | 9823 |
addRow:#('a1' 'b1' 'c1' 'd1') |
9824 |
fromX:0 |
|
9825 |
toX:1 |
|
9826 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9827 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9828 |
dialog |
1401 | 9829 |
addRow:#('a2' 'b2' 'c2' 'd2') |
9830 |
fromX:0 |
|
9831 |
toX:0.5 |
|
9832 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9833 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9834 |
dialog |
1401 | 9835 |
addRow:#('a3' 'b3' 'c3' 'd3') |
9836 |
fromX:0.5 |
|
9837 |
toX:1 |
|
9838 |
collect:[:label | Label label:label]. |
|
344
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9839 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9840 |
dialog addOkButton. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9841 |
dialog open. |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9842 |
" |
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9843 |
|
f0532d8a40f8
more examples; added #addComboBox
Claus Gittinger <cg@exept.de>
parents:
314
diff
changeset
|
9844 |
"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
|
9845 |
"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
|
9846 |
! |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9847 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9848 |
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
|
9849 |
"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
|
9850 |
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
|
9851 |
Advance y." |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9852 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9853 |
|helper component| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9854 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9855 |
helper := HorizontalPanelView new. |
792 | 9856 |
helper borderWidth:0. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9857 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9858 |
aCol do:[:el | |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9859 |
component := aBlock value:el. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9860 |
component resize. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9861 |
helper add:component. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9862 |
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
|
9863 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9864 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9865 |
helper resize. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9866 |
self addComponent:helper. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9867 |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9868 |
width < helper preferredWidth ifTrue:[ |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9869 |
self width:helper preferredWidth. |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9870 |
"/ 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
|
9871 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9872 |
hLayout notNil ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9873 |
helper horizontalLayout:hLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9874 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9875 |
vLayout notNil ifTrue:[ |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9876 |
helper verticalLayout:vLayout. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9877 |
]. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9878 |
helper left:leftX asFloat; |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9879 |
right:rightX asFloat. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9880 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9881 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9882 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9883 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9884 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9885 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9886 |
addRow:#('a' 'b' 'c' 'd') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9887 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9888 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9889 |
collect:[:label | Label label:label] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9890 |
tabable:false |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9891 |
horizontalLayout:#fit. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9892 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9893 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9894 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9895 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9896 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9897 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9898 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9899 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9900 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9901 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9902 |
addRow:#('one' 'two' 'three' 'four') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9903 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9904 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9905 |
collect:[:label | Button label:label] |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9906 |
tabable:false |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9907 |
horizontalLayout:#fit. |
739
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9908 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9909 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9910 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9911 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9912 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9913 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9914 |
|dialog| |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9915 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9916 |
dialog := Dialog new. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9917 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9918 |
addRow:#('a1' 'b1' 'c1' 'd1') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9919 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9920 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9921 |
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
|
9922 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9923 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9924 |
addRow:#('a2' 'b2' 'c2' 'd2') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9925 |
fromX:0 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9926 |
toX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9927 |
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
|
9928 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9929 |
dialog |
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9930 |
addRow:#('a3' 'b3' 'c3' 'd3') |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9931 |
fromX:0.5 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9932 |
toX:1 |
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
9933 |
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
|
9934 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9935 |
dialog addOkButton. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9936 |
dialog open. |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9937 |
" |
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9938 |
|
67e04c0c38a7
fixed focus stuff (dont include hidden views in returned focusList)
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
9939 |
"Created: 31.5.1996 / 20:45:31 / cg" |
792 | 9940 |
"Modified: 17.7.1996 / 12:06:08 / cg" |
76 | 9941 |
! ! |
9942 |
||
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
9943 |
!DialogBox methodsFor:'explicit focus control'! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
9944 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
9945 |
focusOnOk |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
9946 |
windowGroup focusView:okButton |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
9947 |
|
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
9948 |
"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
|
9949 |
! ! |
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
9950 |
|
4227 | 9951 |
!DialogBox methodsFor:'initialization & release'! |
76 | 9952 |
|
9953 |
initialize |
|
6080 | 9954 |
<modifier: #super> "must be called if redefined" |
9955 |
||
76 | 9956 |
super initialize. |
9957 |
||
573 | 9958 |
"/ label := 'Dialog'. |
948 | 9959 |
acceptValue := ValueHolder newBoolean. |
76 | 9960 |
|
9961 |
acceptReturnAsOK := true. |
|
125 | 9962 |
acceptOnLeave := true. |
1757 | 9963 |
focusToOKOnLeave := DefaultFocusToOKOnLeave. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
9964 |
hideOnAccept := true. |
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
9965 |
autoAccept := true. |
76 | 9966 |
|
9967 |
buttonPanel := HorizontalPanelView in:self. |
|
5917 | 9968 |
buttonPanel |
1757 | 9969 |
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
|
9970 |
bottomInset:ViewSpacing; |
5917 | 9971 |
topInset:((gc font height + (ViewSpacing*2)) + ViewSpacing) negated; |
1757 | 9972 |
borderWidth:0; |
9973 |
horizontalLayout:#spread. |
|
118 | 9974 |
|
5627 | 9975 |
buttonPanel rightInset:(device extentOfResizeHandle x). |
2304
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
9976 |
"/ 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
|
9977 |
buttonPanel reverseOrderIfOKAtLeft:true. |
c96b6b899023
button-roder reversal is now done exclusively in the buttonPanel
Claus Gittinger <cg@exept.de>
parents:
2299
diff
changeset
|
9978 |
|
122 | 9979 |
yPosition := ViewSpacing. |
312
008267b920d9
allow more control over the indent when adding components
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
9980 |
leftIndent := rightIndent := (ViewSpacing // 2). |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
9981 |
needResize := true. |
76 | 9982 |
|
9983 |
" |
|
9984 |
|b| |
|
9985 |
b := DialogBox new. |
|
118 | 9986 |
b addAbortButton; |
9987 |
addOkButton; |
|
9988 |
showAtPointer |
|
76 | 9989 |
" |
9990 |
" |
|
9991 |
|b| |
|
9992 |
b := DialogBox new. |
|
118 | 9993 |
b addOkButton; |
9994 |
showAtPointer |
|
9995 |
" |
|
76 | 9996 |
" |
118 | 9997 |
|b| |
9998 |
b := DialogBox new. |
|
9999 |
b addTextLabel:'hello world'; |
|
10000 |
addOkButton; |
|
10001 |
showAtPointer |
|
10002 |
" |
|
10003 |
" |
|
10004 |
|b| |
|
10005 |
b := DialogBox new. |
|
10006 |
b addTextLabel:'hello world'; |
|
10007 |
addVerticalSpace:50; |
|
10008 |
addOkButton; |
|
10009 |
showAtPointer |
|
10010 |
" |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10011 |
|
6080 | 10012 |
"Modified: / 23-12-1997 / 10:05:24 / md" |
10013 |
"Modified: / 08-02-2017 / 00:26:26 / cg" |
|
76 | 10014 |
! |
10015 |
||
10016 |
reAdjustGeometry |
|
10017 |
"sent late in snapin processing - gives me a chance |
|
10018 |
to resize for changed font dimensions." |
|
10019 |
||
10020 |
super reAdjustGeometry. |
|
10021 |
okButton notNil ifTrue:[okButton resize]. |
|
10022 |
abortButton notNil ifTrue:[abortButton resize]. |
|
10023 |
self resize |
|
10024 |
! ! |
|
10025 |
||
4671 | 10026 |
!DialogBox methodsFor:'layout control'! |
10027 |
||
10028 |
bottomAlign:widgets |
|
10029 |
"mhmh - seems similar to our stickAtBottom functionality - to be checked" |
|
10030 |
||
10031 |
'DialogBox [warning]: unimplemented VW feature: #bottomAlign' infoPrintCR. |
|
10032 |
"/ self halt:'unimplemented VW functionality'. |
|
10033 |
||
10034 |
"Created: / 4.2.2000 / 00:10:21 / cg" |
|
10035 |
"Modified: / 5.2.2000 / 15:31:23 / cg" |
|
10036 |
! |
|
10037 |
||
10038 |
bottomAlignLowerEdge:widget |
|
10039 |
"mhmh - seems similar to our stickAtBottom functionality - to be checked" |
|
10040 |
||
10041 |
"/ self halt:'unimplemented VW functionality'. |
|
10042 |
self stickAtBottomWithVariableHeight:widget |
|
10043 |
||
10044 |
"Modified: / 5.2.2000 / 15:31:15 / cg" |
|
10045 |
! |
|
10046 |
||
10047 |
leftIndent |
|
10048 |
"return the current indent |
|
5876 | 10049 |
(current x position - that's where the next component will be positioned)." |
4671 | 10050 |
|
10051 |
^ leftIndent |
|
10052 |
||
10053 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
10054 |
! |
|
10055 |
||
10056 |
leftIndent:aNumber |
|
10057 |
"set the left indent |
|
10058 |
(current x position - that's where the next component(s) will be located). |
|
10059 |
Setting this before adding a component will place it indented" |
|
10060 |
||
10061 |
leftIndent := aNumber. |
|
10062 |
needResize := true. |
|
10063 |
||
10064 |
" |
|
10065 |
|dialog| |
|
10066 |
||
10067 |
dialog := DialogBox new. |
|
10068 |
(dialog addTextLabel:'label1') adjust:#left. |
|
10069 |
dialog leftIndent:20. |
|
10070 |
(dialog addTextLabel:'label2') adjust:#left. |
|
10071 |
dialog leftIndent:40. |
|
10072 |
(dialog addTextLabel:'label3') adjust:#left. |
|
10073 |
dialog leftIndent:60. |
|
10074 |
(dialog addTextLabel:'label4') adjust:#left. |
|
10075 |
||
10076 |
dialog addOkButton. |
|
10077 |
dialog open. |
|
10078 |
" |
|
10079 |
||
10080 |
"Modified: 9.2.1996 / 21:42:20 / cg" |
|
10081 |
! |
|
10082 |
||
10083 |
rightIndent |
|
10084 |
"return the current right indent." |
|
10085 |
||
10086 |
^ rightIndent |
|
10087 |
||
10088 |
"Modified: 27.1.1996 / 18:21:31 / cg" |
|
10089 |
! |
|
10090 |
||
10091 |
rightIndent:aNumber |
|
10092 |
"set the right indent" |
|
10093 |
||
10094 |
rightIndent := aNumber. |
|
10095 |
needResize := true. |
|
10096 |
||
10097 |
" |
|
10098 |
|dialog| |
|
10099 |
||
10100 |
dialog := DialogBox new. |
|
10101 |
(dialog addTextLabel:'label1') adjust:#right. |
|
10102 |
dialog rightIndent:20. |
|
10103 |
(dialog addTextLabel:'label2') adjust:#right. |
|
10104 |
dialog rightIndent:40. |
|
10105 |
(dialog addTextLabel:'label3') adjust:#right. |
|
10106 |
dialog rightIndent:60. |
|
10107 |
(dialog addTextLabel:'label4') adjust:#right. |
|
10108 |
||
10109 |
dialog addOkButton. |
|
10110 |
dialog open. |
|
10111 |
" |
|
10112 |
||
10113 |
"Modified: 9.2.1996 / 21:42:46 / cg" |
|
10114 |
! |
|
10115 |
||
10116 |
setInitialGap |
|
10117 |
||
10118 |
"Created: / 4.2.2000 / 00:01:44 / cg" |
|
10119 |
! |
|
10120 |
||
10121 |
stickAtBottomWithFixHeight:aComponent |
|
10122 |
"arrange for a component to be positioned at a constant offset |
|
10123 |
from the bottom of the box and its height to remain the same. |
|
10124 |
This will keep the component at a constant distance from the bottom |
|
10125 |
(without this setup, it would stay at a constant offset from the top). |
|
10126 |
ATTENTION: use this as a last step, after all components have been added." |
|
10127 |
||
10128 |
self stickAtBottomWithFixHeight:aComponent left:0.0 right:1.0 |
|
10129 |
||
10130 |
" |
|
10131 |
compare the resizing behavior of: |
|
10132 |
||
10133 |
|box| |
|
10134 |
||
10135 |
box := Dialog new. |
|
10136 |
box addTextLabel:'hello'. |
|
10137 |
box addTextLabel:'hello2'. |
|
10138 |
box addOkButton. |
|
10139 |
box show |
|
10140 |
||
10141 |
with: |
|
10142 |
||
10143 |
|box l2| |
|
10144 |
||
10145 |
box := Dialog new. |
|
10146 |
box addTextLabel:'hello'. |
|
10147 |
l2 := box addTextLabel:'hello2'. |
|
10148 |
box addOkButton. |
|
10149 |
box stickAtBottomWithFixHeight:l2. |
|
10150 |
box show |
|
10151 |
" |
|
10152 |
||
10153 |
"Created: / 27.1.1996 / 17:17:41 / cg" |
|
10154 |
"Modified: / 18.8.2000 / 21:38:21 / cg" |
|
10155 |
! |
|
10156 |
||
10157 |
stickAtBottomWithFixHeight:aComponent left:left right:right |
|
10158 |
"arrange for a component to be positioned at a constant offset |
|
10159 |
from the bottom of the box and its height to remain the same. |
|
10160 |
This will keep the component at a constant distance from the bottom |
|
10161 |
(without this setup, it would stay at a constant offset from the top). |
|
10162 |
ATTENTION: use this as a last step, after all components have been added." |
|
10163 |
||
10164 |
self resize. |
|
10165 |
||
10166 |
aComponent |
|
10167 |
topInset:(self height - aComponent top) negated; |
|
10168 |
bottomInset:(self height - aComponent bottom); |
|
10169 |
origin:left @ 1.0; corner:right @ 1.0. |
|
10170 |
||
10171 |
" |
|
10172 |
compare the resizing behavior of: |
|
10173 |
||
10174 |
|box| |
|
10175 |
||
10176 |
box := Dialog new. |
|
10177 |
box addTextLabel:'hello'. |
|
10178 |
box addTextLabel:'hello2'. |
|
10179 |
box addOkButton. |
|
10180 |
box show |
|
10181 |
||
10182 |
with: |
|
10183 |
||
10184 |
|box l2| |
|
10185 |
||
10186 |
box := Dialog new. |
|
10187 |
box addTextLabel:'hello'. |
|
10188 |
l2 := box addTextLabel:'hello2'. |
|
10189 |
box addOkButton. |
|
10190 |
box stickAtBottomWithFixHeight:l2. |
|
10191 |
box show |
|
10192 |
" |
|
10193 |
||
10194 |
"Created: / 27.1.1996 / 17:17:41 / cg" |
|
10195 |
"Modified: / 18.8.2000 / 21:38:26 / cg" |
|
10196 |
! |
|
10197 |
||
10198 |
stickAtBottomWithVariableHeight:aComponent |
|
10199 |
"arrange for a component to be positioned at a constant offset |
|
10200 |
from the bottom of the box and its height to be adjusted. |
|
10201 |
This will resize the component for a constant distance from the top, |
|
10202 |
and the bottom. |
|
10203 |
(without this setup, its height would remain constant). |
|
10204 |
ATTENTION: use this as a last step, after all components have been added." |
|
10205 |
||
10206 |
self resize. |
|
10207 |
||
10208 |
aComponent |
|
10209 |
bottomInset:(self height - aComponent bottom); |
|
10210 |
corner:1.0@1.0. |
|
10211 |
||
10212 |
" |
|
10213 |
compare the resizing behavior of: |
|
10214 |
||
10215 |
|box| |
|
10216 |
||
10217 |
box := Dialog new. |
|
10218 |
box addTextLabel:'hello'. |
|
10219 |
(box addComponent:(SelectionInListView new)) level:-1. |
|
10220 |
box addOkButton. |
|
10221 |
box show |
|
10222 |
||
10223 |
with: |
|
10224 |
||
10225 |
|box list| |
|
10226 |
||
10227 |
box := Dialog new. |
|
10228 |
box addTextLabel:'hello'. |
|
10229 |
list := (box addComponent:(SelectionInListView new)) level:-1. |
|
10230 |
box addOkButton. |
|
10231 |
box stickAtBottomWithVariableHeight:list. |
|
10232 |
box show |
|
10233 |
" |
|
10234 |
||
10235 |
"Modified: / 18.8.2000 / 21:38:35 / cg" |
|
10236 |
! |
|
10237 |
||
10238 |
yPosition |
|
5876 | 10239 |
"return the current y position |
10240 |
(that's where the next component will be positioned)." |
|
4671 | 10241 |
|
10242 |
^ yPosition |
|
10243 |
! |
|
10244 |
||
10245 |
yPosition:aNumber |
|
5876 | 10246 |
"set the current y position |
10247 |
(that's where the next component will be positioned)." |
|
4671 | 10248 |
|
10249 |
yPosition := aNumber. |
|
10250 |
needResize := true. |
|
10251 |
||
10252 |
" |
|
10253 |
|dialog pos| |
|
10254 |
||
10255 |
dialog := DialogBox new. |
|
10256 |
pos := dialog yPosition. |
|
10257 |
(dialog addTextLabel:'label1') width:0.5. |
|
10258 |
dialog yPosition:pos. |
|
10259 |
(dialog addTextLabel:'label2') width:0.5; left:0.5. |
|
10260 |
||
10261 |
dialog addOkButton. |
|
10262 |
dialog open. |
|
10263 |
" |
|
10264 |
||
10265 |
" |
|
10266 |
|dialog pos| |
|
10267 |
||
10268 |
dialog := DialogBox new. |
|
10269 |
pos := dialog yPosition. |
|
10270 |
#('one' 'two' 'three' 'four') |
|
10271 |
with:#(0.0 0.25 0.5 0.75) do:[:lbl :x | |
|
5876 | 10272 |
dialog yPosition:pos. |
10273 |
(dialog addComponent:(Button label:lbl) tabable:true) |
|
10274 |
width:0.25; left:x. |
|
4671 | 10275 |
]. |
10276 |
||
10277 |
dialog addOkButton. |
|
10278 |
dialog open. |
|
10279 |
" |
|
10280 |
||
10281 |
"Modified: 9.2.1996 / 21:46:40 / cg" |
|
10282 |
! ! |
|
10283 |
||
197 | 10284 |
!DialogBox methodsFor:'private'! |
10285 |
||
5281 | 10286 |
assignKeyboardFocusToFirstKeyboardConsumer |
10287 |
|field| |
|
10288 |
||
10289 |
(inputFieldGroup notNil |
|
10290 |
and:[(field := inputFieldGroup currentField) notNil |
|
10291 |
and:[field shown]]) ifTrue:[ |
|
10292 |
self assignKeyboardFocusTo:field. |
|
10293 |
^ self "/ disabled - the focus might have already been changed |
|
10294 |
"/ explicitly to another field |
|
10295 |
]. |
|
10296 |
^ super assignKeyboardFocusToFirstKeyboardConsumer |
|
10297 |
! |
|
10298 |
||
197 | 10299 |
basicAddComponent:aComponent |
5591 | 10300 |
"add a component, don't change its size" |
197 | 10301 |
|
10302 |
addedComponents isNil ifTrue:[ |
|
2126 | 10303 |
addedComponents := OrderedCollection new. |
197 | 10304 |
]. |
10305 |
addedComponents add:aComponent. |
|
10306 |
self addSubView:aComponent. |
|
3932
fa0f5fcfc64b
changed: #basicAddComponent:
Claus Gittinger <cg@exept.de>
parents:
3908
diff
changeset
|
10307 |
|
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10308 |
needResize := true. |
3932
fa0f5fcfc64b
changed: #basicAddComponent:
Claus Gittinger <cg@exept.de>
parents:
3908
diff
changeset
|
10309 |
"/ 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
|
10310 |
preferredExtent := nil. |
197 | 10311 |
! |
10312 |
||
6037 | 10313 |
forceResize |
10314 |
"force a recomputation of my size. |
|
10315 |
Cann this, when elements where added to a subcomponent, |
|
10316 |
of which I cannot know. |
|
10317 |
Eg. when someone gets the buttonPanel and adds an element to it" |
|
10318 |
||
10319 |
needResize := true. |
|
10320 |
self resize |
|
10321 |
! |
|
10322 |
||
197 | 10323 |
hideAndEvaluate:aBlock |
10324 |
"if I am modal, make myself invisible and evaluate aBlock. |
|
10325 |
If nonModal, stay up, but also evaluate the block." |
|
10326 |
||
10327 |
(windowGroup notNil and:[windowGroup isModal]) ifTrue:[ |
|
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10328 |
self hide. |
197 | 10329 |
]. |
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10330 |
aBlock notNil ifTrue:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10331 |
aBlock numArgs == 0 ifTrue:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10332 |
aBlock value |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10333 |
] ifFalse:[ |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10334 |
aBlock value:(self actionArgument) |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10335 |
] |
2673
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
10336 |
]. |
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
10337 |
|
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
10338 |
(windowGroup isNil or:[windowGroup isModal not]) ifTrue:[ |
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
10339 |
self destroy. |
f7fe71653801
hideAndEvaluate - also support modeless operation
Claus Gittinger <cg@exept.de>
parents:
2672
diff
changeset
|
10340 |
]. |
197 | 10341 |
|
10342 |
"Modified: 5.9.1995 / 19:06:33 / claus" |
|
10343 |
! |
|
10344 |
||
2116 | 10345 |
preOpen |
10346 |
||
10347 |
"Created: / 4.2.2000 / 00:10:48 / cg" |
|
10348 |
! |
|
10349 |
||
197 | 10350 |
realize |
10351 |
"if any inputFields where added, activate the first one" |
|
10352 |
||
3944
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
10353 |
verticalPanel notNil ifTrue:[ |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
10354 |
verticalPanel extent:verticalPanel preferredExtent. |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
10355 |
preferredExtent := nil. |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
10356 |
self extent:(self preferredExtent). |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
10357 |
]. |
d5ed8d618608
yPosition fixes when adding components in the aboutToOpen hook.
Claus Gittinger <cg@exept.de>
parents:
3935
diff
changeset
|
10358 |
|
1877
a46bf520f9c6
realize first, then assign focus
Claus Gittinger <cg@exept.de>
parents:
1843
diff
changeset
|
10359 |
super realize. |
3467 | 10360 |
|
10361 |
buttonPanel notNil ifTrue:[ |
|
4384
cd3a12b6fbf1
comment/format in: #verticalPanel
Claus Gittinger <cg@exept.de>
parents:
4380
diff
changeset
|
10362 |
buttonPanel raise. |
3467 | 10363 |
buttonPanel subViews do:[:eachButton | |
10364 |
eachButton canTab:true. |
|
10365 |
] |
|
10366 |
]. |
|
10367 |
||
197 | 10368 |
inputFieldGroup notNil ifTrue:[ |
1646 | 10369 |
inputFieldGroup activateFirstIfNoCurrent |
197 | 10370 |
]. |
1646 | 10371 |
|
4384
cd3a12b6fbf1
comment/format in: #verticalPanel
Claus Gittinger <cg@exept.de>
parents:
4380
diff
changeset
|
10372 |
"Modified: / 28-02-2012 / 15:54:10 / cg" |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10373 |
! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10374 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10375 |
resize |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10376 |
needResize ifTrue:[ |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10377 |
"/ verticalPanel notNil ifTrue:[ |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10378 |
"/ verticalPanel extent:verticalPanel preferredExtent. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10379 |
"/ preferredExtent := nil. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10380 |
"/ self extent:(self preferredExtent). |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10381 |
"/ ]. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10382 |
needResize := false. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10383 |
super resize |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10384 |
] |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10385 |
|
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10386 |
"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
|
10387 |
"Modified: 27.1.1996 / 18:25:40 / cg" |
197 | 10388 |
! ! |
10389 |
||
120 | 10390 |
!DialogBox methodsFor:'queries'! |
118 | 10391 |
|
121 | 10392 |
accepted |
128 | 10393 |
"after the box has closed: |
10394 |
return true if accepted, false if canceled" |
|
125 | 10395 |
|
128 | 10396 |
^ acceptValue value |
121 | 10397 |
! |
10398 |
||
2116 | 10399 |
interfaceSpecFor:aSelector |
10400 |
"return an interface spec. |
|
10401 |
Notice - Dialog should be moved under AppModel so this becomes obsolete." |
|
10402 |
||
2379
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
10403 |
^ UISpecification from:(self specificationFor:aSelector) |
2116 | 10404 |
! |
10405 |
||
2803
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10406 |
maxPreferredWidthOfAddedComponents |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10407 |
"helper for computing my preferred extent. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10408 |
That is the max component width" |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10409 |
|
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10410 |
^ (addedComponents ? #()) |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10411 |
inject:0 |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10412 |
into:[:max :element | |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10413 |
|eExt prefWidth scale rel relX| |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10414 |
|
3612
1b624feb1ece
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3584
diff
changeset
|
10415 |
prefWidth := element preferredWidth. |
2803
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10416 |
|
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10417 |
"/ special (for your convenience) |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10418 |
"/ 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
|
10419 |
"/ 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
|
10420 |
|
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10421 |
(rel := element relativeExtent) notNil ifTrue:[ |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10422 |
relX := rel x. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10423 |
(relX isNil or:[relX isInteger]) ifFalse:[ |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10424 |
prefWidth := (prefWidth * (1 / relX)) rounded |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10425 |
]. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10426 |
]. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10427 |
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
|
10428 |
max max:(eExt + element leftInset + element rightInset)]. |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10429 |
! |
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10430 |
|
120 | 10431 |
positionOffset |
10432 |
"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
|
10433 |
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
|
10434 |
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
|
10435 |
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
|
10436 |
use my superclasses offset." |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
10437 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
10438 |
|idx butt buttons| |
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
10439 |
|
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
10440 |
buttonPanel notNil ifTrue:[ |
2332 | 10441 |
buttons := buttonPanel subViews. |
10442 |
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
|
10443 |
idx := buttons findFirst:[:b | b isDefault]. |
2332 | 10444 |
idx ~~ 0 ifTrue:[ |
10445 |
butt := buttons at:idx. |
|
10446 |
||
10447 |
"get our size (preferredExtent) and compute |
|
10448 |
origin and extent of buttonPanel and okButton. |
|
10449 |
This is normally done on view realization." |
|
10450 |
||
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10451 |
needResize ifTrue:[ self resize ]. |
2332 | 10452 |
buttonPanel |
10453 |
pixelOrigin:buttonPanel computeOrigin |
|
10454 |
extent:buttonPanel computeExtent. |
|
10455 |
buttonPanel setChildPositionsIfChanged. |
|
2732
9a96cfc123c0
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
2718
diff
changeset
|
10456 |
^ (butt originRelativeTo:self) + (butt extent // 2). |
2332 | 10457 |
] |
10458 |
] |
|
118 | 10459 |
]. |
913 | 10460 |
|
953
050fba15277a
DialogBoxes positionOffset now handles all common cases
Claus Gittinger <cg@exept.de>
parents:
950
diff
changeset
|
10461 |
^ super positionOffset |
912
310c4970e613
Fix #positionOffset to show 'senders' box with cursor on ok-button.
Stefan Vogel <sv@exept.de>
parents:
884
diff
changeset
|
10462 |
|
913 | 10463 |
"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
|
10464 |
"Modified: 16.1.1997 / 22:00:23 / cg" |
118 | 10465 |
! |
10466 |
||
130 | 10467 |
preferredExtent |
132 | 10468 |
"return my preferred extent. |
10469 |
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
|
10470 |
whichever is larger, by the sum of the component's heights." |
118 | 10471 |
|
120 | 10472 |
|w h p| |
118 | 10473 |
|
3756
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
10474 |
"/ If I have an explicit preferredExtent.. |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
10475 |
explicitExtent notNil ifTrue:[ |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
10476 |
^ explicitExtent |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
10477 |
]. |
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
10478 |
|
7a333fc722bd
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3736
diff
changeset
|
10479 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
10480 |
preferredExtent notNil ifTrue:[ |
2801 | 10481 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
10482 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
680
diff
changeset
|
10483 |
|
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10484 |
h := yPosition + ViewSpacing. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10485 |
verticalPanel notNil ifTrue:[ |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10486 |
"/ 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
|
10487 |
"/ 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
|
10488 |
"/ do this now. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10489 |
verticalPanel extent:(verticalPanel computePreferredExtent). |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10490 |
h := h + verticalPanel height. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10491 |
]. |
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10492 |
|
120 | 10493 |
addedComponents notNil ifTrue:[ |
2803
9f75a923238d
refactored preferredWidth computation for subclass reuse
Claus Gittinger <cg@exept.de>
parents:
2801
diff
changeset
|
10494 |
w := self maxPreferredWidthOfAddedComponents. |
120 | 10495 |
] ifFalse:[ |
3618 | 10496 |
w := super preferredExtent x. |
120 | 10497 |
]. |
132 | 10498 |
w := w max:width. |
3934
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10499 |
|
d1d5bba8c902
box resizing and verticalPanel handling changed to allow
Claus Gittinger <cg@exept.de>
parents:
3932
diff
changeset
|
10500 |
subViews size ~~ 0 ifTrue:[ |
2801 | 10501 |
p := buttonPanel preferredExtent. |
10502 |
w := w max:p x. |
|
10503 |
h := h |
|
10504 |
+ p y |
|
10505 |
+ ViewSpacing. |
|
120 | 10506 |
]. |
118 | 10507 |
|
120 | 10508 |
"/ okButton isNil ifTrue:[ |
130 | 10509 |
"/ ^ super preferredExtent |
120 | 10510 |
"/ ]. |
130 | 10511 |
"/ p := buttonPanel preferredExtent. |
120 | 10512 |
"/ w := p x. |
10513 |
"/ h := ViewSpacing |
|
10514 |
"/ + p y |
|
10515 |
"/ + ViewSpacing. |
|
10516 |
"/ |
|
10517 |
^ w @ h |
|
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10518 |
|
797 | 10519 |
"Modified: 19.7.1996 / 20:43:52 / cg" |
2379
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
10520 |
! |
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
10521 |
|
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
10522 |
specificationFor:aKey |
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
10523 |
"return an interface specs literal encoding. |
f16038a3eddc
allow device-specific windowSpecs
Claus Gittinger <cg@exept.de>
parents:
2374
diff
changeset
|
10524 |
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
|
10525 |
|
2568 | 10526 |
^ ApplicationModel |
10527 |
specificationFor:aKey |
|
10528 |
application:self |
|
5627 | 10529 |
onDevice:(device) |
310
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10530 |
! ! |
4bbc8deffc8c
allow specification of the resizing behavior (better list-choosers)
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
10531 |
|
197 | 10532 |
!DialogBox methodsFor:'user actions'! |
76 | 10533 |
|
197 | 10534 |
abortPressed |
10535 |
"sent by the cancel button; user pressed abort button |
|
10536 |
- hide myself and evaluate okAction" |
|
121 | 10537 |
|
197 | 10538 |
abortButton turnOffWithoutRedraw. |
10539 |
acceptValue value:false. |
|
121 | 10540 |
|
197 | 10541 |
"/ actually, only hides if I have been opened modal |
10542 |
self hideAndEvaluate:abortAction |
|
121 | 10543 |
! |
10544 |
||
2542
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10545 |
actionArgument |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10546 |
^ nil |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10547 |
! |
53fc213c8815
refactored action evaluation
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
10548 |
|
2392
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10549 |
closeCancel |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10550 |
"closed via escape" |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10551 |
|
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10552 |
acceptValue value:false. |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10553 |
|
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10554 |
"/ actually, only hides if I have been opened modal |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10555 |
self hideAndEvaluate:abortAction |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10556 |
! |
3863ab3759c6
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
2380
diff
changeset
|
10557 |
|
197 | 10558 |
doAccept |
10559 |
"let all components accept (i.e. update their model from the values), |
|
10560 |
then set my accept value to true. |
|
10561 |
This is confusing: this method was originally called #accept, |
|
10562 |
but renamed for compatibility with ST-80, where #accept returns the |
|
10563 |
accept-valueHolder (which looks like a bad name to me ...)." |
|
76 | 10564 |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
10565 |
autoAccept ifTrue:[ |
1401 | 10566 |
addedComponents notNil ifTrue:[ |
10567 |
addedComponents do:[:aComponent | |
|
10568 |
(aComponent respondsTo:#accept) ifTrue:[ |
|
10569 |
aComponent accept |
|
10570 |
] |
|
10571 |
] |
|
10572 |
]. |
|
197 | 10573 |
]. |
10574 |
acceptValue value:true. |
|
469
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
10575 |
|
1d86f97ab2e5
autoAccept as default; configurable
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
10576 |
"Modified: 4.3.1996 / 12:14:56 / cg" |
128 | 10577 |
! |
10578 |
||
197 | 10579 |
keyPress:aKey x:x y:y |
2700 | 10580 |
"return-key duplicates ok-function if acceptReturnAsOK is true" |
76 | 10581 |
|
4493 | 10582 |
<resource: #keyboard (#Return #Escape)> |
490 | 10583 |
|
5322 | 10584 |
|b focusView| |
10585 |
||
10586 |
"/ notice: the modern way to handle this is via the keyboard processor; |
|
5558 | 10587 |
"/ however, for old-style DialogBoxes (i.e. without AppModel), |
10588 |
"/ the keyboardProcessor has no one to inform about RETURN/ESCAPE. |
|
5322 | 10589 |
"/ So the procesing here is still needed. |
3809 | 10590 |
|
3808
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10591 |
(aKey == #Return) ifTrue:[ |
5322 | 10592 |
focusView := self windowGroup explicitFocusView. |
10593 |
"/ in case user tabbed onto one of the buttons, that is the one to trigger |
|
10594 |
focusView notNil ifTrue:[ |
|
10595 |
focusView == okButton ifTrue:[ |
|
10596 |
^ self okPressed |
|
10597 |
]. |
|
10598 |
focusView == abortButton ifTrue:[ |
|
10599 |
^ self abortPressed |
|
10600 |
]. |
|
10601 |
(buttonPanel notNil and:[ buttonPanel subViews includesIdentical:focusView ]) ifTrue:[ |
|
10602 |
focusView turnOnWithAction.focusView turnOffWithAction. |
|
10603 |
^ self. |
|
10604 |
]. |
|
10605 |
]. |
|
10606 |
||
10607 |
"/ the focus is on anything else. |
|
3808
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10608 |
(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
|
10609 |
^ self okPressed |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10610 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10611 |
(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
|
10612 |
^ self abortPressed |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10613 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10614 |
(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
|
10615 |
b turnOnWithAction. b turnOffWithAction. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10616 |
^ self. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10617 |
] |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10618 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10619 |
|
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10620 |
(aKey == #Escape) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10621 |
(abortButton notNil) ifTrue:[ |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10622 |
^ self abortPressed |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10623 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10624 |
]. |
743af7e351c6
oops - for old-style DialogBoxes (wo. AppModel), the keyboardProcessor has
Claus Gittinger <cg@exept.de>
parents:
3805
diff
changeset
|
10625 |
|
197 | 10626 |
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
|
10627 |
|
490 | 10628 |
"Modified: 7.3.1996 / 13:15:09 / cg" |
76 | 10629 |
! |
10630 |
||
197 | 10631 |
lastFieldLeft |
10632 |
"if the dialog involves input fields, this is called |
|
10633 |
when the last field is left by Return-key or NextField-key" |
|
120 | 10634 |
|
197 | 10635 |
acceptOnLeave ifTrue:[ |
1401 | 10636 |
acceptReturnAsOK ifTrue:[ |
10637 |
focusToOKOnLeave ifTrue:[ |
|
10638 |
self focusOnOk. |
|
10639 |
^ self. |
|
10640 |
]. |
|
10641 |
self okPressed |
|
10642 |
] |
|
197 | 10643 |
]. |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
10644 |
inputFieldGroup activateFirst |
357
732f59def851
care for acceptReturnAsOK being false and return being pressed
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
10645 |
|
551
91ed5dd2b915
shift focus to OK button on return - thats better
Claus Gittinger <cg@exept.de>
parents:
550
diff
changeset
|
10646 |
"Modified: 19.4.1996 / 17:09:02 / cg" |
76 | 10647 |
! |
10648 |
||
197 | 10649 |
okPressed |
10650 |
"sent by the okButton; user pressed ok-button |
|
10651 |
- make myself invisible and if an action was specified do it" |
|
128 | 10652 |
|
197 | 10653 |
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
|
10654 |
|
197 | 10655 |
self doAccept. |
10656 |
||
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
10657 |
acceptCheck notNil ifTrue:[ |
302 | 10658 |
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
|
10659 |
]. |
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
10660 |
|
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
10661 |
hideOnAccept ifTrue:[ |
302 | 10662 |
"/ actually, only hides if I have been opened modal |
10663 |
self hideAndEvaluate:okAction. |
|
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
10664 |
] ifFalse:[ |
302 | 10665 |
okAction value |
280
f7d45bfb6d13
fixed cursor-wrapping in multiple-editfield boxes; added acceptCheck-block
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
10666 |
] |
3584
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
10667 |
! |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
10668 |
|
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
10669 |
openDialog |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
10670 |
self showAtPointer. |
0ed199ba20a4
more construction (vw compatibility, for NET-IMAP dialogs)
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
10671 |
^ self accepted |
128 | 10672 |
! ! |
240 | 10673 |
|
846
75c5dc601522
added more configuration options to confirmWithCancel:
Claus Gittinger <cg@exept.de>
parents:
831
diff
changeset
|
10674 |
!DialogBox class methodsFor:'documentation'! |
240 | 10675 |
|
10676 |
version |
|
5401 | 10677 |
^ '$Header$' |
4058
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
10678 |
! |
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
10679 |
|
6c30a8f944f5
added: #choose:fromList:values:buttons:values:lines:cancel:postBuildBlock:
Claus Gittinger <cg@exept.de>
parents:
3944
diff
changeset
|
10680 |
version_CVS |
5401 | 10681 |
^ '$Header$' |
240 | 10682 |
! ! |
2618 | 10683 |
|
4493 | 10684 |
|
498 | 10685 |
DialogBox initialize! |