author | Claus Gittinger <cg@exept.de> |
Sun, 23 Feb 2020 16:01:31 +0100 | |
changeset 4450 | c07db2570587 |
parent 4435 | f564126c2ad9 |
permissions | -rw-r--r-- |
4431 | 1 |
"{ Encoding: utf8 }" |
2 |
||
59 | 3 |
" |
4 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1502 | 14 |
"{ Package: 'stx:libview2' }" |
15 |
||
3447 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
59 | 18 |
EventListener subclass:#ActiveHelp |
3227 | 19 |
instanceVariableNames:'lastHelpText listeningForAll applicationsOrTopViewsWithHelp |
4367 | 20 |
lastHelpWidget lastPointerPosition pointerPositionAtShowTime |
21 |
suspended' |
|
4371 | 22 |
classVariableNames:'Debugging DebuggingEvents DebuggingHelpText Suspended DoHelpKey' |
216 | 23 |
poolDictionaries:'' |
24 |
category:'Interface-Help' |
|
59 | 25 |
! |
26 |
||
1892 | 27 |
ActiveHelp class instanceVariableNames:'DelayTime ShowTime TheOneAndOnlyHelpListener' |
28 |
||
29 |
" |
|
30 |
No other class instance variables are inherited by this class. |
|
31 |
" |
|
32 |
! |
|
33 |
||
338
071f92621e3b
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
34 |
!ActiveHelp class methodsFor:'documentation'! |
59 | 35 |
|
138 | 36 |
copyright |
37 |
" |
|
38 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
39 |
All Rights Reserved |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
" |
|
48 |
||
59 | 49 |
! |
50 |
||
51 |
documentation |
|
52 |
" |
|
3664 | 53 |
The active help (tooltip) listener. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
54 |
|
98 | 55 |
The one and only instance of myself intercepts incoming mouse & keyboard |
56 |
events for the display device, being especially interested in view-enter/ |
|
636 | 57 |
leave events. When such an event arrives, it asks the corresponding view |
3219 | 58 |
or its model for a help message and displays it via an ActiveHelpView. |
59 |
Actually, the view is first asked if it would like to display it itself |
|
60 |
- for example, in some information-view at the bottom of its main window. |
|
636 | 61 |
|
3664 | 62 |
The query for the helpText is repeated along the view's superView chain, |
63 |
until any model or view returns a nonNil answer for the |
|
64 |
#helpTextFor:<aSubView> at:<position> or #helpTextFor:<aSubView> message. |
|
100 | 65 |
|
98 | 66 |
All I need for automatic help is some model/view/applicationModel along |
67 |
the superview chain of the entered component, which responds to the |
|
68 |
#helpTextFor: message with a non-nil (string-) answer. |
|
69 |
I close down the help view after a while, if a key is pressed or the mouse |
|
70 |
moved to another view. |
|
100 | 71 |
|
72 |
Who should provide the helpText: |
|
221 | 73 |
the best place is the application object (an instance of ApplicationModel) |
3884 | 74 |
or the topView, if it's a derived class of StandardSystemView. |
221 | 75 |
This should know about its components and return the string |
3664 | 76 |
when asked via #helpTextFor:<aSubView>. |
330
d7ce98930ad3
Rename Launcher-->OldLauncher, NewLauncher-->Launcher.
Stefan Vogel <sv@exept.de>
parents:
297
diff
changeset
|
77 |
See examples in FileBrowser, Launcher etc. |
100 | 78 |
|
79 |
Be aware, that for applicationModels, there must be a link from the |
|
80 |
topView to this applicationModel |
|
81 |
(set via: aTopView application:anApplicationModel) |
|
82 |
otherwise, the helpManager has no means of finding the application which |
|
83 |
corresponds to a view. |
|
84 |
||
85 |
Who should display the helpText: |
|
221 | 86 |
by default, the helpListener opens a little popup view, which displays the |
87 |
returned help message. However, a nice trick which can be used by applications |
|
88 |
is to create an infoLabel as a subview of the topFrame (a la windows) |
|
89 |
and display the text right in the #helpTextFor: method. To cheat the |
|
90 |
help listener, this method should then return nil, to keep it silent. |
|
91 |
||
92 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
93 |
Usage: |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
94 |
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
|
95 |
use 'ActiveHelp start' and 'ActiveHelp stop'. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
96 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
97 |
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
|
98 |
'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
|
99 |
the topView or the topViews application as argument. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
100 |
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
|
101 |
some infoView. |
3664 | 102 |
Late note: thsi is no longer recommended - one such mouse watcher process is |
103 |
good enough for all views. |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
104 |
|
221 | 105 |
[author:] |
106 |
Claus Gittinger |
|
107 |
||
233 | 108 |
[start with:] |
109 |
ActiveHelp start |
|
110 |
ActiveHelp stop |
|
111 |
||
221 | 112 |
[See also:] |
233 | 113 |
ActiveHelpView |
114 |
WindowGroup WindowEvent |
|
115 |
ApplicationModel StandardSystemView |
|
100 | 116 |
" |
117 |
! |
|
118 |
||
119 |
examples |
|
120 |
" |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
121 |
Active Help for a single view |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
122 |
or app (whatever the global settings are): |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
123 |
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
|
124 |
[exBegin] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
125 |
|app top myAppClass| |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
126 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
127 |
Class withoutUpdatingChangesDo:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
128 |
myAppClass := ApplicationModel |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
129 |
subclass:#'Demos::DemoApp' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
130 |
instanceVariableNames:'' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
131 |
classVariableNames:'' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
132 |
poolDictionaries:'' |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
133 |
category:'demos'. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
134 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
135 |
myAppClass |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
136 |
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
|
137 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
138 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
139 |
app := myAppClass new. |
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 |
top := StandardSystemView new. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
142 |
top extent:300@100. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
143 |
top application:app. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
144 |
top open. |
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 |
ActiveHelp startFor:app. |
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 |
Class withoutUpdatingChangesDo:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
149 |
myAppClass removeFromSystem |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
150 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
151 |
[exEnd] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
152 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
153 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
154 |
Active Help (for all views): |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
155 |
|
233 | 156 |
(make certain that activeHelp is turned on ... |
157 |
... otherwise, you will see nothing) |
|
100 | 158 |
|
159 |
the following example uses a Plug as a model replacement. |
|
160 |
In concrete application, you would create a method to implement the helpText |
|
161 |
query message. |
|
227 | 162 |
[exBegin] |
163 |
|app top button1 button2| |
|
100 | 164 |
|
227 | 165 |
app := Plug new. |
166 |
app respondTo:#helpTextFor: |
|
167 |
with:[:view | |
|
168 |
view == button1 ifTrue:[ |
|
169 |
'this is button1' |
|
170 |
] ifFalse:[ |
|
171 |
view == button2 ifTrue:[ |
|
172 |
'some help for button2' |
|
173 |
] ifFalse:[ |
|
174 |
nil |
|
175 |
] |
|
176 |
] |
|
177 |
]. |
|
100 | 178 |
|
227 | 179 |
top := StandardSystemView new. |
180 |
top extent:300@100. |
|
181 |
button1 := Button label:'b1' in:top. |
|
182 |
button1 origin:0.0@0.0 corner:0.5@30. |
|
183 |
button2 := Button label:'b2' in:top. |
|
184 |
button2 origin:0.5@0.0 corner:1.0@30. |
|
185 |
top model:app. '<-- normally this would be: top application:app'. |
|
186 |
top open |
|
187 |
[exEnd] |
|
100 | 188 |
|
233 | 189 |
(make certain that activeHelp is turned on ... |
190 |
... otherwise, you will see nothing) |
|
191 |
||
227 | 192 |
alternatively, display of the helpMessage in a local, private view: |
193 |
[exBegin] |
|
194 |
|app top button1 button2 infoView| |
|
100 | 195 |
|
227 | 196 |
app := Plug new. |
197 |
app respondTo:#helpTextFor: |
|
198 |
with:[:view | infoView label:'info ...'. |
|
199 |
view == button1 ifTrue:[ |
|
200 |
infoView label:'this is button1' |
|
201 |
]. |
|
202 |
view == button2 ifTrue:[ |
|
203 |
infoView label:'some help for button2' |
|
204 |
]. |
|
205 |
nil |
|
206 |
]. |
|
100 | 207 |
|
227 | 208 |
top := StandardSystemView new. |
209 |
top extent:300@100. |
|
210 |
button1 := Button label:'b1' in:top. |
|
211 |
button1 origin:0.0@0.0 corner:0.5@30. |
|
212 |
button2 := Button label:'b2' in:top. |
|
213 |
button2 origin:0.5@0.0 corner:1.0@30. |
|
214 |
infoView := Label label:'info ...' in:top. |
|
215 |
infoView level:-1; origin:0.0@1.0 corner:1.0@1.0. |
|
216 |
infoView topInset:(infoView preferredExtent y negated - 3); |
|
217 |
leftInset:3; |
|
218 |
rightInset:3; |
|
219 |
bottomInset:3; |
|
220 |
adjust:#left. |
|
221 |
top model:app. '<-- normally this would be: top application:app'. |
|
222 |
top open |
|
223 |
[exEnd] |
|
59 | 224 |
" |
225 |
! ! |
|
226 |
||
3320 | 227 |
!ActiveHelp class methodsFor:'initialization'! |
228 |
||
229 |
initialize |
|
230 |
Debugging := false. |
|
4134 | 231 |
DebuggingEvents := false. |
4122 | 232 |
DebuggingHelpText := false. |
233 |
||
4134 | 234 |
"Modified: / 19-06-2018 / 12:53:36 / Claus Gittinger" |
3320 | 235 |
! ! |
236 |
||
2975 | 237 |
!ActiveHelp class methodsFor:'accessing'! |
238 |
||
4401 | 239 |
currentHelpListener |
240 |
"return the activeHelp listener if activeHelp is turned on, nil otherwise" |
|
241 |
||
242 |
^ TheOneAndOnlyHelpListener |
|
243 |
||
244 |
" |
|
245 |
ActiveHelp currentHelpListener |
|
246 |
FlyByHelp currentHelpListener |
|
247 |
" |
|
248 |
||
249 |
"Created: 28.6.1997 / 13:59:44 / cg" |
|
250 |
! |
|
251 |
||
2975 | 252 |
debugging |
4122 | 253 |
^ Debugging ? false |
2975 | 254 |
|
255 |
"Modified: / 22-12-2011 / 10:46:30 / cg" |
|
4122 | 256 |
"Modified: / 11-06-2018 / 10:27:40 / Claus Gittinger" |
2975 | 257 |
! |
258 |
||
4122 | 259 |
debugging:aBoolean |
260 |
Debugging := aBoolean. |
|
2975 | 261 |
|
262 |
" |
|
263 |
self debugging:true |
|
264 |
self debugging:false |
|
265 |
" |
|
266 |
||
267 |
"Modified (comment): / 22-12-2011 / 10:43:32 / cg" |
|
4122 | 268 |
"Modified (format): / 11-06-2018 / 10:30:30 / Claus Gittinger" |
269 |
! |
|
270 |
||
271 |
debuggingHelpText |
|
272 |
^ DebuggingHelpText ? false |
|
273 |
||
274 |
"Created: / 11-06-2018 / 10:30:10 / Claus Gittinger" |
|
275 |
! |
|
276 |
||
277 |
debuggingHelpText:aBoolean |
|
278 |
DebuggingHelpText := aBoolean. |
|
279 |
||
280 |
" |
|
281 |
self debuggingHelpText:true |
|
282 |
self debuggingHelpText:false |
|
283 |
" |
|
284 |
||
285 |
"Created: / 11-06-2018 / 10:30:24 / Claus Gittinger" |
|
4235 | 286 |
! |
287 |
||
4401 | 288 |
delayTime |
289 |
^ DelayTime ? 0.4 |
|
290 |
! |
|
291 |
||
292 |
delayTime:numberOfSeconds |
|
293 |
"set the delay (the time, the cursor has to be in the view |
|
294 |
before help is shown). The default is 2 seconds." |
|
295 |
||
296 |
DelayTime := numberOfSeconds |
|
297 |
||
298 |
" |
|
299 |
ActiveHelp delayTime:0.5 |
|
300 |
ActiveHelp delayTime:2 |
|
301 |
ActiveHelp delayTime:10 |
|
302 |
" |
|
303 |
! |
|
304 |
||
305 |
showTime |
|
306 |
"set the number of seconds, a help messages is to be shown. |
|
307 |
The default is 15 seconds. |
|
308 |
0 means: show forever (i.e. until mouse is moved)" |
|
309 |
||
310 |
^ ShowTime ? 15 |
|
311 |
||
312 |
" |
|
313 |
self showTime |
|
314 |
" |
|
315 |
||
316 |
"Modified: / 10-11-2010 / 12:29:44 / cg" |
|
317 |
! |
|
318 |
||
319 |
showTime:numberOfSeconds |
|
320 |
"set the number of seconds, a help messages is to be shown. |
|
321 |
The default is defined in the getter. |
|
322 |
0 means: show forever (i.e. until mouse is moved)" |
|
323 |
||
324 |
ShowTime := numberOfSeconds |
|
325 |
||
326 |
" |
|
327 |
ActiveHelp showTime:10 |
|
328 |
ActiveHelp showTime:99999 |
|
329 |
ActiveHelp showTime:30 |
|
330 |
" |
|
331 |
||
332 |
"Modified: / 10-11-2010 / 12:29:40 / cg" |
|
333 |
! |
|
334 |
||
4235 | 335 |
singleton |
336 |
^ TheOneAndOnlyHelpListener |
|
337 |
||
338 |
"Created: / 27-02-2019 / 11:06:32 / Claus Gittinger" |
|
2975 | 339 |
! ! |
340 |
||
633 | 341 |
!ActiveHelp class methodsFor:'queries'! |
100 | 342 |
|
233 | 343 |
isActive |
344 |
"return true, if activeHelp is turned on" |
|
345 |
||
3347
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
346 |
TheOneAndOnlyHelpListener notNil ifTrue:[ |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
347 |
((WindowSensor eventListeners ? #()) includesIdentical:TheOneAndOnlyHelpListener) ifTrue:[ |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
348 |
^ true |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
349 |
]. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
350 |
TheOneAndOnlyHelpListener := nil. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
351 |
]. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
352 |
^ false. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
353 |
|
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
354 |
" |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
355 |
FlyByHelp isActive |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
356 |
" |
233 | 357 |
|
358 |
"Modified: 27.4.1996 / 15:07:57 / cg" |
|
633 | 359 |
! ! |
360 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
361 |
!ActiveHelp class methodsFor:'start & stop'! |
59 | 362 |
|
4235 | 363 |
initiateHelp |
364 |
"determine where the mouse pointer is located, |
|
365 |
and start showing a tooltip for it. |
|
4236 | 366 |
This can be called to force update of the tooltip, |
4235 | 367 |
in case a widget has changed its mind |
368 |
(typically: an undo menu button function might wonna do this, |
|
369 |
to show changed info)" |
|
370 |
||
4236 | 371 |
self isActive ifTrue:[ |
4235 | 372 |
TheOneAndOnlyHelpListener initiateHelp |
373 |
]. |
|
374 |
||
375 |
"Created: / 27-02-2019 / 11:08:54 / Claus Gittinger" |
|
4236 | 376 |
"Modified (comment): / 27-02-2019 / 15:56:17 / Claus Gittinger" |
4235 | 377 |
! |
378 |
||
4367 | 379 |
isSuspended |
380 |
^ Suspended ? false |
|
381 |
||
382 |
! |
|
383 |
||
384 |
resume |
|
385 |
"resume activeHelp (eg. after doing a showMeHowItWorks)" |
|
386 |
||
387 |
Suspended := false. |
|
388 |
||
389 |
" |
|
390 |
ActiveHelp resume |
|
391 |
FlyByHelp resume |
|
392 |
" |
|
393 |
! |
|
394 |
||
59 | 395 |
start |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
396 |
"start activeHelp for all apps" |
233 | 397 |
|
2391 | 398 |
TheOneAndOnlyHelpListener notNil ifTrue:[ |
399 |
TheOneAndOnlyHelpListener stop. |
|
400 |
TheOneAndOnlyHelpListener := nil. |
|
401 |
]. |
|
402 |
||
4368 | 403 |
Suspended := false. |
59 | 404 |
TheOneAndOnlyHelpListener isNil ifTrue:[ |
233 | 405 |
TheOneAndOnlyHelpListener := self new. |
59 | 406 |
]. |
2391 | 407 |
TheOneAndOnlyHelpListener start. |
408 |
^ TheOneAndOnlyHelpListener |
|
59 | 409 |
|
410 |
" |
|
411 |
ActiveHelp start |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
412 |
FlyByHelp start |
59 | 413 |
" |
233 | 414 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
415 |
"Modified: / 26.10.1997 / 23:16:54 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
416 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
417 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
418 |
startFor:anApplicationOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
419 |
"start activeHelp for a single app" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
420 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
421 |
TheOneAndOnlyHelpListener isNil ifTrue:[ |
4410 | 422 |
Suspended := false. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
423 |
TheOneAndOnlyHelpListener := self new. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
424 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
425 |
TheOneAndOnlyHelpListener listenFor:anApplicationOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
426 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
427 |
"Modified: / 26.10.1997 / 23:17:05 / cg" |
59 | 428 |
! |
429 |
||
430 |
stop |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
431 |
"stop activeHelp for all (except for individual apps)" |
233 | 432 |
|
59 | 433 |
TheOneAndOnlyHelpListener notNil ifTrue:[ |
2391 | 434 |
TheOneAndOnlyHelpListener stop. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
435 |
TheOneAndOnlyHelpListener := nil. |
59 | 436 |
]. |
437 |
||
438 |
" |
|
439 |
ActiveHelp stop |
|
1543 | 440 |
FlyByHelp stop |
59 | 441 |
" |
233 | 442 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
443 |
"Modified: / 26.10.1997 / 23:18:58 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
444 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
445 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
446 |
stopFor:anAppOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
447 |
"stop activeHelp for a single app" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
448 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
449 |
TheOneAndOnlyHelpListener notNil ifTrue:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
450 |
TheOneAndOnlyHelpListener unlistenFor:anAppOrTopView. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
451 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
452 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
453 |
"Modified: / 26.10.1997 / 23:12:55 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
454 |
"Created: / 26.10.1997 / 23:18:41 / cg" |
4367 | 455 |
! |
456 |
||
457 |
suspend |
|
458 |
"suspend activeHelp (eg. before doing a showMeHowItWorks)" |
|
459 |
||
460 |
Suspended := true. |
|
461 |
||
462 |
" |
|
463 |
ActiveHelp suspend |
|
464 |
FlyByHelp suspend |
|
465 |
" |
|
138 | 466 |
! ! |
467 |
||
2391 | 468 |
!ActiveHelp methodsFor:'event handling'! |
138 | 469 |
|
2473 | 470 |
buttonMotion:buttonAndModifierState x:x y:y view:aView |
1657 | 471 |
"handle motion events - prepare to show help" |
233 | 472 |
|
2782 | 473 |
|realViewUnderCursor realP| |
474 |
||
4407 | 475 |
(Suspended ? false) ifTrue:[^ false]. |
4363 | 476 |
(aView sensor hasButtonMotionEventFor:aView) ifTrue:[^ false]. |
477 |
||
4251 | 478 |
"/ DebuggingEvents := true |
479 |
"/ DebuggingEvents := false |
|
480 |
DebuggingEvents == true ifTrue:[ |
|
4367 | 481 |
('%1: Motion view:%2' bindWith:self className with:aView) infoPrintCR. |
4251 | 482 |
]. |
4153 | 483 |
"/ Debugging := true |
4435 | 484 |
"/ Debugging := false |
2473 | 485 |
buttonAndModifierState == 0 ifTrue:[ |
2783
cb3420e40ed1
changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2782
diff
changeset
|
486 |
"/ realViewUnderCursor := aView device viewFromPoint:(aView pointerPosition). |
cb3420e40ed1
changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2782
diff
changeset
|
487 |
"/ realP := aView device translatePoint:(x@y) fromView:aView toView:realViewUnderCursor. |
cb3420e40ed1
changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2782
diff
changeset
|
488 |
"/ self handleMouseIn:realViewUnderCursor x:realP x y:realP y. |
4431 | 489 |
DebuggingEvents ifTrue:[('%1: motion %3@%4 in %5' bindWith:self className with:aView with:x with:y) infoPrintCR]. |
2783
cb3420e40ed1
changed: #buttonMotion:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2782
diff
changeset
|
490 |
self handleMouseIn:aView x:x y:y. |
1948
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
491 |
]. |
138 | 492 |
^ false |
4122 | 493 |
|
4283 | 494 |
"Modified: / 28-06-2019 / 08:39:38 / Claus Gittinger" |
138 | 495 |
! |
496 |
||
4123 | 497 |
handleMouseIn:aView x:x y:y |
498 |
"handle motion events - if the mousepointer left the |
|
499 |
previous helped view, hide the help" |
|
500 |
||
4407 | 501 |
(Suspended ? false) ifTrue:[^ false]. |
502 |
||
4134 | 503 |
"/ Debugging := true. |
504 |
"/ Debugging := false. |
|
4431 | 505 |
Debugging ifTrue:[('%1: mouse in %2@%3' bindWith:self className with:x with:y) infoPrintCR]. |
4123 | 506 |
(self interestedIn:aView) ifFalse:[ |
4283 | 507 |
Debugging ifTrue:[('%1: not interested in view (%2)' bindWith:self className with:Timestamp now) infoPrintCR]. |
4123 | 508 |
^ self |
509 |
]. |
|
510 |
||
511 |
Error handle:[:ex | |
|
512 |
InfoPrinting == true ifTrue:[ |
|
513 |
'---------------------' infoPrintCR. |
|
514 |
ex description infoPrintCR. |
|
515 |
ex suspendedContext fullPrintAll. |
|
516 |
]. |
|
517 |
] do:[ |
|
518 |
|sensor| |
|
519 |
||
520 |
"/ self stopHelpDisplayProcess. |
|
521 |
Debugging ifTrue:['hideIf' infoPrintCR]. |
|
522 |
self hideIfPointerLeft:aView. |
|
523 |
||
524 |
"/ check again, in case the stop/hide changed something... |
|
525 |
(self interestedIn:aView) ifFalse:[ |
|
526 |
Debugging ifTrue:['not interested2' infoPrintCR]. |
|
527 |
^ self |
|
528 |
]. |
|
529 |
||
4367 | 530 |
self class isSuspended ifTrue:[^ self]. |
531 |
||
4123 | 532 |
"/ if there is a sensor, let the view do it itself (in its process) |
533 |
(self targetViewInitiatesHelpViaSensor |
|
534 |
and:[ (sensor := aView sensor) notNil ]) |
|
535 |
ifTrue:[ |
|
4431 | 536 |
"/ Debugging ifTrue:[('%1 target shows help' bindWith:self className) infoPrintCR]. |
4123 | 537 |
sensor flushEventsFor:self withType:#initiateHelpFor:at:. |
538 |
sensor |
|
539 |
pushUserEvent:#initiateHelpFor:at: for:self |
|
540 |
withArguments:(Array with:aView with:(x @ y)). |
|
541 |
] ifFalse:[ |
|
4153 | 542 |
Debugging ifTrue:['I show help' infoPrintCR]. |
4123 | 543 |
self initiateHelpFor:aView at:(x @ y). |
544 |
] |
|
545 |
]. |
|
546 |
||
4283 | 547 |
"Modified: / 28-06-2019 / 08:39:58 / Claus Gittinger" |
4123 | 548 |
! |
549 |
||
1591 | 550 |
keyPress:key x:x y:y view:view |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
551 |
"unconditionally hide the help view" |
233 | 552 |
|
4251 | 553 |
Debugging ifTrue:[ |
4283 | 554 |
('%1: key press: %2' bindWith:self className with:key) infoPrintCR |
4251 | 555 |
]. |
4371 | 556 |
DoHelpKey == true ifTrue:[ |
557 |
key == #Help ifTrue:[ |
|
558 |
self initiateHelpFor:view at:(x @ y). |
|
559 |
^ true. |
|
560 |
]. |
|
4153 | 561 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
562 |
self hideHelpIgnoringErrors. |
138 | 563 |
^ false |
233 | 564 |
|
4153 | 565 |
"Modified: / 27-04-1996 / 15:09:57 / cg" |
4283 | 566 |
"Modified: / 28-06-2019 / 08:40:11 / Claus Gittinger" |
4153 | 567 |
! |
568 |
||
569 |
keyRelease:key x:x y:y view:view |
|
570 |
"unconditionally hide the help view" |
|
571 |
||
4251 | 572 |
Debugging ifTrue:[ |
4283 | 573 |
('%1: key release: %2' bindWith:self className with:key) infoPrintCR |
4251 | 574 |
]. |
575 |
||
4153 | 576 |
self hideHelpIgnoringErrors. |
577 |
^ false |
|
578 |
||
579 |
"Created: / 02-08-2018 / 16:16:19 / Claus Gittinger" |
|
4283 | 580 |
"Modified: / 28-06-2019 / 08:40:17 / Claus Gittinger" |
138 | 581 |
! |
582 |
||
583 |
pointerEnter:state x:x y:y view:aView |
|
1657 | 584 |
"handle pointer entering a view; prepare to show help" |
233 | 585 |
|
4407 | 586 |
(Suspended ? false) ifTrue:[^ false]. |
587 |
||
4251 | 588 |
"/ DebuggingEvents := true |
589 |
"/ DebuggingEvents := false |
|
590 |
DebuggingEvents == true ifTrue:[ |
|
4283 | 591 |
('%1: PointerEnter view:%2' bindWith:self className with:aView) infoPrintCR. |
4251 | 592 |
]. |
1948
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
593 |
state == 0 ifTrue:[ |
33eb423a6fd3
only act when no mouse-button is pressed
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
594 |
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
|
595 |
]. |
1657 | 596 |
^ false |
4283 | 597 |
|
598 |
"Modified: / 28-06-2019 / 08:40:23 / Claus Gittinger" |
|
138 | 599 |
! |
600 |
||
2371
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
601 |
pointerLeave:state view:aView |
233 | 602 |
"handle pointer leaving a view; hide help text" |
603 |
||
2371
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
604 |
|sensor| |
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
605 |
|
4407 | 606 |
(Suspended ? false) ifTrue:[^ false]. |
607 |
||
4251 | 608 |
"/ DebuggingEvents := true |
609 |
"/ DebuggingEvents := false |
|
610 |
DebuggingEvents == true ifTrue:[ |
|
4283 | 611 |
('%1: PointerLeave view: %2' bindWith:self className with:aView) infoPrintCR. |
4251 | 612 |
]. |
2371
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
613 |
sensor := aView sensor. |
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
614 |
sensor notNil ifTrue:[ |
4ab6c8c7bc03
flush enqueued help-activation event when we leave a view
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
615 |
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
|
616 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
617 |
self hideHelpIgnoringErrors. |
138 | 618 |
^ false |
4283 | 619 |
|
620 |
"Modified: / 28-06-2019 / 08:40:29 / Claus Gittinger" |
|
2914
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
621 |
! |
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
622 |
|
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
623 |
processEvent:ev |
4407 | 624 |
(Suspended ? false) ifTrue:[^ false]. |
625 |
||
4251 | 626 |
"/ DebuggingEvents := true |
627 |
"/ DebuggingEvents := false |
|
628 |
false "DebuggingEvents == true" ifTrue:[ |
|
629 |
('%1: === event: %2 view:%3' |
|
4283 | 630 |
bindWith:self className |
4251 | 631 |
with:ev class nameWithoutPrefix |
632 |
with:ev view) infoPrintCR. |
|
3292 | 633 |
]. |
4407 | 634 |
|
2914
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
635 |
(ev isPointerEnterLeaveEvent |
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
636 |
or:[ ev isButtonEvent |
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
637 |
or:[ ev isKeyEvent ]]) ifTrue:[ |
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
638 |
^ ev dispatchWithViewArgumentTo:self |
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
639 |
]. |
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
640 |
^ false |
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
641 |
|
18cff2d0daff
change to only expect one single method to be (re)defined:
Claus Gittinger <cg@exept.de>
parents:
2879
diff
changeset
|
642 |
"Created: / 29-06-2011 / 18:22:43 / cg" |
4283 | 643 |
"Modified: / 28-06-2019 / 08:40:35 / Claus Gittinger" |
59 | 644 |
! ! |
645 |
||
2391 | 646 |
!ActiveHelp methodsFor:'help texts'! |
59 | 647 |
|
4251 | 648 |
basicHelpTextFor:aView at:aDevicePointOrNil |
233 | 649 |
"retrieve helptext for aView as a string; |
3790 | 650 |
walk along the view's superView chain, |
100 | 651 |
asking models and views encountered while walking. |
652 |
The first one who understands and returns a nonNil answer to the |
|
233 | 653 |
#helpTextFor:at: or #helpTextFor: message ends this search and the |
100 | 654 |
returned string is returned." |
655 |
||
4435 | 656 |
|t model app1 app2 text v sv topView domainPointOrNil| |
59 | 657 |
|
4435 | 658 |
((t := aView transformation) notNil |
4262 | 659 |
and:[aDevicePointOrNil notNil]) ifTrue:[ |
4435 | 660 |
domainPointOrNil := t applyInverseTo:aDevicePointOrNil. |
2130 | 661 |
] ifFalse:[ |
662 |
domainPointOrNil := aDevicePointOrNil. |
|
663 |
]. |
|
664 |
||
3665 | 665 |
"/ done below |
666 |
"/ text := self helpTextFromView:aView at:domainPointOrNil. |
|
667 |
"/ text notNil ifTrue:[ ^ text ]. |
|
2076 | 668 |
|
1549
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
669 |
((aView respondsTo:#application) |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
670 |
and:[ (app1 := aView application) notNil ]) ifTrue:[ |
2130 | 671 |
text := self helpTextFromModel:app1 view:aView at:domainPointOrNil. |
1549
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
672 |
text notNil ifTrue:[ ^ text ]. |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
673 |
] ifFalse:[ |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
674 |
"/ old style (i.e. StandardSystemView ...) |
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
675 |
topView := aView topView. |
3664 | 676 |
text := self helpTextFromModel:topView view:aView at:domainPointOrNil. |
677 |
text notNil ifTrue:[ ^ text ]. |
|
59 | 678 |
]. |
1549
1b5274878f87
care for oldStyle views (StdSysViews)
Claus Gittinger <cg@exept.de>
parents:
1543
diff
changeset
|
679 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
680 |
(model := aView model) notNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
681 |
model ~~ app1 ifTrue:[ |
2130 | 682 |
text := self helpTextFromModel:model view:aView at:domainPointOrNil. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
683 |
text notNil ifTrue:[ ^ text ]. |
1502 | 684 |
]. |
1011
53514f2c18a7
also ask for helpTextAt:, when a motionEvent arrives.
Claus Gittinger <cg@exept.de>
parents:
728
diff
changeset
|
685 |
]. |
2130 | 686 |
text := self helpTextFromView:aView at:domainPointOrNil. |
3664 | 687 |
text notNil ifTrue:[ |
688 |
^ text |
|
689 |
]. |
|
59 | 690 |
|
691 |
"walk up the chain - maybe someone knows about its subview ..." |
|
692 |
v := aView. |
|
1502 | 693 |
[ |
694 |
(sv := v container) notNil |
|
695 |
] whileTrue:[ |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
696 |
(model := sv model) notNil ifTrue:[ |
2130 | 697 |
text := self helpTextFromModel:model view:aView at:domainPointOrNil. |
1502 | 698 |
text notNil ifTrue:[ ^ text ]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
699 |
]. |
3665 | 700 |
"/ maybe the topView knows something about a higher-up widget... |
701 |
text := self helpTextFromModel:topView view:sv at:domainPointOrNil. |
|
702 |
text notNil ifTrue:[ ^ text ]. |
|
703 |
||
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
704 |
text := self helpTextFromView:sv at:nil. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
705 |
text notNil ifTrue:[ ^ text ]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
706 |
v := sv |
602 | 707 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
708 |
|
4038 | 709 |
v notNil ifTrue:[ |
710 |
((v respondsTo:#application) and:[(app2 := v application) notNil]) ifTrue:[ |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
711 |
(app2 ~~ app1) ifTrue:[ |
2130 | 712 |
text := self helpTextFromModel:app2 view:aView at:domainPointOrNil. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
713 |
text notNil ifTrue:[ ^ text ]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
714 |
] |
4038 | 715 |
]. |
716 |
((v respondsTo:#model) and:[(model := v model) notNil]) ifTrue:[ |
|
2130 | 717 |
text := self helpTextFromModel:model view:aView at:domainPointOrNil. |
1502 | 718 |
text notNil ifTrue:[ ^ text ]. |
4038 | 719 |
]. |
100 | 720 |
]. |
59 | 721 |
^ nil |
100 | 722 |
|
4038 | 723 |
"Modified: / 31-08-1995 / 20:38:00 / claus" |
724 |
"Modified: / 28-07-1998 / 01:47:27 / cg" |
|
725 |
"Modified: / 09-01-2018 / 16:46:37 / stefan" |
|
4262 | 726 |
"Modified: / 13-05-2019 / 11:24:06 / Stefan Reise" |
100 | 727 |
! |
728 |
||
4251 | 729 |
helpTextFor:aView at:aDevicePointOrNil |
730 |
"retrieve helptext for aView as a string; |
|
731 |
walk along the view's superView chain, |
|
732 |
asking models and views encountered while walking. |
|
733 |
The first one who understands and returns a nonNil answer to the |
|
734 |
#helpTextFor:at: or #helpTextFor: message ends this search and the |
|
735 |
returned string is returned." |
|
736 |
||
4353 | 737 |
|text pntRel v superView| |
4251 | 738 |
|
739 |
text := self basicHelpTextFor:aView at:aDevicePointOrNil. |
|
4353 | 740 |
text notNil ifTrue:[^ text]. |
4251 | 741 |
|
4353 | 742 |
"/ I guess the following is already done in basicHelpTextFor:at: |
743 |
^ nil. |
|
4251 | 744 |
|
4353 | 745 |
"/ "/ in case of embedded toggles, buttons, etc. |
746 |
"/ "/ walk along the container hierarchy... |
|
747 |
"/ pntRel := aDevicePointOrNil. |
|
748 |
"/ v := aView. |
|
749 |
"/ [(superView := v superView) notNil] whileTrue:[ |
|
750 |
"/ pntRel notNil ifTrue:[ |
|
751 |
"/ pntRel := aView device translatePoint:pntRel fromView:v toView:superView. |
|
752 |
"/ ]. |
|
753 |
"/ v := superView. |
|
754 |
"/ text := self basicHelpTextFor:v at:pntRel. |
|
755 |
"/ text notNil ifTrue:[^ text]. |
|
756 |
"/ ]. |
|
757 |
"/ |
|
758 |
"/ v superView isNil ifTrue:[ |
|
759 |
"/ Debugging ifTrue:['no superview provides helptext' infoPrintCR]. |
|
760 |
"/ ]. |
|
761 |
"/ ^ nil |
|
4251 | 762 |
! |
763 |
||
3664 | 764 |
helpTextFromModel:aModelOrTopView view:aView at:aPointOrNil |
1502 | 765 |
"helper: ask aModel for its helpText." |
766 |
||
3664 | 767 |
|text| |
1502 | 768 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
769 |
aPointOrNil notNil ifTrue:[ |
3664 | 770 |
(aModelOrTopView respondsTo:#helpTextFor:at:) ifTrue:[ |
771 |
text := aModelOrTopView helpTextFor:aView at:aPointOrNil. |
|
2076 | 772 |
text notNil ifTrue:[^ text]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
773 |
]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
774 |
]. |
3664 | 775 |
(aModelOrTopView respondsTo:#helpTextFor:) ifTrue:[ |
776 |
text := aModelOrTopView helpTextFor:aView. |
|
777 |
text notNil ifTrue:[^ text]. |
|
1502 | 778 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
779 |
^ text |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
780 |
! |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
781 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
782 |
helpTextFromView:aView at:aPointOrNil |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
783 |
"helper: ask aView for its helpText." |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
784 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
785 |
|text| |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
786 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
787 |
aPointOrNil notNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
788 |
(aView respondsTo:#helpTextAt:) ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
789 |
text := aView helpTextAt:aPointOrNil. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
790 |
]. |
1502 | 791 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
792 |
text isNil ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
793 |
(aView respondsTo:#helpText) ifTrue:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
794 |
text := aView helpText. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
795 |
]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
796 |
]. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
797 |
^ text. |
2391 | 798 |
! ! |
799 |
||
800 |
!ActiveHelp methodsFor:'private'! |
|
1502 | 801 |
|
138 | 802 |
hideIfPointerLeft:aView |
233 | 803 |
"hide help, if the pointer is not in aView" |
138 | 804 |
! |
805 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
806 |
interestedIn:aView |
1033
3a56ba930052
care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
807 |
"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
|
808 |
or in my list of apps)" |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
809 |
|
3347
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
810 |
|app aViewsTopView device deviceFocusView| |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
811 |
|
4167 | 812 |
"/ Debugging := true |
813 |
"/ Debugging := false |
|
3347
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
814 |
aView isNil ifTrue:[ |
4283 | 815 |
Debugging ifTrue:[('%1: nil view' bindWith:self className)infoPrintCR]. |
3347
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
816 |
^ false |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
817 |
]. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
818 |
|
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
819 |
"/ applicationsOrTopViewsWithHelp isEmptyOrNil ifTrue:[ |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
820 |
"/ Debugging ifTrue:['no apps' infoPrintCR]. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
821 |
"/ ^ false |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
822 |
"/ ]. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
823 |
|
3347
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
824 |
aViewsTopView := aView topView. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
825 |
|
3348 | 826 |
UserPreferences current onlyShowTooltipsForActiveWindow ifTrue:[ |
4167 | 827 |
Debugging ifTrue:[ |
4251 | 828 |
('%1: TopView: %2 focus: %3 active: %4' |
829 |
bindWith:self class name |
|
830 |
with:aViewsTopView |
|
4235 | 831 |
with:aViewsTopView graphicsDevice focusView |
832 |
with:aViewsTopView isActive) infoPrintCR. |
|
4167 | 833 |
]. |
4134 | 834 |
aViewsTopView isActive ifFalse:[ |
835 |
Debugging ifTrue:[ |
|
836 |
|graphicsDevice focusVw| |
|
837 |
||
4251 | 838 |
('%1: topview inactive' bindWith:self class name) infoPrintCR. |
4134 | 839 |
graphicsDevice := aViewsTopView graphicsDevice. |
840 |
graphicsDevice notNil ifTrue:[ |
|
841 |
focusVw := graphicsDevice focusView. |
|
842 |
'focusView: ' infoPrint. focusVw infoPrintCR. |
|
843 |
focusVw notNil ifTrue:[ |
|
844 |
'wGroup: ' infoPrint. focusVw windowGroup infoPrintCR. |
|
845 |
] |
|
846 |
] |
|
847 |
]. |
|
3417 | 848 |
^ false |
849 |
]. |
|
850 |
||
3348 | 851 |
"/ if none of the view's components has focus... |
852 |
(device := aViewsTopView graphicsDevice) notNil ifTrue:[ |
|
853 |
(deviceFocusView := device focusView) notNil ifTrue:[ |
|
854 |
deviceFocusView topView ~~ aViewsTopView ifTrue:[ |
|
855 |
"/ 'for inactive ' infoPrint. aView infoPrintCR. |
|
856 |
Debugging ifTrue:['inactive topView' infoPrintCR]. |
|
857 |
^ false |
|
858 |
]. |
|
3347
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
859 |
]. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
860 |
]. |
f314814a3105
do not show help for inactive (background) views.
Claus Gittinger <cg@exept.de>
parents:
3333
diff
changeset
|
861 |
]. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
862 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
863 |
listeningForAll == true ifTrue:[^ true]. |
1033
3a56ba930052
care for nil view passed to #interestedIn.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
864 |
|
3395 | 865 |
applicationsOrTopViewsWithHelp isNil ifTrue:[ |
866 |
applicationsOrTopViewsWithHelp := WeakIdentitySet new. |
|
867 |
]. |
|
1106 | 868 |
(applicationsOrTopViewsWithHelp includesIdentical:aViewsTopView) ifTrue:[^ true]. |
869 |
app := aViewsTopView application. |
|
4134 | 870 |
app isNil ifTrue:[ |
871 |
Debugging ifTrue:['no app' infoPrintCR]. |
|
872 |
^ false. |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
873 |
]. |
4134 | 874 |
(applicationsOrTopViewsWithHelp includesIdentical:app) ifTrue:[^ true]. |
875 |
Debugging ifTrue:['not in list of apps I am interested in' infoPrintCR]. |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
876 |
^ false |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
877 |
|
4134 | 878 |
"Created: / 26-10-1997 / 23:28:52 / cg" |
879 |
"Modified: / 08-08-1998 / 13:36:19 / cg" |
|
4283 | 880 |
"Modified: / 28-06-2019 / 08:40:05 / Claus Gittinger" |
2782 | 881 |
! |
882 |
||
883 |
targetViewInitiatesHelpViaSensor |
|
884 |
"true if the target view is asked to show the help via the sensor; |
|
885 |
false, if I do it myself synchronously." |
|
886 |
||
887 |
^ true |
|
59 | 888 |
! ! |
889 |
||
2391 | 890 |
!ActiveHelp methodsFor:'queries'! |
891 |
||
892 |
delayTime |
|
893 |
^ self class delayTime |
|
894 |
! |
|
895 |
||
896 |
showTime |
|
3333 | 897 |
"how long shall the help be shown; |
898 |
0 means: forever (until user moves the mouse); |
|
899 |
>0 means that number of seconds" |
|
900 |
||
2391 | 901 |
^ self class showTime |
902 |
! ! |
|
903 |
||
1768 | 904 |
!ActiveHelp methodsFor:'show & hide help'! |
59 | 905 |
|
906 |
hideHelp |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
907 |
"hide the help text - nothing done here" |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
908 |
! |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
909 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
910 |
hideHelpIgnoringErrors |
233 | 911 |
"hide the help text" |
912 |
||
1713
bc8a1d16e60f
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
1657
diff
changeset
|
913 |
Error handle:[:ex | |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
914 |
ex description infoPrintCR. |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
915 |
ex return |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
916 |
] do:[ |
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
917 |
self hideHelp. |
59 | 918 |
]. |
919 |
! |
|
920 |
||
4235 | 921 |
initiateHelp |
922 |
"determine where the mouse pointer is located, |
|
923 |
and start showing a tooltip for it right now. |
|
4238 | 924 |
This can be called to force update of the tooltip, |
4235 | 925 |
in case a widget has changed its mind |
926 |
(typically: an undo menu button function might wonna do this, |
|
927 |
to show changed info)" |
|
928 |
||
929 |
|screenPos view| |
|
4250 | 930 |
|
931 |
"/ Debugging := false. |
|
932 |
"/ Debugging := true. |
|
4235 | 933 |
screenPos := Display pointerPosition. |
934 |
Debugging == true ifTrue:[ |
|
935 |
'----------------' infoPrintCR. |
|
4283 | 936 |
('%1: pos: %2' bindWith:self className with:screenPos) infoPrintCR. |
4235 | 937 |
]. |
938 |
view := Display viewFromPoint:screenPos. |
|
939 |
Debugging == true ifTrue:[ |
|
940 |
'view: ' infoPrint. view infoPrintCR. |
|
941 |
]. |
|
942 |
view notNil ifTrue:[ |
|
943 |
self initiateHelpFor:view. |
|
944 |
]. |
|
945 |
||
946 |
"Created: / 27-02-2019 / 11:09:41 / Claus Gittinger" |
|
4283 | 947 |
"Modified: / 28-06-2019 / 08:39:00 / Claus Gittinger" |
4235 | 948 |
! |
949 |
||
950 |
initiateHelpFor:aView |
|
951 |
"start showing a tooltip for aView right now. |
|
952 |
This can be called to force update of the tooltip, |
|
953 |
in case a widget has changed its mind |
|
954 |
(typically: an undo menu button function might wonna do this, |
|
955 |
to show changed info)" |
|
956 |
||
957 |
|screenPos relativePos| |
|
958 |
||
959 |
screenPos := Display pointerPosition. |
|
960 |
Debugging == true ifTrue:[ |
|
4283 | 961 |
('%1: pos: %2' bindWith:self className with:screenPos) infoPrintCR. |
4235 | 962 |
]. |
963 |
aView notNil ifTrue:[ |
|
964 |
relativePos := Display translatePoint:screenPos fromView:nil toView:aView. |
|
965 |
Debugging == true ifTrue:[ |
|
966 |
'relativePos: ' infoPrint. relativePos infoPrintCR. |
|
967 |
]. |
|
968 |
self initiateHelpFor:aView at:relativePos |
|
969 |
]. |
|
970 |
||
971 |
"Created: / 27-02-2019 / 13:59:44 / Claus Gittinger" |
|
4283 | 972 |
"Modified: / 28-06-2019 / 08:39:06 / Claus Gittinger" |
4235 | 973 |
! |
974 |
||
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
975 |
initiateHelpFor:aView at:aPointOrNil |
634 | 976 |
"ask aView for helpText, passing x/y coordinates; |
977 |
start a timeout process to display this helpText after some delay; |
|
978 |
Normally used internally, but can also be used by widgets to force |
|
979 |
re-negotiation of the displayed helpText |
|
980 |
(for example in a menu, when the selection changes)" |
|
981 |
||
4431 | 982 |
"/ Debugging == true ifTrue:[ |
983 |
"/ ('%1: initiateHelpFor: %2' bindWith:self className with:aView) infoPrintCR. |
|
984 |
"/ ]. |
|
4251 | 985 |
|
4061 | 986 |
"/ ActiveHelp stop |
4060 | 987 |
self class isActive ifFalse:[^ self]. |
988 |
||
4058 | 989 |
"/ in standalone apps, it is better to simply not show the help |
990 |
Error,BreakPointInterrupt handle:[:ex | |
|
991 |
Smalltalk isStandAloneApp ifFalse:[ex reject]. |
|
992 |
] do:[ |
|
993 |
self initiateHelpFor:aView at:aPointOrNil now:false |
|
994 |
]. |
|
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
995 |
|
4283 | 996 |
"Modified: / 28-06-1997 / 14:45:57 / cg" |
997 |
"Modified: / 28-06-2019 / 08:39:15 / Claus Gittinger" |
|
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
998 |
! |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
999 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1000 |
initiateHelpFor:aView at:aPointOrNil now:showItNow |
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
1001 |
"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
|
1002 |
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
|
1003 |
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
|
1004 |
re-negotiation of the displayed helpText |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
1005 |
(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
|
1006 |
|
696 | 1007 |
|text top app| |
634 | 1008 |
|
4235 | 1009 |
Debugging == true ifTrue:[ |
4283 | 1010 |
('%1: initiate help for: %2' bindWith:self className with:aView) infoPrintCR. |
4251 | 1011 |
]. |
1012 |
||
1143 | 1013 |
(self interestedIn:aView) ifFalse:[ |
4251 | 1014 |
Debugging ifTrue:['not interested: ' infoPrintCR]. |
1143 | 1015 |
^ self |
1016 |
]. |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1017 |
|
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1018 |
text := self helpTextFor:aView at:aPointOrNil. |
4251 | 1019 |
|
1020 |
(lastHelpText = text and:[lastHelpWidget == aView]) ifTrue:[ |
|
1021 |
Debugging ifTrue:['same text' infoPrintCR]. |
|
1022 |
"/ (aView isKindOf:CheckToggle) ifTrue:[self halt]. |
|
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
1023 |
^ self |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
1024 |
]. |
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
1025 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1026 |
"/ let application show the help |
728 | 1027 |
"/ (i.e. in its own information area) |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1028 |
"/ nil-text is also passed down, to give it a chance |
728 | 1029 |
"/ to clean its infoDisplay. |
637
8be64da7d932
views own help display is done immediately.
Claus Gittinger <cg@exept.de>
parents:
636
diff
changeset
|
1030 |
|
4254 | 1031 |
"/ (aView isKindOf:CheckToggle) ifTrue:[self halt]. |
728 | 1032 |
top := aView topView. |
1033 |
(app := aView application) notNil ifTrue:[ |
|
1019
862f095da4ac
#showHelp:for: renamed to #showActiveHelp:for:
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
1034 |
(app showActiveHelp:text for:aView) ifTrue:[ |
728 | 1035 |
lastHelpText := text. |
632
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
1036 |
] |
844b1aaf3eeb
provide access to the current activeHelp instance
Claus Gittinger <cg@exept.de>
parents:
602
diff
changeset
|
1037 |
]. |
4235 | 1038 |
|
4283 | 1039 |
"Modified: / 28-06-2019 / 08:39:23 / Claus Gittinger" |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1040 |
! |
59 | 1041 |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1042 |
stopHelpDisplayProcess |
59 | 1043 |
! ! |
1044 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1045 |
!ActiveHelp methodsFor:'start & stop'! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1046 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1047 |
listenFor:anAppOrTopView |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1048 |
"start listening" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1049 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1050 |
applicationsOrTopViewsWithHelp isNil ifTrue:[ |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1051 |
applicationsOrTopViewsWithHelp := WeakIdentitySet new. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1052 |
]. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1053 |
applicationsOrTopViewsWithHelp add:anAppOrTopView. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1054 |
super listen. |
639 | 1055 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1056 |
"Created: / 26.10.1997 / 23:20:47 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1057 |
"Modified: / 26.10.1997 / 23:21:10 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1058 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1059 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1060 |
listenForAll |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1061 |
"start listening" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1062 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1063 |
listeningForAll := true. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1064 |
super listen. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1065 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1066 |
"Modified: / 28.6.1997 / 15:07:02 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1067 |
"Created: / 26.10.1997 / 23:19:30 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1068 |
! |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1069 |
|
2391 | 1070 |
start |
1071 |
self listenForAll |
|
1072 |
! |
|
1073 |
||
1074 |
stop |
|
1075 |
self unlistenAll |
|
1076 |
! |
|
1077 |
||
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1078 |
unlistenAll |
639 | 1079 |
"stop listening" |
1080 |
||
1081 |
self hideHelp. |
|
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1082 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1083 |
listeningForAll := false. |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1084 |
applicationsOrTopViewsWithHelp size == 0 ifTrue:[ |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1085 |
self unlisten. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1086 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1087 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1088 |
"Created: / 26.10.1997 / 23:14:17 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1089 |
"Modified: / 26.10.1997 / 23:23:04 / cg" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1090 |
! |
639 | 1091 |
|
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1092 |
unlistenFor:anApp |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1093 |
"stop listening for an app" |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1094 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1095 |
self hideHelp. |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1096 |
|
1543 | 1097 |
applicationsOrTopViewsWithHelp isNil ifFalse:[ |
1098 |
applicationsOrTopViewsWithHelp remove:anApp ifAbsent:nil. |
|
1099 |
]. |
|
726 | 1100 |
listeningForAll == true ifFalse:[ |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1101 |
applicationsOrTopViewsWithHelp size == 0 ifTrue:[ |
1535
a9fcabccabb3
separated into flyByHelp and activeHelp
Claus Gittinger <cg@exept.de>
parents:
1502
diff
changeset
|
1102 |
self unlisten. |
719
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1103 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1104 |
] |
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1105 |
|
17fba5c2a167
allow applications to start activeHelp for
Claus Gittinger <cg@exept.de>
parents:
696
diff
changeset
|
1106 |
"Created: / 26.10.1997 / 23:22:42 / cg" |
726 | 1107 |
"Modified: / 29.10.1997 / 15:48:34 / cg" |
639 | 1108 |
! ! |
1109 |
||
338
071f92621e3b
oops - catching the terminateSignal is no good idea
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1110 |
!ActiveHelp class methodsFor:'documentation'! |
138 | 1111 |
|
3665 | 1112 |
version |
1113 |
^ '$Header$' |
|
1114 |
! |
|
1115 |
||
2779
b608ded19ff2
changed: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2688
diff
changeset
|
1116 |
version_CVS |
3507 | 1117 |
^ '$Header$' |
138 | 1118 |
! ! |
3197 | 1119 |
|
3320 | 1120 |
|
1121 |
ActiveHelp initialize! |