3650
|
1 |
"{ Package: 'stx:libwidg2' }"
|
|
2 |
|
|
3 |
Button subclass:#LinkButton
|
|
4 |
instanceVariableNames:'labelsAndActions'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Views-Layout'
|
|
8 |
!
|
|
9 |
|
|
10 |
!LinkButton class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
Looks like a Label, but behaves like a button with individually clickable text components.
|
|
15 |
Can be used to create htmp-page-look-alike links in a view.
|
|
16 |
|
|
17 |
[author:]
|
|
18 |
cg (cg@CG-VOSTRO)
|
|
19 |
|
|
20 |
[instance variables:]
|
|
21 |
|
|
22 |
[class variables:]
|
|
23 |
|
|
24 |
[see also:]
|
|
25 |
|
|
26 |
"
|
|
27 |
!
|
|
28 |
|
|
29 |
examples
|
|
30 |
"
|
|
31 |
|v l|
|
|
32 |
|
|
33 |
v := StandardSystemView new.
|
|
34 |
l := LinkButton in:v.
|
|
35 |
l labelsAndActions:{
|
|
36 |
'Hello' -> [ self halt:'Hello'].
|
|
37 |
' ' -> nil.
|
|
38 |
'World' -> [ self halt:'World'].
|
|
39 |
}.
|
|
40 |
l foregroundColor:Color blue.
|
|
41 |
v open
|
|
42 |
"
|
|
43 |
! !
|
|
44 |
|
|
45 |
!LinkButton methodsFor:'accessing'!
|
|
46 |
|
|
47 |
labelsAndActions
|
|
48 |
"returns the collection of label->action associations.
|
|
49 |
For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
|
|
50 |
When clicked on a string, the corresponding action is called"
|
|
51 |
|
|
52 |
^ labelsAndActions
|
|
53 |
!
|
|
54 |
|
|
55 |
labelsAndActions:aCollectionOfAssociations
|
|
56 |
"set the collection of label->action associations.
|
|
57 |
For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
|
|
58 |
When clicked on a string, the corresponding action is called"
|
|
59 |
|
|
60 |
labelsAndActions := aCollectionOfAssociations.
|
|
61 |
self label:((aCollectionOfAssociations collect:[:assoc | assoc key]) asStringWith:'')
|
|
62 |
! !
|
|
63 |
|
|
64 |
!LinkButton methodsFor:'initialization'!
|
|
65 |
|
|
66 |
defaultControllerClass
|
|
67 |
^ LinkButtonController
|
|
68 |
! !
|
|
69 |
|
|
70 |
!LinkButton class methodsFor:'documentation'!
|
|
71 |
|
|
72 |
version
|
|
73 |
^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.1 2009-03-05 21:18:55 cg Exp $'
|
|
74 |
! !
|