125 By default (as inherited), the labelMsg is nil; therefore, buttons |
125 By default (as inherited), the labelMsg is nil; therefore, buttons |
126 do not try to aquire a new labelString from the model. |
126 do not try to aquire a new labelString from the model. |
127 If you want this behavior, you must set labelMsg and aspectMsg |
127 If you want this behavior, you must set labelMsg and aspectMsg |
128 as appropriate. |
128 as appropriate. |
129 |
129 |
|
130 labels |
|
131 Originally, labels only had a label- and disabledLabel attributes (both |
|
132 had to be explicitly set via setter methods). |
|
133 Later the model- and labelChannel interfaces were added; model interface |
|
134 for compatbility with other smalltalks, where a single multi-aspect model |
|
135 might be used, the channels were added to support visualWorks style of multiple |
|
136 single-aspect holders. This final version is also what the UIBuilder is working |
|
137 against. The other mechanisms are still present, but disabled if a newer mechanism |
|
138 is used (i.e. if a labelChannel has been given, the label and disabledLabel instvars |
|
139 are ignored). |
|
140 All of this is here to provide backward compatibility for existing customers |
|
141 and st/x programs (which is a good thing to have, b.t.w). |
|
142 |
|
143 |
130 See examples. |
144 See examples. |
131 |
145 |
132 |
146 |
133 [Instance variables:] |
147 [Instance variables:] |
134 |
148 |
146 |
160 |
147 isReturnButton <Boolean> true if this button is also activated by the |
161 isReturnButton <Boolean> true if this button is also activated by the |
148 return key - if true, it will draw a return-bitmap |
162 return key - if true, it will draw a return-bitmap |
149 in addition to the logo (default: false) |
163 in addition to the logo (default: false) |
150 |
164 |
151 defaultable <Boolean> true, if this button can become a returnButton. |
165 defaultable <Boolean> true, if this button can become a returnButton. |
152 (computes its default extent differently) |
166 (computes its default extent differently) |
153 |
167 |
154 shadowForm <Form> form to display in addition to buttons label (returnbutton only) |
168 shadowForm <Form> form to display in addition to buttons label (returnbutton only) |
155 lightForm <Form> light part of shadowForm (returnbutton only) |
169 lightForm <Form> light part of shadowForm (returnbutton only) |
156 |
170 |
157 formColor <Color> color to draw form with (returnbutton only) |
171 formColor <Color> color to draw form with (returnbutton only) |
1284 ! |
1298 ! |
1285 |
1299 |
1286 disabledLogo:anImageOrString |
1300 disabledLogo:anImageOrString |
1287 "define the logo to be displayed while disabled - |
1301 "define the logo to be displayed while disabled - |
1288 this is optional; the default is to display the same |
1302 this is optional; the default is to display the same |
1289 (logo) in both pressed and released states." |
1303 (logo) in both pressed and released states. |
|
1304 However, the disabled logo is ignored if a labelChannel has |
|
1305 been set - then that value has priority." |
1290 |
1306 |
1291 disabledLogo := anImageOrString. |
1307 disabledLogo := anImageOrString. |
1292 self enabled ifFalse:[ |
1308 labelChannel isNil ifTrue:[ |
1293 self label:anImageOrString |
1309 self enabled ifFalse:[ |
|
1310 self label:anImageOrString |
|
1311 ] |
1294 ] |
1312 ] |
1295 |
1313 |
1296 "Created: 17.9.1995 / 19:50:17 / claus" |
1314 "Created: 17.9.1995 / 19:50:17 / claus" |
1297 "Modified: 17.9.1995 / 19:50:34 / claus" |
1315 "Modified: 17.9.1995 / 19:50:34 / claus" |
1298 ! |
1316 ! |
1352 ! |
1370 ! |
1353 |
1371 |
1354 enteredLogo:anImageOrString |
1372 enteredLogo:anImageOrString |
1355 "define the logo to be displayed while the mousePointer is in the button - |
1373 "define the logo to be displayed while the mousePointer is in the button - |
1356 this is optional; the default is to display the same |
1374 this is optional; the default is to display the same |
1357 (logo) in both entered and normal states." |
1375 (logo) in both entered and normal states. |
|
1376 However, the entered logo is ignored if a labelChannel has |
|
1377 been set - then that value has priority." |
1358 |
1378 |
1359 enteredLogo := anImageOrString. |
1379 enteredLogo := anImageOrString. |
1360 controller entered ifTrue:[ |
1380 labelChannel isNil ifTrue:[ |
1361 self label:anImageOrString |
1381 controller entered ifTrue:[ |
|
1382 self label:anImageOrString |
|
1383 ] |
1362 ] |
1384 ] |
1363 ! |
1385 ! |
1364 |
1386 |
1365 focusLogo:anImageOrString |
1387 focusLogo:anImageOrString |
1366 "define the logo to be displayed while active - |
1388 "define the logo to be displayed while active - |
1367 this is optional; the default is to display the same |
1389 this is optional; the default is to display the same |
1368 (logo) in both pressed and released states." |
1390 (logo) in both pressed and released states. |
|
1391 However, the focus logo is ignored if a labelChannel has |
|
1392 been set - then that value has priority." |
1369 |
1393 |
1370 focusLogo := anImageOrString. |
1394 focusLogo := anImageOrString. |
1371 |
1395 |
1372 "Created: 17.9.1995 / 19:50:17 / claus" |
1396 "Created: 17.9.1995 / 19:50:17 / claus" |
1373 "Modified: 17.9.1995 / 20:00:43 / claus" |
1397 "Modified: 17.9.1995 / 20:00:43 / claus" |
1476 ! |
1500 ! |
1477 |
1501 |
1478 passiveLogo:anImageOrString |
1502 passiveLogo:anImageOrString |
1479 "define the logo to be displayed while inactive - |
1503 "define the logo to be displayed while inactive - |
1480 this is optional; the default is to display the same |
1504 this is optional; the default is to display the same |
1481 (logo) in both pressed and released states." |
1505 (logo) in both pressed and released states. |
|
1506 However, the inactive logo is ignored if a labelChannel has |
|
1507 been set - then that value has priority." |
1482 |
1508 |
1483 passiveLogo := anImageOrString. |
1509 passiveLogo := anImageOrString. |
1484 controller pressed ifFalse:[ |
1510 labelChannel isNil ifTrue:[ |
1485 self label:anImageOrString |
1511 controller pressed ifFalse:[ |
|
1512 self label:anImageOrString |
|
1513 ] |
1486 ] |
1514 ] |
1487 ! |
1515 ! |
1488 |
1516 |
1489 takeDefault |
1517 takeDefault |
1490 "ST-80 compatibility - set isReturnButton attribute" |
1518 "ST-80 compatibility - set isReturnButton attribute" |
1929 ] |
1957 ] |
1930 |
1958 |
1931 "Modified: / 3.11.1997 / 09:15:52 / cg" |
1959 "Modified: / 3.11.1997 / 09:15:52 / cg" |
1932 ! |
1960 ! |
1933 |
1961 |
|
1962 getLabelFromLabelChannel |
|
1963 passiveLogo := labelChannel value. |
|
1964 super getLabelFromLabelChannel. |
|
1965 ! |
|
1966 |
1934 shiftLabelWhenPressed |
1967 shiftLabelWhenPressed |
1935 ^ self class == Button |
1968 ^ self class == Button |
1936 ! ! |
1969 ! ! |
1937 |
1970 |
1938 !Button methodsFor:'queries'! |
1971 !Button methodsFor:'queries'! |