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