2110 screen center (if centered is true). |
2110 screen center (if centered is true). |
2111 The ok-button is labelled okLabel (or the default, ifNil), |
2111 The ok-button is labelled okLabel (or the default, ifNil), |
2112 the cancel-button is labelled cancelLabel (or the default, ifNil). |
2112 the cancel-button is labelled cancelLabel (or the default, ifNil). |
2113 Return the string or the value of cancelValue (if cancel was pressed)" |
2113 Return the string or the value of cancelValue (if cancel was pressed)" |
2114 |
2114 |
|
2115 ^ self |
|
2116 request:aString |
|
2117 displayAt:aPoint |
|
2118 centered:centered |
|
2119 action:resultAction |
|
2120 initialAnswer:initial |
|
2121 okLabel:okLabel |
|
2122 cancelLabel:cancelLabel |
|
2123 title:titleString |
|
2124 onCancel:cancelValue |
|
2125 list:nil |
|
2126 |
|
2127 ! |
|
2128 |
|
2129 request:aString displayAt:aPoint centered:centered action:resultAction initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString onCancel:cancelValue list:listToSelectFrom |
|
2130 "launch a Dialog, which allows user to enter a string. |
|
2131 The dialogs window is titled titleString, or the default (if nil). |
|
2132 If aPoint is nonNil, the box is shown there, optionally centered around it. |
|
2133 If it is nil, it is shown at the current pointer position or at the |
|
2134 screen center (if centered is true). |
|
2135 The ok-button is labelled okLabel (or the default, ifNil), |
|
2136 the cancel-button is labelled cancelLabel (or the default, ifNil). |
|
2137 Return the string or the value of cancelValue (if cancel was pressed)" |
|
2138 |
2115 |box| |
2139 |box| |
2116 |
2140 |
2117 box := EnterBox title:aString. |
2141 listToSelectFrom isNil ifTrue:[ |
|
2142 box := EnterBox title:aString. |
|
2143 ] ifFalse:[ |
|
2144 box := EnterBoxWithList title:aString. |
|
2145 box list:listToSelectFrom. |
|
2146 ]. |
2118 box initialText:initial printString. |
2147 box initialText:initial printString. |
2119 box abortAction:[:val | box destroy. ^ cancelValue value]. |
2148 box abortAction:[:val | box destroy. ^ cancelValue value]. |
2120 okLabel notNil ifTrue:[ |
2149 okLabel notNil ifTrue:[ |
2121 box okText:okLabel. |
2150 box okText:okLabel. |
2122 ]. |
2151 ]. |
2123 cancelLabel notNil ifTrue:[ |
2152 cancelLabel notNil ifTrue:[ |
2124 box abortText:cancelLabel |
2153 box abortText:cancelLabel |
2125 ]. |
2154 ]. |
2126 resultAction isNil ifTrue:[ |
2155 resultAction isNil ifTrue:[ |
2127 box action:[:val | box destroy. ^ val] |
2156 box action:[:val | box destroy. ^ val] |
2128 ] ifFalse:[ |
2157 ] ifFalse:[ |
2129 box action:[:val | box destroy. ^ resultAction value:val] |
2158 box action:[:val | box destroy. ^ resultAction value:val] |
2130 ]. |
2159 ]. |
2131 titleString notNil ifTrue:[ |
2160 titleString notNil ifTrue:[ |
2132 box label:titleString |
2161 box label:titleString |
2133 ]. |
2162 ]. |
2134 |
2163 |
2135 aPoint notNil ifTrue:[ |
2164 aPoint notNil ifTrue:[ |
2136 box showAt:aPoint center:centered |
2165 box showAt:aPoint center:centered |
2137 ] ifFalse:[ |
2166 ] ifFalse:[ |
2138 centered ifTrue:[ |
2167 centered ifTrue:[ |
2139 box showAtCenter |
2168 box showAtCenter |
2140 ] ifFalse:[ |
2169 ] ifFalse:[ |
2141 box showAtPointer |
2170 box showAtPointer |
2142 ] |
2171 ] |
2143 ]. |
2172 ]. |
2144 box destroy. |
2173 box destroy. |
2145 ^ cancelValue value. |
2174 ^ cancelValue value. |
2146 |
2175 |
2147 " |
2176 " |
2148 centered around 200@200: |
2177 centered around 200@200: |
2149 |
2178 |
2150 Dialog |
2179 Dialog |
2151 request:'enter a string:' |
2180 request:'enter a string:' |
2152 displayAt:200@200 |
2181 displayAt:200@200 |
2153 centered:true |
2182 centered:true |
2154 action:[:result | result printNewline] |
2183 action:[:result | result printNewline] |
2155 initialAnswer:'the default' |
2184 initialAnswer:'the default' |
2156 okLabel:'yes' |
2185 okLabel:'yes' |
2157 cancelLabel:'no' |
2186 cancelLabel:'no' |
2158 title:'foo' |
2187 title:'foo' |
2159 onCancel:#foo |
2188 onCancel:#foo |
2160 |
2189 |
2161 under mouse pointer: |
2190 under mouse pointer: |
2162 |
2191 |
2163 Dialog |
2192 Dialog |
2164 request:'enter a string:' |
2193 request:'enter a string:' |
2165 displayAt:nil |
2194 displayAt:nil |
2166 centered:false |
2195 centered:false |
2167 action:[:result | result printNewline] |
2196 action:[:result | result printNewline] |
2168 initialAnswer:'the default' |
2197 initialAnswer:'the default' |
2169 okLabel:'yes' |
2198 okLabel:'yes' |
2170 cancelLabel:'no' |
2199 cancelLabel:'no' |
2171 title:'foo' |
2200 title:'foo' |
2172 onCancel:#foo |
2201 onCancel:#foo |
2173 |
2202 |
2174 centered on the screen: |
2203 centered on the screen: |
2175 |
2204 |
2176 Dialog |
2205 Dialog |
2177 request:'enter a string:' |
2206 request:'enter a string:' |
2178 displayAt:nil |
2207 displayAt:nil |
2179 centered:true |
2208 centered:true |
2180 action:[:result | result printNewline] |
2209 action:[:result | result printNewline] |
2181 initialAnswer:'the default' |
2210 initialAnswer:'the default' |
2182 okLabel:'yes' |
2211 okLabel:'yes' |
2183 cancelLabel:'no' |
2212 cancelLabel:'no' |
2184 title:'foo' |
2213 title:'foo' |
2185 onCancel:#foo |
2214 onCancel:#foo |
2186 " |
2215 " |
2187 |
2216 |
2188 "Created: 29.5.1996 / 14:35:04 / cg" |
2217 "Created: 29.5.1996 / 14:35:04 / cg" |
2189 "Modified: 29.5.1996 / 15:26:34 / cg" |
2218 "Modified: 29.5.1996 / 15:26:34 / cg" |
2190 ! |
2219 ! |
2329 |
2358 |
2330 "Modified: 29.5.1996 / 14:28:24 / cg" |
2359 "Modified: 29.5.1996 / 14:28:24 / cg" |
2331 "Created: 29.5.1996 / 14:59:57 / cg" |
2360 "Created: 29.5.1996 / 14:59:57 / cg" |
2332 ! |
2361 ! |
2333 |
2362 |
|
2363 request:aString initialAnswer:initial okLabel:okLabel title:titleString onCancel:cancelAction list:listOfChoices |
|
2364 "launch a Dialog, which allows user to enter something. |
|
2365 Return the entered string (may be empty string) |
|
2366 or cancelValue (if cancel was pressed)" |
|
2367 |
|
2368 ^ self |
|
2369 request:aString |
|
2370 displayAt:nil |
|
2371 centered:false |
|
2372 action:nil |
|
2373 initialAnswer:initial |
|
2374 okLabel:okLabel |
|
2375 cancelLabel:nil |
|
2376 title:titleString |
|
2377 onCancel:cancelAction |
|
2378 list:listOfChoices |
|
2379 |
|
2380 " |
|
2381 Dialog |
|
2382 request:'enter a string:' |
|
2383 initialAnswer:'the default' |
|
2384 okLabel:'ok' |
|
2385 title:'demo' |
|
2386 onCancel:nil |
|
2387 list:#('foo' 'bar' 'baz') |
|
2388 " |
|
2389 |
|
2390 "Modified: 29.5.1996 / 14:28:24 / cg" |
|
2391 "Created: 29.5.1996 / 14:59:57 / cg" |
|
2392 ! |
|
2393 |
2334 request:aString initialAnswer:initial onCancel:cancelAction |
2394 request:aString initialAnswer:initial onCancel:cancelAction |
2335 "launch a Dialog, which allows user to enter something. |
2395 "launch a Dialog, which allows user to enter something. |
2336 Return the entered string (may be empty string) |
2396 Return the entered string (may be empty string) |
2337 or cancelValue (if cancel was pressed)" |
2397 or cancelValue (if cancel was pressed)" |
2338 |
2398 |
2350 initialAnswer:'the default' |
2410 initialAnswer:'the default' |
2351 onCancel:['foooo'] |
2411 onCancel:['foooo'] |
2352 " |
2412 " |
2353 |
2413 |
2354 "Modified: 29.5.1996 / 14:28:24 / cg" |
2414 "Modified: 29.5.1996 / 14:28:24 / cg" |
|
2415 ! |
|
2416 |
|
2417 request:aString list:listOfChoices |
|
2418 "launch a Dialog, which allows user to enter something, |
|
2419 but adds a list of choices for fast input. |
|
2420 Return the entered string (may be empty string) |
|
2421 or the empty string (if cancel was pressed)" |
|
2422 |
|
2423 ^ self |
|
2424 request:aString |
|
2425 displayAt:nil |
|
2426 centered:false |
|
2427 action:nil |
|
2428 initialAnswer:'' |
|
2429 okLabel:nil |
|
2430 cancelLabel:nil |
|
2431 title:nil |
|
2432 onCancel:nil |
|
2433 list:listOfChoices |
|
2434 |
|
2435 " |
|
2436 Dialog |
|
2437 request:'enter a string:' |
|
2438 list:#('foo' 'bar' 'baz') |
|
2439 " |
|
2440 |
|
2441 "Modified: 29.5.1996 / 14:26:25 / cg" |
2355 ! |
2442 ! |
2356 |
2443 |
2357 request:aString okLabel:okLabel |
2444 request:aString okLabel:okLabel |
2358 "launch a Dialog, which allows user to enter something. |
2445 "launch a Dialog, which allows user to enter something. |
2359 The okButton is labelled as okLabel. |
2446 The okButton is labelled as okLabel. |