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