2256 If it is nil, it is shown at the current pointer position or at the |
2256 If it is nil, it is shown at the current pointer position or at the |
2257 screen center. |
2257 screen center. |
2258 Return the string or an empty string (if cancel was pressed)" |
2258 Return the string or an empty string (if cancel was pressed)" |
2259 |
2259 |
2260 ^ self |
2260 ^ self |
2261 request:aString |
2261 request:aString |
2262 displayAt:aPoint |
2262 displayAt:aPoint |
2263 centered:centered |
2263 centered:centered |
2264 action:resultAction |
2264 action:resultAction |
2265 initialAnswer:initial |
2265 initialAnswer:initial |
2266 onCancel:'' |
2266 okLabel:nil |
|
2267 cancelLabel:nil |
|
2268 title:nil |
|
2269 onCancel:'' |
|
2270 list:nil |
|
2271 initialSelection:nil |
|
2272 entryCompletionBlock:nil |
2267 |
2273 |
2268 " |
2274 " |
2269 centered around 200@200: |
2275 centered around 200@200: |
2270 |
2276 |
2271 Dialog |
2277 Dialog |
2272 request:'enter a string:' |
2278 request:'enter a string:' |
2273 displayAt:200@200 |
2279 displayAt:200@200 |
2274 centered:true |
2280 centered:true |
2275 action:[:result | result printNewline] |
2281 action:[:result | result printNewline] |
2276 initialAnswer:'the default' |
2282 initialAnswer:'the default' |
2277 |
2283 |
2278 |
2284 |
2279 origin at 200@200: |
2285 origin at 200@200: |
2280 |
2286 |
2281 Dialog |
2287 Dialog |
2282 request:'enter a string:' |
2288 request:'enter a string:' |
2283 displayAt:200@200 |
2289 displayAt:200@200 |
2284 centered:false |
2290 centered:false |
2285 action:[:result | result printNewline] |
2291 action:[:result | result printNewline] |
2286 initialAnswer:'the default' |
2292 initialAnswer:'the default' |
2287 |
2293 |
2288 under mouse pointer: |
2294 under mouse pointer: |
2289 |
2295 |
2290 Dialog |
2296 Dialog |
2291 request:'enter a string:' |
2297 request:'enter a string:' |
2292 displayAt:nil |
2298 displayAt:nil |
2293 centered:false |
2299 centered:false |
2294 action:[:result | result printNewline] |
2300 action:[:result | result printNewline] |
2295 initialAnswer:'the default' |
2301 initialAnswer:'the default' |
2296 |
2302 |
2297 centered on the screen: |
2303 centered on the screen: |
2298 |
2304 |
2299 Dialog |
2305 Dialog |
2300 request:'enter a string:' |
2306 request:'enter a string:' |
2301 displayAt:nil |
2307 displayAt:nil |
2302 centered:true |
2308 centered:true |
2303 action:[:result | result printNewline] |
2309 action:[:result | result printNewline] |
2304 initialAnswer:'the default' |
2310 initialAnswer:'the default' |
2305 " |
2311 " |
2306 |
2312 |
2307 "Created: 7.12.1995 / 23:14:10 / cg" |
2313 "Created: 7.12.1995 / 23:14:10 / cg" |
2308 "Modified: 29.5.1996 / 14:19:36 / cg" |
2314 "Modified: 29.5.1996 / 14:19:36 / cg" |
2309 ! |
2315 ! |
2316 The ok-button is labelled okLabel (or the default, ifNil), |
2322 The ok-button is labelled okLabel (or the default, ifNil), |
2317 the cancel-button is labelled cancelLabel (or the default, ifNil). |
2323 the cancel-button is labelled cancelLabel (or the default, ifNil). |
2318 Return the string or the value of cancelValue (if cancel was pressed)" |
2324 Return the string or the value of cancelValue (if cancel was pressed)" |
2319 |
2325 |
2320 ^ self |
2326 ^ self |
2321 request:aString |
2327 request:aString |
2322 displayAt:aPoint |
2328 displayAt:aPoint |
2323 centered:centered |
2329 centered:centered |
2324 action:resultAction |
2330 action:resultAction |
2325 initialAnswer:initial |
2331 initialAnswer:initial |
2326 okLabel:okLabel |
2332 okLabel:okLabel |
2327 cancelLabel:cancelLabel |
2333 cancelLabel:cancelLabel |
2328 title:nil |
2334 title:nil |
2329 onCancel:cancelValue |
2335 onCancel:cancelValue |
|
2336 list:nil |
|
2337 initialSelection:nil |
|
2338 entryCompletionBlock:nil |
2330 |
2339 |
2331 " |
2340 " |
2332 at topLeft (centering is suppressed, to make the box fully visible) |
2341 at topLeft (centering is suppressed, to make the box fully visible) |
2333 Dialog |
2342 Dialog |
2334 request:'enter a string:' |
2343 request:'enter a string:' |
2335 displayAt:0@0 |
2344 displayAt:0@0 |
2336 centered:true |
2345 centered:true |
2337 action:[:result | result printNewline] |
2346 action:[:result | result printNewline] |
2338 initialAnswer:'the default' |
2347 initialAnswer:'the default' |
2339 okLabel:'yes' |
2348 okLabel:'yes' |
2340 cancelLabel:'no' |
2349 cancelLabel:'no' |
2341 onCancel:#foo |
2350 onCancel:#foo |
2342 |
2351 |
2343 centered around 200@200: |
2352 centered around 200@200: |
2344 |
2353 |
2345 Dialog |
2354 Dialog |
2346 request:'enter a string:' |
2355 request:'enter a string:' |
2347 displayAt:200@200 |
2356 displayAt:200@200 |
2348 centered:true |
2357 centered:true |
2349 action:[:result | result printNewline] |
2358 action:[:result | result printNewline] |
2350 initialAnswer:'the default' |
2359 initialAnswer:'the default' |
2351 okLabel:'yes' |
2360 okLabel:'yes' |
2352 cancelLabel:'no' |
2361 cancelLabel:'no' |
2353 onCancel:#foo |
2362 onCancel:#foo |
2354 |
2363 |
2355 topLeft of box at 200@200: |
2364 topLeft of box at 200@200: |
2356 |
2365 |
2357 Dialog |
2366 Dialog |
2358 request:'enter a string:' |
2367 request:'enter a string:' |
2359 displayAt:200@200 |
2368 displayAt:200@200 |
2360 centered:false |
2369 centered:false |
2361 action:[:result | result printNewline] |
2370 action:[:result | result printNewline] |
2362 initialAnswer:'the default' |
2371 initialAnswer:'the default' |
2363 okLabel:'yes' |
2372 okLabel:'yes' |
2364 cancelLabel:'no' |
2373 cancelLabel:'no' |
2365 onCancel:#foo |
2374 onCancel:#foo |
2366 |
2375 |
2367 under mouse pointer: |
2376 under mouse pointer: |
2368 |
2377 |
2369 Dialog |
2378 Dialog |
2370 request:'enter a string:' |
2379 request:'enter a string:' |
2371 displayAt:nil |
2380 displayAt:nil |
2372 centered:false |
2381 centered:false |
2373 action:[:result | result printNewline] |
2382 action:[:result | result printNewline] |
2374 initialAnswer:'the default' |
2383 initialAnswer:'the default' |
2375 okLabel:'yes' |
2384 okLabel:'yes' |
2376 cancelLabel:'no' |
2385 cancelLabel:'no' |
2377 onCancel:#foo |
2386 onCancel:#foo |
2378 |
2387 |
2379 centered on the screen: |
2388 centered on the screen: |
2380 |
2389 |
2381 Dialog |
2390 Dialog |
2382 request:'enter a string:' |
2391 request:'enter a string:' |
2383 displayAt:nil |
2392 displayAt:nil |
2384 centered:true |
2393 centered:true |
2385 action:[:result | result printNewline] |
2394 action:[:result | result printNewline] |
2386 initialAnswer:'the default' |
2395 initialAnswer:'the default' |
2387 okLabel:'yes' |
2396 okLabel:'yes' |
2388 cancelLabel:'no' |
2397 cancelLabel:'no' |
2389 onCancel:#foo |
2398 onCancel:#foo |
2390 " |
2399 " |
2391 |
2400 |
2392 "Created: 7.12.1995 / 23:14:10 / cg" |
2401 "Created: 7.12.1995 / 23:14:10 / cg" |
2393 "Modified: 29.5.1996 / 14:35:45 / cg" |
2402 "Modified: 29.5.1996 / 14:35:45 / cg" |
2394 ! |
2403 ! |
2412 okLabel:okLabel |
2421 okLabel:okLabel |
2413 cancelLabel:cancelLabel |
2422 cancelLabel:cancelLabel |
2414 title:titleString |
2423 title:titleString |
2415 onCancel:cancelValue |
2424 onCancel:cancelValue |
2416 list:nil |
2425 list:nil |
2417 |
2426 initialSelection:nil |
|
2427 entryCompletionBlock:nil |
2418 ! |
2428 ! |
2419 |
2429 |
2420 request:aString displayAt:aPoint centered:centered action:resultAction |
2430 request:aString displayAt:aPoint centered:centered action:resultAction |
2421 initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
2431 initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
2422 onCancel:cancelValue list:listToSelectFrom |
2432 onCancel:cancelValue list:listToSelectFrom |
2511 screen center (if centered is true). |
2522 screen center (if centered is true). |
2512 The ok-button is labelled okLabel (or the default, ifNil), |
2523 The ok-button is labelled okLabel (or the default, ifNil), |
2513 the cancel-button is labelled cancelLabel (or the default, ifNil). |
2524 the cancel-button is labelled cancelLabel (or the default, ifNil). |
2514 Return the string or the value of cancelValue (if cancel was pressed)" |
2525 Return the string or the value of cancelValue (if cancel was pressed)" |
2515 |
2526 |
2516 |box| |
2527 ^ self |
|
2528 request:aString |
|
2529 displayAt:aPoint |
|
2530 centered:centered |
|
2531 action:resultAction |
|
2532 initialAnswer:initial |
|
2533 okLabel:okLabel |
|
2534 cancelLabel:cancelLabel |
|
2535 title:titleString |
|
2536 onCancel:cancelValue |
|
2537 list:listToSelectFrom |
|
2538 initialSelection:anInterval |
|
2539 entryCompletionBlock:nil |
|
2540 |
|
2541 " |
|
2542 centered around 200@200: |
|
2543 |
|
2544 Dialog |
|
2545 request:'enter a string:' |
|
2546 displayAt:200@200 |
|
2547 centered:true |
|
2548 action:[:result | result printNewline] |
|
2549 initialAnswer:'the default' |
|
2550 okLabel:'yes' |
|
2551 cancelLabel:'no' |
|
2552 title:'foo' |
|
2553 onCancel:#foo |
|
2554 |
|
2555 under mouse pointer: |
|
2556 |
|
2557 Dialog |
|
2558 request:'enter a string:' |
|
2559 displayAt:nil |
|
2560 centered:false |
|
2561 action:[:result | result printNewline] |
|
2562 initialAnswer:'the default' |
|
2563 okLabel:'yes' |
|
2564 cancelLabel:'no' |
|
2565 title:'foo' |
|
2566 onCancel:#foo |
|
2567 |
|
2568 centered on the screen: |
|
2569 |
|
2570 Dialog |
|
2571 request:'enter a string:' |
|
2572 displayAt:nil |
|
2573 centered:true |
|
2574 action:[:result | result printNewline] |
|
2575 initialAnswer:'the default' |
|
2576 okLabel:'yes' |
|
2577 cancelLabel:'no' |
|
2578 title:'foo' |
|
2579 onCancel:#foo |
|
2580 |
|
2581 with a list: |
|
2582 |
|
2583 Dialog |
|
2584 request:'enter a string:' |
|
2585 displayAt:nil |
|
2586 centered:true |
|
2587 action:[:result | result printNewline] |
|
2588 initialAnswer:'the default' |
|
2589 okLabel:'yes' |
|
2590 cancelLabel:'no' |
|
2591 title:'foo' |
|
2592 onCancel:#foo |
|
2593 list:#(foo bar baz) |
|
2594 " |
|
2595 |
|
2596 "Created: / 29.5.1996 / 14:35:04 / cg" |
|
2597 "Modified: / 5.5.1999 / 10:50:22 / cg" |
|
2598 ! |
|
2599 |
|
2600 request:aString displayAt:aPoint centered:centeredOrNil action:resultAction |
|
2601 initialAnswer:initial okLabel:okLabel cancelLabel:cancelLabel title:titleString |
|
2602 onCancel:cancelValue list:listToSelectFrom initialSelection:anInterval |
|
2603 entryCompletionBlock:entryCompletionBlock |
|
2604 "launch a Dialog, which allows user to enter a string. |
|
2605 The dialogs window is titled titleString, or the default (if nil). |
|
2606 If aPoint is nonNil, the box is shown there, optionally centered around it. |
|
2607 If it is nil, it is shown at the current pointer position or at the |
|
2608 screen center (if centered is true). |
|
2609 The ok-button is labelled okLabel (or the default, ifNil), |
|
2610 the cancel-button is labelled cancelLabel (or the default, ifNil). |
|
2611 Return the string or the value of cancelValue (if cancel was pressed)" |
|
2612 |
|
2613 |box centered| |
2517 |
2614 |
2518 listToSelectFrom isNil ifTrue:[ |
2615 listToSelectFrom isNil ifTrue:[ |
2519 box := EnterBox title:aString. |
2616 box := EnterBox title:aString. |
2520 ] ifFalse:[ |
2617 ] ifFalse:[ |
2521 box := EnterBoxWithList title:aString. |
2618 box := EnterBoxWithList title:aString. |
2538 box action:[:val | box destroy. ^ resultAction value:val] |
2635 box action:[:val | box destroy. ^ resultAction value:val] |
2539 ]. |
2636 ]. |
2540 titleString notNil ifTrue:[ |
2637 titleString notNil ifTrue:[ |
2541 box label:titleString |
2638 box label:titleString |
2542 ]. |
2639 ]. |
|
2640 entryCompletionBlock notNil ifTrue:[ |
|
2641 box entryCompletionBlock:[:text | box |
|
2642 initialText:(entryCompletionBlock value:text) |
|
2643 selected:false]. |
|
2644 ]. |
2543 AboutToOpenBoxNotificationSignal raiseWith:box. |
2645 AboutToOpenBoxNotificationSignal raiseWith:box. |
|
2646 |
|
2647 centered := centeredOrNil ? (ForceModalBoxesToOpenAtCenter ? false). |
2544 |
2648 |
2545 aPoint notNil ifTrue:[ |
2649 aPoint notNil ifTrue:[ |
2546 box showAt:aPoint center:centered |
2650 box showAt:aPoint center:centered |
2547 ] ifFalse:[ |
2651 ] ifFalse:[ |
2548 centered ifTrue:[ |
2652 centered ifTrue:[ |
2618 If aPoint is nonNil, the box is shown there, optionally centered. |
2722 If aPoint is nonNil, the box is shown there, optionally centered. |
2619 If it is nil, it is shown at the current pointer position or at the screen center. |
2723 If it is nil, it is shown at the current pointer position or at the screen center. |
2620 Return the string or the value of cancelValue (if cancel was pressed)" |
2724 Return the string or the value of cancelValue (if cancel was pressed)" |
2621 |
2725 |
2622 ^ self |
2726 ^ self |
2623 request:aString |
2727 request:aString |
2624 displayAt:aPoint |
2728 displayAt:aPoint |
2625 centered:centered |
2729 centered:centered |
2626 action:resultAction |
2730 action:resultAction |
2627 initialAnswer:initial |
2731 initialAnswer:initial |
2628 okLabel:nil |
2732 okLabel:nil |
2629 cancelLabel:nil |
2733 cancelLabel:nil |
2630 onCancel:cancelValue |
2734 title:nil |
|
2735 onCancel:cancelValue |
|
2736 list:nil |
|
2737 initialSelection:nil |
2631 |
2738 |
2632 " |
2739 " |
2633 at topLeft (centering is suppressed, to make the box fully visible) |
2740 at topLeft (centering is suppressed, to make the box fully visible) |
2634 Dialog |
2741 Dialog |
2635 request:'enter a string:' |
2742 request:'enter a string:' |
2636 displayAt:0@0 |
2743 displayAt:0@0 |
2637 centered:true |
2744 centered:true |
2638 action:[:result | result printNewline] |
2745 action:[:result | result printNewline] |
2639 initialAnswer:'the default' |
2746 initialAnswer:'the default' |
2640 onCancel:#foo |
2747 onCancel:#foo |
2641 |
2748 |
2642 centered around 200@200: |
2749 centered around 200@200: |
2643 |
2750 |
2644 Dialog |
2751 Dialog |
2645 request:'enter a string:' |
2752 request:'enter a string:' |
2646 displayAt:200@200 |
2753 displayAt:200@200 |
2647 centered:true |
2754 centered:true |
2648 action:[:result | result printNewline] |
2755 action:[:result | result printNewline] |
2649 initialAnswer:'the default' |
2756 initialAnswer:'the default' |
2650 onCancel:#foo |
2757 onCancel:#foo |
2651 |
2758 |
2652 topLeft of box at 200@200: |
2759 topLeft of box at 200@200: |
2653 |
2760 |
2654 Dialog |
2761 Dialog |
2655 request:'enter a string:' |
2762 request:'enter a string:' |
2656 displayAt:200@200 |
2763 displayAt:200@200 |
2657 centered:false |
2764 centered:false |
2658 action:[:result | result printNewline] |
2765 action:[:result | result printNewline] |
2659 initialAnswer:'the default' |
2766 initialAnswer:'the default' |
2660 onCancel:#foo |
2767 onCancel:#foo |
2661 |
2768 |
2662 under mouse pointer: |
2769 under mouse pointer: |
2663 |
2770 |
2664 Dialog |
2771 Dialog |
2665 request:'enter a string:' |
2772 request:'enter a string:' |
2666 displayAt:nil |
2773 displayAt:nil |
2667 centered:false |
2774 centered:false |
2668 action:[:result | result printNewline] |
2775 action:[:result | result printNewline] |
2669 initialAnswer:'the default' |
2776 initialAnswer:'the default' |
2670 onCancel:#foo |
2777 onCancel:#foo |
2671 |
2778 |
2672 centered on the screen: |
2779 centered on the screen: |
2673 |
2780 |
2674 Dialog |
2781 Dialog |
2675 request:'enter a string:' |
2782 request:'enter a string:' |
2676 displayAt:nil |
2783 displayAt:nil |
2677 centered:true |
2784 centered:true |
2678 action:[:result | result printNewline] |
2785 action:[:result | result printNewline] |
2679 initialAnswer:'the default' |
2786 initialAnswer:'the default' |
2680 onCancel:#foo |
2787 onCancel:#foo |
2681 " |
2788 " |
2682 |
2789 |
2683 "Created: 7.12.1995 / 23:14:10 / cg" |
2790 "Created: 7.12.1995 / 23:14:10 / cg" |
2684 "Modified: 29.5.1996 / 14:24:39 / cg" |
2791 "Modified: 29.5.1996 / 14:24:39 / cg" |
2685 ! |
2792 ! |
2714 ^ self |
2821 ^ self |
2715 request:aString |
2822 request:aString |
2716 displayAt:nil |
2823 displayAt:nil |
2717 centered:(ForceModalBoxesToOpenAtCenter ? false) |
2824 centered:(ForceModalBoxesToOpenAtCenter ? false) |
2718 action:nil |
2825 action:nil |
2719 initialAnswer:initial |
2826 initialAnswer:initial |
|
2827 okLabel:nil |
|
2828 cancelLabel:nil |
|
2829 title:nil |
2720 onCancel:'' |
2830 onCancel:'' |
|
2831 list:nil |
|
2832 initialSelection:nil |
|
2833 entryCompletionBlock:nil |
2721 |
2834 |
2722 " |
2835 " |
2723 Dialog |
2836 Dialog |
2724 request:'enter a string:' |
2837 request:'enter a string:' |
2725 initialAnswer:'the default' |
2838 initialAnswer:'the default' |
|
2839 " |
|
2840 |
|
2841 "Modified: 29.5.1996 / 14:30:05 / cg" |
|
2842 ! |
|
2843 |
|
2844 request:aString initialAnswer:initial entryCompletionBlock:entryCompletionBlock |
|
2845 "launch a Dialog, which allows user to enter something. |
|
2846 Return the entered string (may be empty string) or nil (if cancel was pressed)" |
|
2847 |
|
2848 ^ self |
|
2849 request:aString |
|
2850 displayAt:nil |
|
2851 centered:(ForceModalBoxesToOpenAtCenter ? false) |
|
2852 action:nil |
|
2853 initialAnswer:initial |
|
2854 okLabel:nil |
|
2855 cancelLabel:nil |
|
2856 title:nil |
|
2857 onCancel:'' |
|
2858 list:nil |
|
2859 initialSelection:nil |
|
2860 entryCompletionBlock:entryCompletionBlock |
|
2861 |
|
2862 " |
|
2863 Dialog |
|
2864 request:'enter a selector:' |
|
2865 initialAnswer:'at:p' |
|
2866 entryCompletionBlock:[:s | |completion| |
|
2867 |
|
2868 completion := Smalltalk selectorCompletion:s. |
|
2869 completion second size > 1 ifTrue:[ Screen current beep]. |
|
2870 completion first |
|
2871 ]. |
2726 " |
2872 " |
2727 |
2873 |
2728 "Modified: 29.5.1996 / 14:30:05 / cg" |
2874 "Modified: 29.5.1996 / 14:30:05 / cg" |
2729 ! |
2875 ! |
2730 |
2876 |
3011 Dialog |
3190 Dialog |
3012 requestPassword:'enter secret:' |
3191 requestPassword:'enter secret:' |
3013 " |
3192 " |
3014 |
3193 |
3015 "Created: 17.11.1995 / 09:45:21 / cg" |
3194 "Created: 17.11.1995 / 09:45:21 / cg" |
|
3195 ! |
|
3196 |
|
3197 requestSelector:aString initialAnswer:initial |
|
3198 "launch a Dialog, which allows user to enter a method selector. |
|
3199 Return the entered string (may be empty string) or nil (if cancel was pressed). |
|
3200 The entryField does selectorCompletion on TAB." |
|
3201 |
|
3202 ^ self |
|
3203 request:aString |
|
3204 displayAt:nil |
|
3205 centered:nil |
|
3206 action:nil |
|
3207 initialAnswer:initial |
|
3208 okLabel:nil |
|
3209 cancelLabel:nil |
|
3210 title:nil |
|
3211 onCancel:nil |
|
3212 list:nil |
|
3213 initialSelection:nil |
|
3214 entryCompletionBlock:[:s | |completion| |
|
3215 |
|
3216 completion := Smalltalk selectorCompletion:s. |
|
3217 completion second size > 1 ifTrue:[ Screen current beep]. |
|
3218 completion first |
|
3219 ] |
|
3220 |
|
3221 " |
|
3222 Dialog |
|
3223 requestSelector:'enter a selector:' |
|
3224 initialAnswer:'at:p' |
|
3225 " |
3016 ! |
3226 ! |
3017 |
3227 |
3018 requestText:title lines:numLines columns:numCols initialAnswer:initialText |
3228 requestText:title lines:numLines columns:numCols initialAnswer:initialText |
3019 "open a dialog asking for multiline text. |
3229 "open a dialog asking for multiline text. |
3020 Return a stringCollection or nil if cancelled." |
3230 Return a stringCollection or nil if cancelled." |