DialogBox.st
changeset 2444 a8c1811e9f9c
parent 2439 9b04ff6c26e8
child 2452 c3607704aab3
equal deleted inserted replaced
2443:9a1258c6dcbd 2444:a8c1811e9f9c
  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
  2439         cancelLabel:cancelLabel 
  2449         cancelLabel:cancelLabel 
  2440         title:titleString 
  2450         title:titleString 
  2441         onCancel:cancelValue 
  2451         onCancel:cancelValue 
  2442         list:listToSelectFrom 
  2452         list:listToSelectFrom 
  2443         initialSelection:nil
  2453         initialSelection:nil
       
  2454         entryCompletionBlock:nil
  2444 
  2455 
  2445     "
  2456     "
  2446      centered around 200@200:
  2457      centered around 200@200:
  2447 
  2458 
  2448          Dialog 
  2459          Dialog 
  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 
  2742         cancelLabel:nil 
  2888         cancelLabel:nil 
  2743         title:nil 
  2889         title:nil 
  2744         onCancel:'' 
  2890         onCancel:'' 
  2745         list:nil 
  2891         list:nil 
  2746         initialSelection:anInterval
  2892         initialSelection:anInterval
       
  2893         entryCompletionBlock:nil
  2747 
  2894 
  2748     "
  2895     "
  2749      Dialog 
  2896      Dialog 
  2750          request:'enter a string:' 
  2897          request:'enter a string:' 
  2751          initialAnswer:'the default'
  2898          initialAnswer:'the default'
  2769         okLabel:nil 
  2916         okLabel:nil 
  2770         cancelLabel:nil 
  2917         cancelLabel:nil 
  2771         title:nil 
  2918         title:nil 
  2772         onCancel:''
  2919         onCancel:''
  2773         list:aList
  2920         list:aList
       
  2921         initialSelection:nil
       
  2922         entryCompletionBlock:nil
  2774 
  2923 
  2775     "
  2924     "
  2776      Dialog 
  2925      Dialog 
  2777          request:'enter a string:' 
  2926          request:'enter a string:' 
  2778          initialAnswer:'the default'  
  2927          initialAnswer:'the default'  
  2801         initialAnswer:initial
  2950         initialAnswer:initial
  2802         okLabel:okLabel
  2951         okLabel:okLabel
  2803         cancelLabel:nil
  2952         cancelLabel:nil
  2804         title:titleString
  2953         title:titleString
  2805         onCancel:cancelAction
  2954         onCancel:cancelAction
       
  2955         list:nil
       
  2956         initialSelection:nil
       
  2957         entryCompletionBlock:nil
  2806 
  2958 
  2807     "
  2959     "
  2808      Dialog 
  2960      Dialog 
  2809          request:'enter a string:' 
  2961          request:'enter a string:' 
  2810          initialAnswer:'the default'  
  2962          initialAnswer:'the default'  
  2829         okLabel:okLabel
  2981         okLabel:okLabel
  2830         cancelLabel:nil
  2982         cancelLabel:nil
  2831         title:titleString
  2983         title:titleString
  2832         onCancel:cancelAction
  2984         onCancel:cancelAction
  2833         list:listOfChoices
  2985         list:listOfChoices
       
  2986         initialSelection:nil
       
  2987         entryCompletionBlock:nil
  2834 
  2988 
  2835     "
  2989     "
  2836      Dialog 
  2990      Dialog 
  2837          request:'enter a string:' 
  2991          request:'enter a string:' 
  2838          initialAnswer:'the default'
  2992          initialAnswer:'the default'
  2855         request:aString 
  3009         request:aString 
  2856         displayAt:nil 
  3010         displayAt:nil 
  2857         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  3011         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  2858         action:nil 
  3012         action:nil 
  2859         initialAnswer:initial
  3013         initialAnswer:initial
       
  3014         okLabel:nil
       
  3015         cancelLabel:nil
       
  3016         title:nil
  2860         onCancel:cancelAction
  3017         onCancel:cancelAction
       
  3018         list:nil
       
  3019         initialSelection:nil
       
  3020         entryCompletionBlock:nil
  2861 
  3021 
  2862     "
  3022     "
  2863      Dialog 
  3023      Dialog 
  2864          request:'enter a string:' 
  3024          request:'enter a string:' 
  2865          initialAnswer:'the default'  
  3025          initialAnswer:'the default'  
  2884         okLabel:nil 
  3044         okLabel:nil 
  2885         cancelLabel:nil 
  3045         cancelLabel:nil 
  2886         title:nil 
  3046         title:nil 
  2887         onCancel:nil 
  3047         onCancel:nil 
  2888         list:listOfChoices
  3048         list:listOfChoices
       
  3049         initialSelection:nil
       
  3050         entryCompletionBlock:nil
  2889 
  3051 
  2890     "
  3052     "
  2891      Dialog 
  3053      Dialog 
  2892          request:'enter a string:'
  3054          request:'enter a string:'
  2893          list:#('foo' 'bar' 'baz')
  3055          list:#('foo' 'bar' 'baz')
  2908         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  3070         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  2909         action:nil 
  3071         action:nil 
  2910         initialAnswer:''
  3072         initialAnswer:''
  2911         okLabel:okLabel
  3073         okLabel:okLabel
  2912         cancelLabel:nil
  3074         cancelLabel:nil
  2913         onCancel:''
  3075         title:nil 
       
  3076         onCancel:nil 
       
  3077         list:nil
       
  3078         initialSelection:nil
       
  3079         entryCompletionBlock:nil
  2914 
  3080 
  2915     "
  3081     "
  2916      Dialog 
  3082      Dialog 
  2917         request:'enter a string:'
  3083         request:'enter a string:'
  2918         okLabel:'yes'
  3084         okLabel:'yes'
  2934         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  3100         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  2935         action:nil 
  3101         action:nil 
  2936         initialAnswer:''
  3102         initialAnswer:''
  2937         okLabel:okLabel
  3103         okLabel:okLabel
  2938         cancelLabel:nil
  3104         cancelLabel:nil
       
  3105         title:nil 
  2939         onCancel:cancelValue
  3106         onCancel:cancelValue
       
  3107         list:nil
       
  3108         initialSelection:nil
       
  3109         entryCompletionBlock:nil
  2940 
  3110 
  2941     "
  3111     "
  2942      Dialog 
  3112      Dialog 
  2943         request:'enter a string:'
  3113         request:'enter a string:'
  2944         okLabel:'yes'
  3114         okLabel:'yes'
  2962         initialAnswer:''
  3132         initialAnswer:''
  2963         okLabel:okLabel
  3133         okLabel:okLabel
  2964         cancelLabel:nil
  3134         cancelLabel:nil
  2965         title:titleString
  3135         title:titleString
  2966         onCancel:cancelValue
  3136         onCancel:cancelValue
       
  3137         list:nil
       
  3138         initialSelection:nil
       
  3139         entryCompletionBlock:nil
  2967 
  3140 
  2968     "
  3141     "
  2969      Dialog 
  3142      Dialog 
  2970         request:'enter a string:'
  3143         request:'enter a string:'
  2971         okLabel:'yes'
  3144         okLabel:'yes'
  2986         request:aString 
  3159         request:aString 
  2987         displayAt:nil 
  3160         displayAt:nil 
  2988         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  3161         centered:(ForceModalBoxesToOpenAtCenter ? false) 
  2989         action:nil 
  3162         action:nil 
  2990         initialAnswer:''
  3163         initialAnswer:''
       
  3164         okLabel:nil
       
  3165         cancelLabel:nil
       
  3166         title:nil
  2991         onCancel:cancelActionOrValue
  3167         onCancel:cancelActionOrValue
       
  3168         list:nil
       
  3169         initialSelection:nil
       
  3170         entryCompletionBlock:nil
  2992 
  3171 
  2993     "
  3172     "
  2994      Dialog 
  3173      Dialog 
  2995          request:'enter a string:'
  3174          request:'enter a string:'
  2996          onCancel:nil       
  3175          onCancel:nil       
  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."
  6932 ! !
  7142 ! !
  6933 
  7143 
  6934 !DialogBox class methodsFor:'documentation'!
  7144 !DialogBox class methodsFor:'documentation'!
  6935 
  7145 
  6936 version
  7146 version
  6937     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.172 2001-10-11 16:33:30 cg Exp $'
  7147     ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.173 2001-10-18 13:03:31 cg Exp $'
  6938 ! !
  7148 ! !
  6939 DialogBox initialize!
  7149 DialogBox initialize!