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