author | Claus Gittinger <cg@exept.de> |
Tue, 26 Feb 2008 11:25:51 +0100 | |
changeset 2391 | f6af9239e999 |
parent 2371 | 4ab6c8c7bc03 |
child 2473 | 66754ea64440 |
permissions | -rw-r--r-- |
59 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
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 |
" |
|
1502 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
59 | 14 |
EventListener subclass:#ActiveHelp |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
15 |
instanceVariableNames:'lastHelpText listeningForAll applicationsOrTopViewsWithHelp' |
1892 | 16 |
classVariableNames:'' |
216 | 17 |
poolDictionaries:'' |
18 |
category:'Interface-Help' |
|
59 | 19 |
! |
20 |
||
1892 | 21 |
ActiveHelp class instanceVariableNames:'DelayTime ShowTime TheOneAndOnlyHelpListener' |
22 |
||
23 |
" |
|
24 |
No other class instance variables are inherited by this class. |
|
25 |
" |
|
26 |
! |
|
27 |
||
338
071f92621e3b
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
28 |
!ActiveHelp class methodsFor:'documentation'! |
59 | 29 |
|
138 | 30 |
copyright |
31 |
" |
|
32 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
||
59 | 43 |
! |
44 |
||
45 |
documentation |
|
46 |
" |
|
98 | 47 |
The active help listener. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
48 |
|
98 | 49 |
The one and only instance of myself intercepts incoming mouse & keyboard |
50 |
events for the display device, being especially interested in view-enter/ |
|
636 | 51 |
leave events. When such an event arrives, it asks the corresponding view |
98 | 52 |
or its model for a help message and display it via an ActiveHelpView. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
53 |
(actually, the view is first asked if it would like to display it itself |
636 | 54 |
- for example, in some information-view). |
55 |
||
56 |
The query for the helpText is repeated along the views superView chain, |
|
57 |
until any model or view returns a nonNil answer for the #helpTextFor:at |
|
58 |
or #helpTextFor message. |
|
100 | 59 |
|
98 | 60 |
All I need for automatic help is some model/view/applicationModel along |
61 |
the superview chain of the entered component, which responds to the |
|
62 |
#helpTextFor: message with a non-nil (string-) answer. |
|
63 |
I close down the help view after a while, if a key is pressed or the mouse |
|
64 |
moved to another view. |
|
100 | 65 |
|
66 |
Who should provide the helpText: |
|
67 |
||
221 | 68 |
the best place is the application object (an instance of ApplicationModel) |
69 |
or the topView, if its a derived class of StandardSystemView. |
|
70 |
This should know about its components and return the string |
|
71 |
when asked via #helpTextFor:aComponent. |
|
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
297
diff
changeset
|
72 |
See examples in FileBrowser, Launcher etc. |
100 | 73 |
|
74 |
Be aware, that for applicationModels, there must be a link from the |
|
75 |
topView to this applicationModel |
|
76 |
(set via: aTopView application:anApplicationModel) |
|
77 |
otherwise, the helpManager has no means of finding the application which |
|
78 |
corresponds to a view. |
|
79 |
||
80 |
Who should display the helpText: |
|
81 |
||
221 | 82 |
by default, the helpListener opens a little popup view, which displays the |
83 |
returned help message. However, a nice trick which can be used by applications |
|
84 |
is to create an infoLabel as a subview of the topFrame (a la windows) |
|
85 |
and display the text right in the #helpTextFor: method. To cheat the |
|
86 |
help listener, this method should then return nil, to keep it silent. |
|
87 |
||
88 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
89 |
Usage: |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
90 |
If help is to be shown for all views (as enabled by the launchers help menu), |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
91 |
use 'ActiveHelp start' and 'ActiveHelp stop'. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
92 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
93 |
Individual apps may enable/disable active help for themself by: |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
94 |
'ActiveHelp startFor:app' or 'ActiveHelp stopFor:app', passing either |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
95 |
the topView or the topViews application as argument. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
96 |
This is usually done by applications which want to show contextHelp in |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
97 |
some infoView. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
98 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
99 |
|
221 | 100 |
[author:] |
101 |
Claus Gittinger |
|
102 |
||
233 | 103 |
[start with:] |
104 |
ActiveHelp start |
|
105 |
ActiveHelp stop |
|
106 |
||
221 | 107 |
[See also:] |
233 | 108 |
ActiveHelpView |
109 |
WindowGroup WindowEvent |
|
110 |
ApplicationModel StandardSystemView |
|
100 | 111 |
" |
112 |
! |
|
113 |
||
114 |
examples |
|
115 |
" |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
116 |
Active Help for a single view |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
117 |
or app (whatever the global settings are): |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
118 |
Can be initiated by an app when its opened. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
119 |
[exBegin] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
120 |
|app top myAppClass| |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
121 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
122 |
Class withoutUpdatingChangesDo:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
123 |
myAppClass := ApplicationModel |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
124 |
subclass:#'Demos::DemoApp' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
125 |
instanceVariableNames:'' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
126 |
classVariableNames:'' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
127 |
poolDictionaries:'' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
128 |
category:'demos'. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
129 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
130 |
myAppClass |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
131 |
compile:'helpTextFor:aView Transcript showCR:''hello''. ^ ''this is some helpText'''. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
132 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
133 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
134 |
app := myAppClass new. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
135 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
136 |
top := StandardSystemView new. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
137 |
top extent:300@100. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
138 |
top application:app. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
139 |
top open. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
140 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
141 |
ActiveHelp startFor:app. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
142 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
143 |
Class withoutUpdatingChangesDo:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
144 |
myAppClass removeFromSystem |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
145 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
146 |
[exEnd] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
147 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
148 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
149 |
Active Help (for all views): |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
150 |
|
233 | 151 |
(make certain that activeHelp is turned on ... |
152 |
... otherwise, you will see nothing) |
|
100 | 153 |
|
154 |
the following example uses a Plug as a model replacement. |
|
155 |
In concrete application, you would create a method to implement the helpText |
|
156 |
query message. |
|
227 | 157 |
[exBegin] |
158 |
|app top button1 button2| |
|
100 | 159 |
|
227 | 160 |
app := Plug new. |
161 |
app respondTo:#helpTextFor: |
|
162 |
with:[:view | |
|
163 |
view == button1 ifTrue:[ |
|
164 |
'this is button1' |
|
165 |
] ifFalse:[ |
|
166 |
view == button2 ifTrue:[ |
|
167 |
'some help for button2' |
|
168 |
] ifFalse:[ |
|
169 |
nil |
|
170 |
] |
|
171 |
] |
|
172 |
]. |
|
100 | 173 |
|
227 | 174 |
top := StandardSystemView new. |
175 |
top extent:300@100. |
|
176 |
button1 := Button label:'b1' in:top. |
|
177 |
button1 origin:0.0@0.0 corner:0.5@30. |
|
178 |
button2 := Button label:'b2' in:top. |
|
179 |
button2 origin:0.5@0.0 corner:1.0@30. |
|
180 |
top model:app. '<-- normally this would be: top application:app'. |
|
181 |
top open |
|
182 |
[exEnd] |
|
100 | 183 |
|
233 | 184 |
(make certain that activeHelp is turned on ... |
185 |
... otherwise, you will see nothing) |
|
186 |
||
227 | 187 |
alternatively, display of the helpMessage in a local, private view: |
188 |
[exBegin] |
|
189 |
|app top button1 button2 infoView| |
|
100 | 190 |
|
227 | 191 |
app := Plug new. |
192 |
app respondTo:#helpTextFor: |
|
193 |
with:[:view | infoView label:'info ...'. |
|
194 |
view == button1 ifTrue:[ |
|
195 |
infoView label:'this is button1' |
|
196 |
]. |
|
197 |
view == button2 ifTrue:[ |
|
198 |
infoView label:'some help for button2' |
|
199 |
]. |
|
200 |
nil |
|
201 |
]. |
|
100 | 202 |
|
227 | 203 |
top := StandardSystemView new. |
204 |
top extent:300@100. |
|
205 |
button1 := Button label:'b1' in:top. |
|
206 |
button1 origin:0.0@0.0 corner:0.5@30. |
|
207 |
button2 := Button label:'b2' in:top. |
|
208 |
button2 origin:0.5@0.0 corner:1.0@30. |
|
209 |
infoView := Label label:'info ...' in:top. |
|
210 |
infoView level:-1; origin:0.0@1.0 corner:1.0@1.0. |
|
211 |
infoView topInset:(infoView preferredExtent y negated - 3); |
|
212 |
leftInset:3; |
|
213 |
rightInset:3; |
|
214 |
bottomInset:3; |
|
215 |
adjust:#left. |
|
216 |
top model:app. '<-- normally this would be: top application:app'. |
|
217 |
top open |
|
218 |
[exEnd] |
|
59 | 219 |
" |
220 |
! ! |
|
221 |
||
338
071f92621e3b
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
222 |
!ActiveHelp class methodsFor:'initialization'! |
59 | 223 |
|
224 |
initialize |
|
233 | 225 |
"set default delay & help-display times" |
226 |
||
1657 | 227 |
ShowTime := 10. |
228 |
DelayTime := 0.4. |
|
92 | 229 |
|
230 |
" |
|
231 |
ActiveHelp initialize |
|
232 |
" |
|
233 | 233 |
|
234 |
"Modified: 27.4.1996 / 15:07:27 / cg" |
|
59 | 235 |
! ! |
236 |
||
633 | 237 |
!ActiveHelp class methodsFor:'queries'! |
100 | 238 |
|
632
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
239 |
currentHelpListener |
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
240 |
"return the activeHelp listener if activeHelp is turned on, nil otherwise" |
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
241 |
|
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
242 |
^ TheOneAndOnlyHelpListener |
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
243 |
|
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
244 |
"Created: 28.6.1997 / 13:59:44 / cg" |
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
245 |
! |
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
246 |
|
1892 | 247 |
delayTime |
2391 | 248 |
^ DelayTime ? 0.4 |
1892 | 249 |
! |
250 |
||
233 | 251 |
isActive |
252 |
"return true, if activeHelp is turned on" |
|
253 |
||
138 | 254 |
^ TheOneAndOnlyHelpListener notNil |
233 | 255 |
|
256 |
"Modified: 27.4.1996 / 15:07:57 / cg" |
|
1892 | 257 |
! |
258 |
||
259 |
showTime |
|
2391 | 260 |
^ ShowTime ? 10 |
633 | 261 |
! ! |
262 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
263 |
!ActiveHelp class methodsFor:'start & stop'! |
59 | 264 |
|
265 |
start |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
266 |
"start activeHelp for all apps" |
233 | 267 |
|
2391 | 268 |
TheOneAndOnlyHelpListener notNil ifTrue:[ |
269 |
TheOneAndOnlyHelpListener stop. |
|
270 |
TheOneAndOnlyHelpListener := nil. |
|
271 |
]. |
|
272 |
||
59 | 273 |
TheOneAndOnlyHelpListener isNil ifTrue:[ |
233 | 274 |
TheOneAndOnlyHelpListener := self new. |
59 | 275 |
]. |
2391 | 276 |
TheOneAndOnlyHelpListener start. |
277 |
^ TheOneAndOnlyHelpListener |
|
59 | 278 |
|
279 |
" |
|
280 |
ActiveHelp start |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
281 |
FlyByHelp start |
59 | 282 |
" |
233 | 283 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
284 |
"Modified: / 26.10.1997 / 23:16:54 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
285 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
286 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
287 |
startFor:anApplicationOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
288 |
"start activeHelp for a single app" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
289 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
290 |
TheOneAndOnlyHelpListener isNil ifTrue:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
291 |
TheOneAndOnlyHelpListener := self new. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
292 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
293 |
TheOneAndOnlyHelpListener listenFor:anApplicationOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
294 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
295 |
"Modified: / 26.10.1997 / 23:17:05 / cg" |
59 | 296 |
! |
297 |
||
298 |
stop |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
299 |
"stop activeHelp for all (except for individual apps)" |
233 | 300 |
|
59 | 301 |
TheOneAndOnlyHelpListener notNil ifTrue:[ |
2391 | 302 |
TheOneAndOnlyHelpListener stop. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
303 |
TheOneAndOnlyHelpListener := nil. |
59 | 304 |
]. |
305 |
||
306 |
" |
|
307 |
ActiveHelp stop |
|
1543 | 308 |
FlyByHelp stop |
59 | 309 |
" |
233 | 310 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
311 |
"Modified: / 26.10.1997 / 23:18:58 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
312 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
313 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
314 |
stopFor:anAppOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
315 |
"stop activeHelp for a single app" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
316 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
317 |
TheOneAndOnlyHelpListener notNil ifTrue:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
318 |
TheOneAndOnlyHelpListener unlistenFor:anAppOrTopView. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
319 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
320 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
321 |
"Modified: / 26.10.1997 / 23:12:55 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
322 |
"Created: / 26.10.1997 / 23:18:41 / cg" |
138 | 323 |
! ! |
324 |
||
338
071f92621e3b
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
325 |
!ActiveHelp class methodsFor:'times'! |
138 | 326 |
|
327 |
delayTime:numberOfSeconds |
|
328 |
"set the delay (the time, the cursor has to be in the view |
|
329 |
before help is shown). The default is 2 seconds." |
|
330 |
||
331 |
DelayTime := numberOfSeconds |
|
332 |
||
333 |
" |
|
334 |
ActiveHelp delayTime:0.5 |
|
335 |
ActiveHelp delayTime:2 |
|
336 |
ActiveHelp delayTime:10 |
|
337 |
" |
|
59 | 338 |
! |
339 |
||
138 | 340 |
showTime:numberOfSeconds |
341 |
"set the number of seconds, a help messages is to be shown. |
|
2391 | 342 |
The default is 10 seconds." |
138 | 343 |
|
344 |
ShowTime := numberOfSeconds |
|
345 |
||
346 |
" |
|
347 |
ActiveHelp showTime:10 |
|
348 |
ActiveHelp showTime:99999 |
|
349 |
ActiveHelp showTime:30 |
|
350 |
" |
|
351 |
! ! |
|
352 |
||
2391 | 353 |
!ActiveHelp methodsFor:'event handling'! |
138 | 354 |
|
1011
53514f2c18a7
also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
355 |
buttonMotion:state x:x y:y view:aView |
1657 | 356 |
"handle motion events - prepare to show help" |
233 | 357 |
|
1948
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
358 |
state == 0 ifTrue:[ |
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
359 |
self handleMouseIn:aView x:x y:y. |
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
360 |
]. |
138 | 361 |
^ false |
362 |
! |
|
363 |
||
364 |
buttonPress:state x:x y:y view:view |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
365 |
"unconditionally hide the help view" |
233 | 366 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
367 |
self hideHelpIgnoringErrors. |
138 | 368 |
^ false |
233 | 369 |
|
1011
53514f2c18a7
also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
370 |
"Modified: / 28.7.1998 / 02:52:00 / cg" |
138 | 371 |
! |
372 |
||
1591 | 373 |
keyPress:key x:x y:y view:view |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
374 |
"unconditionally hide the help view" |
233 | 375 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
376 |
self hideHelpIgnoringErrors. |
138 | 377 |
^ false |
233 | 378 |
|
379 |
"Modified: 27.4.1996 / 15:09:57 / cg" |
|
138 | 380 |
! |
381 |
||
382 |
pointerEnter:state x:x y:y view:aView |
|
1657 | 383 |
"handle pointer entering a view; prepare to show help" |
233 | 384 |
|
1948
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
385 |
state == 0 ifTrue:[ |
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
386 |
self handleMouseIn:aView x:x y:y. |
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
387 |
]. |
1657 | 388 |
^ false |
138 | 389 |
! |
390 |
||
2371
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
391 |
pointerLeave:state view:aView |
233 | 392 |
"handle pointer leaving a view; hide help text" |
393 |
||
2371
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
394 |
|sensor| |
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
395 |
|
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
396 |
sensor := aView sensor. |
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
397 |
sensor notNil ifTrue:[ |
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
398 |
sensor flushEventsFor:self withType:#initiateHelpFor:at:. |
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
399 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
400 |
self hideHelpIgnoringErrors. |
138 | 401 |
^ false |
59 | 402 |
! ! |
403 |
||
2391 | 404 |
!ActiveHelp methodsFor:'help texts'! |
59 | 405 |
|
2130 | 406 |
helpTextFor:aView at:aDevicePointOrNil |
233 | 407 |
"retrieve helptext for aView as a string; |
100 | 408 |
walk along the views superView chain, |
409 |
asking models and views encountered while walking. |
|
410 |
The first one who understands and returns a nonNil answer to the |
|
233 | 411 |
#helpTextFor:at: or #helpTextFor: message ends this search and the |
100 | 412 |
returned string is returned." |
413 |
||
2130 | 414 |
|model app1 app2 text v sv topView domainPointOrNil| |
59 | 415 |
|
2130 | 416 |
aView transformation notNil ifTrue:[ |
417 |
domainPointOrNil := aView transformation applyInverseTo:aDevicePointOrNil. |
|
418 |
] ifFalse:[ |
|
419 |
domainPointOrNil := aDevicePointOrNil. |
|
420 |
]. |
|
421 |
||
422 |
text := self helpTextFromView:aView at:domainPointOrNil. |
|
2076 | 423 |
text notNil ifTrue:[ ^ text ]. |
424 |
||
1549
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
425 |
((aView respondsTo:#application) |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
426 |
and:[ (app1 := aView application) notNil ]) ifTrue:[ |
2130 | 427 |
text := self helpTextFromModel:app1 view:aView at:domainPointOrNil. |
1549
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
428 |
text notNil ifTrue:[ ^ text ]. |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
429 |
] ifFalse:[ |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
430 |
"/ old style (i.e. StandardSystemView ...) |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
431 |
topView := aView topView. |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
432 |
(topView notNil and:[topView ~~ aView]) ifTrue:[ |
2130 | 433 |
text := self helpTextFromModel:topView view:aView at:domainPointOrNil. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
434 |
text notNil ifTrue:[ ^ text ]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
435 |
] |
59 | 436 |
]. |
1549
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
437 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
438 |
(model := aView model) notNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
439 |
model ~~ app1 ifTrue:[ |
2130 | 440 |
text := self helpTextFromModel:model view:aView at:domainPointOrNil. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
441 |
text notNil ifTrue:[ ^ text ]. |
1502 | 442 |
]. |
1011
53514f2c18a7
also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
443 |
]. |
2130 | 444 |
text := self helpTextFromView:aView at:domainPointOrNil. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
445 |
text notNil ifTrue:[ ^ text ]. |
59 | 446 |
|
447 |
"walk up the chain - maybe someone knows about its subview ..." |
|
448 |
v := aView. |
|
1502 | 449 |
[ |
450 |
(sv := v container) notNil |
|
451 |
] whileTrue:[ |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
452 |
(model := sv model) notNil ifTrue:[ |
2130 | 453 |
text := self helpTextFromModel:model view:aView at:domainPointOrNil. |
1502 | 454 |
text notNil ifTrue:[ ^ text ]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
455 |
]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
456 |
text := self helpTextFromView:sv at:nil. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
457 |
text notNil ifTrue:[ ^ text ]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
458 |
v := sv |
602 | 459 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
460 |
|
100 | 461 |
(v notNil and:[v respondsTo:#application]) ifTrue:[ |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
462 |
(app2 := v application) notNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
463 |
(app2 ~~ app1) ifTrue:[ |
2130 | 464 |
text := self helpTextFromModel:app2 view:aView at:domainPointOrNil. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
465 |
text notNil ifTrue:[ ^ text ]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
466 |
] |
233 | 467 |
] |
100 | 468 |
]. |
469 |
(v notNil and:[v respondsTo:#model]) ifTrue:[ |
|
233 | 470 |
(model := v model) notNil ifTrue:[ |
2130 | 471 |
text := self helpTextFromModel:model view:aView at:domainPointOrNil. |
1502 | 472 |
text notNil ifTrue:[ ^ text ]. |
233 | 473 |
] |
100 | 474 |
]. |
59 | 475 |
^ nil |
100 | 476 |
|
728 | 477 |
"Modified: / 31.8.1995 / 20:38:00 / claus" |
1011
53514f2c18a7
also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
478 |
"Modified: / 28.7.1998 / 01:47:27 / cg" |
100 | 479 |
! |
480 |
||
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
481 |
helpTextFromModel:aModel view:aView at:aPointOrNil |
1502 | 482 |
"helper: ask aModel for its helpText." |
483 |
||
1996 | 484 |
|text text2| |
1502 | 485 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
486 |
aPointOrNil notNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
487 |
(aModel respondsTo:#helpTextFor:at:) ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
488 |
text := aModel helpTextFor:aView at:aPointOrNil. |
2076 | 489 |
text notNil ifTrue:[^ text]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
490 |
]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
491 |
]. |
2076 | 492 |
(aModel respondsTo:#helpTextFor:) ifTrue:[ |
493 |
text := aModel helpTextFor:aView. |
|
494 |
text notNil ifTrue:[ |
|
495 |
text2 := self helpTextFromView:aView at:aPointOrNil. |
|
496 |
text2 notNil ifTrue:[ ^ text2 ]. |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
497 |
]. |
1502 | 498 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
499 |
^ text |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
500 |
! |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
501 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
502 |
helpTextFromView:aView at:aPointOrNil |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
503 |
"helper: ask aView for its helpText." |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
504 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
505 |
|text| |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
506 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
507 |
aPointOrNil notNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
508 |
(aView respondsTo:#helpTextAt:) ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
509 |
text := aView helpTextAt:aPointOrNil. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
510 |
]. |
1502 | 511 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
512 |
text isNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
513 |
(aView respondsTo:#helpText) ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
514 |
text := aView helpText. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
515 |
]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
516 |
]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
517 |
^ text. |
2391 | 518 |
! ! |
519 |
||
520 |
!ActiveHelp methodsFor:'private'! |
|
1502 | 521 |
|
138 | 522 |
hideIfPointerLeft:aView |
233 | 523 |
"hide help, if the pointer is not in aView" |
138 | 524 |
! |
525 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
526 |
interestedIn:aView |
1033
3a56ba930052
care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
527 |
"return true, if I am interested in aView (either listeningForAll, |
3a56ba930052
care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
528 |
or in my list of apps)" |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
529 |
|
1106 | 530 |
|app aViewsTopView| |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
531 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
532 |
aView isNil ifTrue:[^ false]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
533 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
534 |
listeningForAll == true ifTrue:[^ true]. |
1957 | 535 |
applicationsOrTopViewsWithHelp isEmptyOrNil ifTrue:[^ false]. |
1033
3a56ba930052
care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
536 |
|
1106 | 537 |
aViewsTopView := aView topView. |
538 |
(applicationsOrTopViewsWithHelp includesIdentical:aViewsTopView) ifTrue:[^ true]. |
|
539 |
app := aViewsTopView application. |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
540 |
app notNil ifTrue:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
541 |
(applicationsOrTopViewsWithHelp includesIdentical:app) ifTrue:[^ true] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
542 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
543 |
^ false |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
544 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
545 |
"Created: / 26.10.1997 / 23:28:52 / cg" |
1033
3a56ba930052
care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
546 |
"Modified: / 8.8.1998 / 13:36:19 / cg" |
59 | 547 |
! ! |
548 |
||
2391 | 549 |
!ActiveHelp methodsFor:'queries'! |
550 |
||
551 |
delayTime |
|
552 |
^ self class delayTime |
|
553 |
! |
|
554 |
||
555 |
showTime |
|
556 |
^ self class showTime |
|
557 |
! ! |
|
558 |
||
1768 | 559 |
!ActiveHelp methodsFor:'show & hide help'! |
59 | 560 |
|
1657 | 561 |
handleMouseIn:aView x:x y:y |
562 |
"handle motion events - if the mousepointer left the |
|
563 |
previous helped view, hide the help" |
|
564 |
||
1713
bc8a1d16e60f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
1657
diff
changeset
|
565 |
Error handle:[:ex | |
1657 | 566 |
ex description infoPrintCR. |
567 |
ex suspendedContext fullPrintAll. |
|
568 |
ex return |
|
569 |
] do:[ |
|
1909
a667507d3e0b
help via event-queue (helpTextFor: invoked by wgroup-process)
Claus Gittinger <cg@exept.de>
parents:
1892
diff
changeset
|
570 |
|sensor| |
a667507d3e0b
help via event-queue (helpTextFor: invoked by wgroup-process)
Claus Gittinger <cg@exept.de>
parents:
1892
diff
changeset
|
571 |
|
1657 | 572 |
(self interestedIn:aView) ifTrue:[ |
573 |
self stopHelpDisplayProcess. |
|
574 |
self hideIfPointerLeft:aView. |
|
1909
a667507d3e0b
help via event-queue (helpTextFor: invoked by wgroup-process)
Claus Gittinger <cg@exept.de>
parents:
1892
diff
changeset
|
575 |
|
a667507d3e0b
help via event-queue (helpTextFor: invoked by wgroup-process)
Claus Gittinger <cg@exept.de>
parents:
1892
diff
changeset
|
576 |
(self interestedIn:aView) ifFalse:[ |
a667507d3e0b
help via event-queue (helpTextFor: invoked by wgroup-process)
Claus Gittinger <cg@exept.de>
parents:
1892
diff
changeset
|
577 |
^ self |
a667507d3e0b
help via event-queue (helpTextFor: invoked by wgroup-process)
Claus Gittinger <cg@exept.de>
parents:
1892
diff
changeset
|
578 |
]. |
a667507d3e0b
help via event-queue (helpTextFor: invoked by wgroup-process)
Claus Gittinger <cg@exept.de>
parents:
1892
diff
changeset
|
579 |
|
2130 | 580 |
"/ if there is a sensor, let the view do it itself (in its process) |
581 |
sensor := aView sensor. |
|
582 |
sensor notNil ifTrue:[ |
|
583 |
sensor flushEventsFor:self withType:#initiateHelpFor:at:. |
|
584 |
sensor |
|
585 |
pushUserEvent:#initiateHelpFor:at: for:self |
|
586 |
withArguments:(Array with:aView with:(x @ y)). |
|
587 |
] ifFalse:[ |
|
588 |
self initiateHelpFor:aView at:(x @ y). |
|
589 |
] |
|
1657 | 590 |
]. |
591 |
]. |
|
592 |
! |
|
593 |
||
59 | 594 |
hideHelp |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
595 |
"hide the help text - nothing done here" |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
596 |
! |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
597 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
598 |
hideHelpIgnoringErrors |
233 | 599 |
"hide the help text" |
600 |
||
1713
bc8a1d16e60f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
1657
diff
changeset
|
601 |
Error handle:[:ex | |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
602 |
ex description infoPrintCR. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
603 |
ex return |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
604 |
] do:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
605 |
self hideHelp. |
59 | 606 |
]. |
607 |
! |
|
608 |
||
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
609 |
initiateHelpFor:aView at:aPointOrNil |
634 | 610 |
"ask aView for helpText, passing x/y coordinates; |
611 |
start a timeout process to display this helpText after some delay; |
|
612 |
Normally used internally, but can also be used by widgets to force |
|
613 |
re-negotiation of the displayed helpText |
|
614 |
(for example in a menu, when the selection changes)" |
|
615 |
||
1657 | 616 |
self initiateHelpFor:aView at:aPointOrNil now:false |
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
617 |
|
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
618 |
"Modified: 28.6.1997 / 14:45:57 / cg" |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
619 |
! |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
620 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
621 |
initiateHelpFor:aView at:aPointOrNil now:showItNow |
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
622 |
"ask aView for helpText, passing x/y coordinates; |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
623 |
start a timeout process to display this helpText after some delay; |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
624 |
Normally used internally, but can also be used by widgets to force |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
625 |
re-negotiation of the displayed helpText |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
626 |
(for example in a menu, when the selection changes)" |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
627 |
|
696 | 628 |
|text top app| |
634 | 629 |
|
1143 | 630 |
(self interestedIn:aView) ifFalse:[ |
631 |
^ self |
|
632 |
]. |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
633 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
634 |
text := self helpTextFor:aView at:aPointOrNil. |
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
635 |
lastHelpText = text ifTrue:[ |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
636 |
^ self |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
637 |
]. |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
638 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
639 |
"/ let application show the help |
728 | 640 |
"/ (i.e. in its own information area) |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
641 |
"/ nil-text is also passed down, to give it a chance |
728 | 642 |
"/ to clean its infoDisplay. |
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
643 |
|
728 | 644 |
top := aView topView. |
645 |
(app := aView application) notNil ifTrue:[ |
|
1019
862f095da4ac
#showHelp:for: renamed to #showActiveHelp:for:
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
646 |
(app showActiveHelp:text for:aView) ifTrue:[ |
728 | 647 |
lastHelpText := text. |
632
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
648 |
] |
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
649 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
650 |
! |
59 | 651 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
652 |
stopHelpDisplayProcess |
59 | 653 |
! ! |
654 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
655 |
!ActiveHelp methodsFor:'start & stop'! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
656 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
657 |
listenFor:anAppOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
658 |
"start listening" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
659 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
660 |
applicationsOrTopViewsWithHelp isNil ifTrue:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
661 |
applicationsOrTopViewsWithHelp := WeakIdentitySet new. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
662 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
663 |
applicationsOrTopViewsWithHelp add:anAppOrTopView. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
664 |
super listen. |
639 | 665 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
666 |
"Created: / 26.10.1997 / 23:20:47 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
667 |
"Modified: / 26.10.1997 / 23:21:10 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
668 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
669 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
670 |
listenForAll |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
671 |
"start listening" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
672 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
673 |
listeningForAll := true. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
674 |
super listen. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
675 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
676 |
"Modified: / 28.6.1997 / 15:07:02 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
677 |
"Created: / 26.10.1997 / 23:19:30 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
678 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
679 |
|
2391 | 680 |
start |
681 |
self listenForAll |
|
682 |
! |
|
683 |
||
684 |
stop |
|
685 |
self unlistenAll |
|
686 |
! |
|
687 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
688 |
unlistenAll |
639 | 689 |
"stop listening" |
690 |
||
691 |
self hideHelp. |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
692 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
693 |
listeningForAll := false. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
694 |
applicationsOrTopViewsWithHelp size == 0 ifTrue:[ |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
695 |
self unlisten. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
696 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
697 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
698 |
"Created: / 26.10.1997 / 23:14:17 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
699 |
"Modified: / 26.10.1997 / 23:23:04 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
700 |
! |
639 | 701 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
702 |
unlistenFor:anApp |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
703 |
"stop listening for an app" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
704 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
705 |
self hideHelp. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
706 |
|
1543 | 707 |
applicationsOrTopViewsWithHelp isNil ifFalse:[ |
708 |
applicationsOrTopViewsWithHelp remove:anApp ifAbsent:nil. |
|
709 |
]. |
|
726 | 710 |
listeningForAll == true ifFalse:[ |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
711 |
applicationsOrTopViewsWithHelp size == 0 ifTrue:[ |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
712 |
self unlisten. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
713 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
714 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
715 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
716 |
"Created: / 26.10.1997 / 23:22:42 / cg" |
726 | 717 |
"Modified: / 29.10.1997 / 15:48:34 / cg" |
639 | 718 |
! ! |
719 |
||
338
071f92621e3b
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
720 |
!ActiveHelp class methodsFor:'documentation'! |
138 | 721 |
|
722 |
version |
|
2391 | 723 |
^ '$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.60 2008-02-26 10:25:51 cg Exp $' |
138 | 724 |
! ! |
1657 | 725 |
|
59 | 726 |
ActiveHelp initialize! |