--- a/ActiveHelp.st Wed Sep 05 20:23:13 2001 +0200
+++ b/ActiveHelp.st Fri Sep 07 16:39:42 2001 +0200
@@ -11,6 +11,8 @@
"
+"{ Package: 'stx:libview2' }"
+
EventListener subclass:#ActiveHelp
instanceVariableNames:'currentView currentHelpView currentFrame showProcess closeProcess
lastHelpText listeningForAll applicationsOrTopViewsWithHelp'
@@ -416,7 +418,7 @@
!ActiveHelp methodsFor:'private'!
-helpTextFor:aView atX:x y:y
+helpTextFor:aView atX:x y:y
"retrieve helptext for aView as a string;
walk along the views superView chain,
asking models and views encountered while walking.
@@ -430,99 +432,91 @@
p := x @ y.
(model := aView model) notNil ifTrue:[
- (model respondsTo:#helpTextFor:at:) ifTrue:[
- text := model helpTextFor:aView at:p.
- text notNil ifTrue:[^ text].
- ].
- (model respondsTo:#helpTextFor:) ifTrue:[
- text := model helpTextFor:aView.
- text notNil ifTrue:[^ text].
- ]
+ text := self helpTextFromModel:model view:aView at:p.
+ text notNil ifTrue:[ ^ text ].
].
-
(aView respondsTo:#helpTextAt:) ifTrue:[
text := aView helpTextAt:p.
- text notNil ifTrue:[^ text].
+ text notNil ifTrue:[
+"/ Transcript show: aView class name ; show:' #helpTextAt: -> ' ; showCR:text.
+ ^ text
+ ].
].
(aView respondsTo:#helpText) ifTrue:[
text := aView helpText.
- text notNil ifTrue:[^ text].
+ text notNil ifTrue:[
+"/ Transcript show: aView class name ; show:' #helpText -> ' ; showCR:text.
+ ^ text
+ ].
].
"walk up the chain - maybe someone knows about its subview ..."
v := aView.
-
- [(sv := v container) notNil] whileTrue:[
- (model := sv model) notNil ifTrue:[
- (model respondsTo:#helpTextFor:at:) ifTrue:[
- text := model helpTextFor:aView at:p.
- text notNil ifTrue:[^ text].
+ [
+ (sv := v container) notNil
+ ] whileTrue:[
+ (model := sv model) notNil ifTrue:[
+ text := self helpTextFromModel:model view:aView at:p.
+ text notNil ifTrue:[ ^ text ].
+ ].
+ (sv respondsTo:#helpTextFor:) ifTrue:[
+ text := sv helpTextFor:aView.
+ text notNil ifTrue:[ ^ text ].
+ text := sv helpTextFor:v.
+ text notNil ifTrue:[ ^ text ].
+ ].
+ v := sv
].
- (model respondsTo:#helpTextFor:) ifTrue:[
- text := model helpTextFor:aView.
- text notNil ifTrue:[^ text].
- ]
- ].
-
- (sv respondsTo:#helpTextFor:) ifTrue:[
- text := sv helpTextFor:aView.
- text notNil ifTrue:[^ text].
- text := sv helpTextFor:v.
- text notNil ifTrue:[^ text].
- ].
-
- v := sv.
- ].
-
(aView respondsTo:#application) ifTrue:[
(app := aView application) notNil ifTrue:[
- (app respondsTo:#helpTextFor:at:) ifTrue:[
- text := app helpTextFor:aView at:p.
- text notNil ifTrue:[^ text].
- ].
- (app respondsTo:#helpTextFor:) ifTrue:[
- text := app helpTextFor:aView.
- text notNil ifTrue:[^ text].
- ]
+ text := self helpTextFromModel:app view:aView at:p.
+ text notNil ifTrue:[ ^ text ].
]
].
-
(v notNil and:[v respondsTo:#application]) ifTrue:[
(app := v application) notNil ifTrue:[
- (app respondsTo:#helpTextFor:at:) ifTrue:[
- text := app helpTextFor:aView at:p.
- text notNil ifTrue:[^ text].
- ].
- (app respondsTo:#helpTextFor:) ifTrue:[
- text := app helpTextFor:aView.
- text notNil ifTrue:[^ text].
- ]
+ text := self helpTextFromModel:app view:aView at:p.
+ text notNil ifTrue:[ ^ text ].
]
].
(v notNil and:[v respondsTo:#model]) ifTrue:[
(model := v model) notNil ifTrue:[
- (model respondsTo:#helpTextFor:at:) ifTrue:[
- text := model helpTextFor:aView at:p.
- text notNil ifTrue:[^ text].
- ].
- (model respondsTo:#helpTextFor:) ifTrue:[
- text := model helpTextFor:aView.
- text notNil ifTrue:[^ text].
- ]
+ text := self helpTextFromModel:model view:aView at:p.
+ text notNil ifTrue:[ ^ text ].
]
].
-
(view class respondsTo:#helpText) ifTrue:[
text := view class helpText.
- text notNil ifTrue:[^ text].
+ text notNil ifTrue:[ ^ text ].
].
-
^ nil
"Modified: / 31.8.1995 / 20:38:00 / claus"
"Modified: / 28.7.1998 / 01:47:27 / cg"
!
+helpTextFromModel:aModel view:aView at:aPoint
+ "helper: ask aModel for its helpText."
+
+ |text|
+
+ (aModel respondsTo:#helpTextFor:at:) ifTrue:[
+ text := aModel helpTextFor:aView at:aPoint.
+ text notNil ifTrue:[
+"/ Transcript showCR:'model #helpTextFor:at:'.
+ ^ text
+ ]
+ ].
+ (aModel respondsTo:#helpTextFor:) ifTrue:[
+ text := aModel helpTextFor:aView.
+ text notNil ifTrue:[
+"/ Transcript showCR:'model #helpTextFor:'.
+ ^ text
+ ]
+ ].
+ ^ nil
+!
+
hideIfPointerLeft:aView
"hide help, if the pointer is not in aView"
@@ -792,6 +786,6 @@
!ActiveHelp class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.41 2000-01-12 18:14:50 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.42 2001-09-07 14:39:42 cg Exp $'
! !
ActiveHelp initialize!