2602 " |
2602 " |
2603 |
2603 |
2604 "Modified: 22.2.1996 / 15:40:54 / cg" |
2604 "Modified: 22.2.1996 / 15:40:54 / cg" |
2605 ! |
2605 ! |
2606 |
2606 |
2607 addListBoxOn:aModel withNumberOfLines:numLines |
2607 addListBoxOn:aModel class:aListViewClass withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
2608 "add a selectionInListView to the box. |
2608 "add a selectionInListView to the box. |
2609 The list has numLines (if nonNil) number of lines shown." |
2609 The list has numLines (if nonNil) number of lines shown." |
2610 |
2610 |
2611 |l scr h| |
2611 |l scr h dH| |
2612 |
2612 |
2613 l := SelectionInListView new. |
2613 l := aListViewClass new. |
2614 l model:aModel. |
2614 l model:aModel. |
2615 l doubleClickAction:[:name | self okPressed]. |
2615 l doubleClickAction:[:name | self okPressed]. |
2616 scr := ScrollableView forView:l. |
2616 |
|
2617 vs ifTrue:[ |
|
2618 hs ifTrue:[ |
|
2619 scr := HVScrollableView forView:l miniScrollerH:true . |
|
2620 ] ifFalse:[ |
|
2621 scr := ScrollableView forView:l |
|
2622 ]. |
|
2623 scr resize. |
|
2624 "/ Transcript show:scr height; show:' '; showCr:l height. |
|
2625 dH := scr height - l height. |
|
2626 ] ifFalse:[ |
|
2627 l level:-1. |
|
2628 scr := l. |
|
2629 dH := 0. |
|
2630 ]. |
2617 |
2631 |
2618 numLines notNil ifTrue:[ |
2632 numLines notNil ifTrue:[ |
2619 h := l heightForLines:numLines. |
2633 h := l heightForLines:numLines. |
2620 ] ifFalse:[ |
2634 ] ifFalse:[ |
2621 h := l preferredExtent y |
2635 h := l preferredExtent y |
2622 ]. |
2636 ]. |
2623 self addComponent:scr withHeight:h. |
2637 self addComponent:scr withHeight:(h + dH). |
2624 ^ l |
2638 ^ l |
|
2639 |
|
2640 " |
|
2641 |dialog listView| |
|
2642 |
|
2643 dialog := DialogBox new. |
|
2644 (dialog addTextLabel:'select any') adjust:#left. |
|
2645 |
|
2646 listView := dialog |
|
2647 addListBoxOn:nil |
|
2648 class:FileSelectionList |
|
2649 withNumberOfLines:10 |
|
2650 hScrollable:false |
|
2651 vScrollable:false. |
|
2652 |
|
2653 listView directory:'/etc'. |
|
2654 |
|
2655 dialog addAbortButton; addOkButton. |
|
2656 dialog open. |
|
2657 |
|
2658 dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:listView selectionValue]. |
|
2659 " |
|
2660 |
|
2661 "Created: 22.2.1996 / 15:40:07 / cg" |
|
2662 "Modified: 22.2.1996 / 15:41:25 / cg" |
|
2663 ! |
|
2664 |
|
2665 addListBoxOn:aModel withNumberOfLines:numLines |
|
2666 "add a selectionInListView to the box. |
|
2667 The list has numLines (if nonNil) number of lines shown." |
|
2668 |
|
2669 ^ self addListBoxOn:aModel withNumberOfLines:numLines hScrollable:false vScrollable:true. |
2625 |
2670 |
2626 " |
2671 " |
2627 |dialog model listView| |
2672 |dialog model listView| |
2628 |
2673 |
2629 model := SelectionInList new. |
2674 model := SelectionInList new. |
2632 |
2677 |
2633 dialog := DialogBox new. |
2678 dialog := DialogBox new. |
2634 (dialog addTextLabel:'select any') adjust:#left. |
2679 (dialog addTextLabel:'select any') adjust:#left. |
2635 |
2680 |
2636 listView := dialog addListBoxOn:model withNumberOfLines:3. |
2681 listView := dialog addListBoxOn:model withNumberOfLines:3. |
|
2682 |
|
2683 dialog addAbortButton; addOkButton. |
|
2684 dialog open. |
|
2685 |
|
2686 dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection]. |
|
2687 " |
|
2688 |
|
2689 "Created: 22.2.1996 / 15:40:07 / cg" |
|
2690 "Modified: 22.2.1996 / 15:41:25 / cg" |
|
2691 ! |
|
2692 |
|
2693 addListBoxOn:aModel withNumberOfLines:numLines hScrollable:hs vScrollable:vs |
|
2694 "add a selectionInListView to the box. |
|
2695 The list has numLines (if nonNil) number of lines shown." |
|
2696 |
|
2697 ^ self |
|
2698 addListBoxOn:aModel |
|
2699 class:SelectionInListView |
|
2700 withNumberOfLines:numLines |
|
2701 hScrollable:hs |
|
2702 vScrollable:vs |
|
2703 |
|
2704 " |
|
2705 |dialog model listView| |
|
2706 |
|
2707 model := SelectionInList new. |
|
2708 model list:#('one' 'two' 'three' 'four'). |
|
2709 model selectionIndex:2. |
|
2710 |
|
2711 dialog := DialogBox new. |
|
2712 (dialog addTextLabel:'select any') adjust:#left. |
|
2713 |
|
2714 listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:true vScrollable:true. |
|
2715 |
|
2716 dialog addAbortButton; addOkButton. |
|
2717 dialog open. |
|
2718 |
|
2719 dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection]. |
|
2720 " |
|
2721 |
|
2722 " |
|
2723 |dialog model listView| |
|
2724 |
|
2725 model := SelectionInList new. |
|
2726 model list:#('one' 'two' 'three' 'four'). |
|
2727 model selectionIndex:2. |
|
2728 |
|
2729 dialog := DialogBox new. |
|
2730 (dialog addTextLabel:'select any') adjust:#left. |
|
2731 |
|
2732 listView := dialog addListBoxOn:model withNumberOfLines:3 hScrollable:false vScrollable:false. |
2637 |
2733 |
2638 dialog addAbortButton; addOkButton. |
2734 dialog addAbortButton; addOkButton. |
2639 dialog open. |
2735 dialog open. |
2640 |
2736 |
2641 dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection]. |
2737 dialog accepted ifTrue:[Transcript show:'selection is:'; showCr:model selection]. |