0
|
1 |
"
|
5
|
2 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
0
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
EnterBox subclass:#EnterBox2
|
|
14 |
instanceVariableNames:'okButton2 okAction2'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
38
|
17 |
category:'Views-DialogBoxes'
|
0
|
18 |
!
|
|
19 |
|
|
20 |
EnterBox2 comment:'
|
5
|
21 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
0
|
22 |
All Rights Reserved
|
|
23 |
|
48
|
24 |
$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.6 1994-08-23 23:37:01 claus Exp $
|
38
|
25 |
'!
|
|
26 |
|
|
27 |
!EnterBox2 class methodsFor:'documentation '!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1991 by Claus Gittinger
|
|
32 |
All Rights Reserved
|
0
|
33 |
|
38
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
0
|
42 |
|
38
|
43 |
version
|
|
44 |
"
|
48
|
45 |
$Header: /cvs/stx/stx/libwidg/EnterBox2.st,v 1.6 1994-08-23 23:37:01 claus Exp $
|
38
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
An EnterBox2 is like an EnterBox but with 2 action buttons.
|
|
52 |
This is used (for example) in the search-boxes, where two ok-buttons
|
|
53 |
'find-previous' and 'find-next' are needed in addition to the abort button.
|
|
54 |
"
|
|
55 |
! !
|
0
|
56 |
|
|
57 |
!EnterBox2 class methodsFor:'instance creation'!
|
|
58 |
|
|
59 |
title:titleString okText1:text1 okText2:text2 abortText:abortText
|
|
60 |
action1:block1 action2:block2
|
|
61 |
"create and return a new EnterBox-with-2 buttons
|
|
62 |
and define its text, button-labels and actions"
|
|
63 |
|
|
64 |
^ (super title:titleString
|
|
65 |
okText:text1
|
|
66 |
abortText:abortText
|
|
67 |
action:block1) okText2:text2 action2:block2
|
|
68 |
! !
|
|
69 |
|
|
70 |
!EnterBox2 methodsFor:'initialization'!
|
|
71 |
|
|
72 |
initialize
|
|
73 |
super initialize.
|
|
74 |
|
|
75 |
okButton2 := Button label:''
|
|
76 |
action:[
|
|
77 |
okButton2 turnOffWithoutRedraw.
|
|
78 |
self ok2Pressed
|
|
79 |
]
|
|
80 |
in:buttonPanel.
|
|
81 |
okButton isReturnButton:false.
|
|
82 |
okButton2 isReturnButton:true.
|
48
|
83 |
okButton2 cursor:(Cursor thumbsUp).
|
|
84 |
|
0
|
85 |
self resize.
|
|
86 |
enterField leaveAction:[:key | self ok2Pressed]
|
|
87 |
! !
|
|
88 |
|
8
|
89 |
!EnterBox2 methodsFor:'realization'!
|
|
90 |
|
|
91 |
positionOffset
|
|
92 |
"return the delta, by which the box should be displayed
|
|
93 |
from the mouse pointer. Value returned here makes
|
|
94 |
okButton appear under the cursor"
|
|
95 |
|
|
96 |
^ (okButton2 originRelativeTo:self) + (okButton2 extent // 2)
|
|
97 |
! !
|
|
98 |
|
0
|
99 |
!EnterBox2 methodsFor:'accessing'!
|
|
100 |
|
|
101 |
okText2:aString action2:aBlock
|
|
102 |
"set the text to be displayed in the 2nd ok-button,
|
|
103 |
and its action"
|
|
104 |
|
|
105 |
self okText2:aString.
|
|
106 |
okAction2 := aBlock
|
|
107 |
!
|
|
108 |
|
|
109 |
okText2:aString
|
|
110 |
"set the text to be displayed in the 2nd ok-button"
|
|
111 |
|
8
|
112 |
aString ~= okButton2 label ifTrue:[
|
|
113 |
okButton2 label:aString.
|
|
114 |
okButton2 resize.
|
|
115 |
self resize
|
|
116 |
]
|
0
|
117 |
!
|
|
118 |
|
|
119 |
action2:aBlock
|
|
120 |
"set the action to be performed when user presses the 2nd ok-button;
|
|
121 |
aBlock must be nil or a block with one argument "
|
|
122 |
|
|
123 |
okAction2 := aBlock
|
|
124 |
! !
|
|
125 |
|
|
126 |
!EnterBox2 methodsFor:'user interaction'!
|
|
127 |
|
|
128 |
ok2Pressed
|
|
129 |
"user pressed 2nd ok button - evaluate action"
|
|
130 |
|
|
131 |
self hideAndEvaluate:okAction2
|
|
132 |
! !
|