131
|
1 |
ComboView subclass:#ComboListView
|
|
2 |
instanceVariableNames:''
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Views-Interactors'
|
|
6 |
!
|
|
7 |
|
|
8 |
!ComboListView class methodsFor:'documentation'!
|
|
9 |
|
|
10 |
documentation
|
|
11 |
"
|
|
12 |
A ComboListView combines an label with a drop down list of default inputs;
|
|
13 |
choosing any from the pulled list sets the string in the label.
|
|
14 |
|
|
15 |
This is the same as a PopUpList or SelectionInListView, bit looks different.
|
|
16 |
|
|
17 |
Not yet finished.
|
|
18 |
"
|
|
19 |
!
|
|
20 |
|
|
21 |
examples
|
|
22 |
"
|
181
|
23 |
[exBegin]
|
131
|
24 |
|top b|
|
|
25 |
|
|
26 |
top := StandardSystemView new.
|
|
27 |
top extent:(300 @ 200).
|
|
28 |
|
|
29 |
b := ComboListView in:top.
|
|
30 |
b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
|
|
31 |
b bottomInset:(b preferredExtent y negated).
|
|
32 |
|
|
33 |
b list:#('hello' 'world' 'this' 'is' 'st/x').
|
|
34 |
top open.
|
181
|
35 |
[exEnd]
|
131
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
model operation:
|
181
|
40 |
[exBegin]
|
131
|
41 |
|model top b|
|
|
42 |
|
|
43 |
model := 'foo' asValue.
|
|
44 |
|
|
45 |
top := StandardSystemView new.
|
|
46 |
top extent:(300 @ 200).
|
|
47 |
|
|
48 |
b := ComboListView in:top.
|
|
49 |
b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
|
|
50 |
b bottomInset:(b preferredExtent y negated).
|
|
51 |
|
|
52 |
b list:#('hello' 'world' 'this' 'is' 'st/x').
|
|
53 |
b model:model.
|
|
54 |
|
|
55 |
top openModal.
|
|
56 |
Transcript showCr:('comboBox''s value: ' , model value).
|
181
|
57 |
[exEnd]
|
131
|
58 |
|
|
59 |
|
|
60 |
in a dialog:
|
181
|
61 |
[exBegin]
|
131
|
62 |
|model1 model2 dialog b|
|
|
63 |
|
|
64 |
model1 := 'foo' asValue.
|
|
65 |
model2 := 'bar' asValue.
|
|
66 |
|
|
67 |
dialog := Dialog new.
|
|
68 |
(dialog addTextLabel:'ComboList example:') adjust:#left.
|
|
69 |
dialog addVerticalSpace.
|
|
70 |
|
|
71 |
(b := dialog addComboListOn:model1 tabable:true).
|
|
72 |
b list:#('fee' 'foe' 'foo').
|
|
73 |
dialog addVerticalSpace.
|
|
74 |
|
|
75 |
(b := dialog addComboListOn:model2 tabable:true).
|
|
76 |
b list:#('bar' 'baz' 'baloo').
|
|
77 |
dialog addVerticalSpace.
|
|
78 |
|
|
79 |
dialog addOkButton.
|
|
80 |
|
|
81 |
dialog open.
|
|
82 |
|
|
83 |
Transcript showCr:('1st comboBox''s value: ' , model1 value).
|
|
84 |
Transcript showCr:('2nd comboBox''s value: ' , model2 value).
|
181
|
85 |
[exEnd]
|
131
|
86 |
"
|
|
87 |
! !
|
|
88 |
|
|
89 |
!ComboListView methodsFor:'accessing-components'!
|
|
90 |
|
|
91 |
label
|
181
|
92 |
"return the label component"
|
131
|
93 |
|
|
94 |
^ field
|
|
95 |
|
|
96 |
"Modified: 28.2.1996 / 15:10:50 / cg"
|
|
97 |
"Created: 28.2.1996 / 15:13:51 / cg"
|
|
98 |
! !
|
|
99 |
|
|
100 |
!ComboListView methodsFor:'initialization'!
|
|
101 |
|
|
102 |
initializeField
|
|
103 |
field := Label in:self.
|
|
104 |
field level:-1.
|
|
105 |
field adjust:#left.
|
|
106 |
|
|
107 |
"
|
|
108 |
|b|
|
|
109 |
|
|
110 |
b := ComboListView new.
|
|
111 |
b list:#('hello' 'world' 'this' 'is' 'st/x').
|
|
112 |
b open
|
|
113 |
"
|
|
114 |
|
|
115 |
"Created: 28.2.1996 / 15:13:46 / cg"
|
|
116 |
"Modified: 28.2.1996 / 15:18:40 / cg"
|
|
117 |
! !
|
|
118 |
|
|
119 |
!ComboListView methodsFor:'user interaction'!
|
|
120 |
|
|
121 |
entryChanged:what
|
|
122 |
field label:what.
|
|
123 |
model notNil ifTrue:[model value:what].
|
|
124 |
pullDownButton turnOff.
|
|
125 |
|
|
126 |
"Created: 28.2.1996 / 15:13:46 / cg"
|
|
127 |
"Modified: 28.2.1996 / 15:19:00 / cg"
|
|
128 |
! !
|
|
129 |
|
|
130 |
!ComboListView class methodsFor:'documentation'!
|
|
131 |
|
|
132 |
version
|
181
|
133 |
^ '$Header: /cvs/stx/stx/libwidg2/Attic/ComboListV.st,v 1.2 1996-05-14 11:09:30 cg Exp $'
|
131
|
134 |
! !
|