#BUGFIX by stefan
class: FlyByHelp
comment/format in:
#hideIfPointerLeft:
#keyPress:x:y:view:
changed:
#hideHelp
#initiateHelpFor:at:now:
#showHelp:for:
https://expeccoalm.exept.de/D226383
Show tooltips that hit the screen bottom.
--- a/FlyByHelp.st Mon Apr 16 17:04:10 2018 +0200
+++ b/FlyByHelp.st Mon Apr 16 17:31:54 2018 +0200
@@ -139,7 +139,7 @@
key == $§ ifTrue:[
"/ generate a line suitable for the resources file (a null translation)
"/ into the clipboard; makes it easy to add missing translations to a .rs file,
- "/ by pressing paragrapj whenever you see an untranslated helptext
+ "/ by pressing paragraph whenever you see an untranslated helptext
aView setClipboardText:(lastHelpText storeString , ' ' , lastHelpText storeString).
self hideHelp.
^ true
@@ -168,6 +168,7 @@
"/ ^ super keyPress:key x:x y:y view:aView
"Modified (format): / 25-12-2011 / 10:25:23 / cg"
+ "Modified (format): / 16-04-2018 / 16:53:15 / stefan"
!
mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView
@@ -266,7 +267,8 @@
].
].
- "Modified: 28.5.1996 / 20:18:28 / cg"
+ "Modified: / 28-05-1996 / 20:18:28 / cg"
+ "Modified: / 16-04-2018 / 16:59:48 / stefan"
!
initiateHelpFor:aView at:aPointOrNil now:showItNow
@@ -300,11 +302,9 @@
^ self
] afterMilliseconds:(self flyByHelpTimeoutMillis).
- lastHelpText = text ifTrue:[
- lastHelpWidget == aView ifTrue:[
- self toolTipFollowsMouse ifFalse:[
- ^ self
- ]
+ (lastHelpText = text and:[lastHelpWidget == aView]) ifTrue:[
+ self toolTipFollowsMouse ifFalse:[
+ ^ self
]
].
@@ -333,6 +333,7 @@
].
"Modified: / 22-03-2011 / 19:10:28 / cg"
+ "Modified: / 16-04-2018 / 12:20:33 / stefan"
! !
!FlyByHelp methodsFor:'queries'!
@@ -373,7 +374,6 @@
currentHelpView notNil ifTrue:[
[
currentHelpView notNil ifTrue:[
- currentHelpView unmap.
currentHelpView destroy.
currentHelpView := nil.
currentView := nil.
@@ -386,7 +386,8 @@
p terminate.
]
- "Modified: 28.6.1997 / 14:03:50 / cg"
+ "Modified: / 28-06-1997 / 14:03:50 / cg"
+ "Modified: / 16-04-2018 / 16:51:01 / stefan"
!
showHelp:aHelpText for:view
@@ -394,7 +395,7 @@
|wg applicationOrNil org p v device helpTextShown textLines
helpViewWidth helpViewHeight usableWidth monitorBounds usableHeight
- showTime cursorView|
+ showTime cursorView pos|
"/ thisContext fullPrintAllOn:Transcript.
(wg := view windowGroup) notNil ifTrue:[
@@ -414,13 +415,10 @@
^ self
].
- view == currentView ifTrue:[
- lastHelpText = aHelpText ifTrue:[
- ^ self
- ]
+ (view == currentView and:[lastHelpText = aHelpText]) ifTrue:[
+ ^ self
].
lastHelpWidget := view.
-
lastHelpText := aHelpText.
helpTextShown := aHelpText.
"/ the text originator must already have generated CRs;
@@ -461,7 +459,11 @@
helpViewWidth := v width.
helpViewHeight := v height.
- org := device pointerPosition + (0@18"24").
+ "https://expeccoalm.exept.de/D226383: keep the help window away from the pointer under any circumstances
+ (especially when the window touches the bottom or the right edge of the screen).
+ When the pointer is no longer in the current window, the help window is closed!!"
+ pos := device pointerPosition.
+ org := pos + (10@18).
monitorBounds := device monitorBoundsAt:org.
usableWidth := monitorBounds width - 2.
usableHeight := device usableHeightAt:org.
@@ -470,30 +472,31 @@
helpViewHeight > usableHeight ifTrue:[v height:(helpViewHeight := usableHeight)].
(org x + helpViewWidth) > (monitorBounds left + usableWidth) ifTrue:[
- org := ((monitorBounds left + usableWidth - helpViewWidth) @ org y).
+ org x:(monitorBounds left + usableWidth - helpViewWidth).
].
(org y + helpViewHeight) > (monitorBounds top + usableHeight) ifTrue:[
- org := org x @ (monitorBounds top + usableHeight - helpViewHeight).
+ org y:(monitorBounds top + usableHeight - helpViewHeight).
].
-
+ ((org extent:v extent) containsPoint:pos) ifTrue:[
+ "pointer would be in the help window (see comment above).
+ Help window is at the lower right edge. Move it to the left of the pointer"
+ org x:(pos x - helpViewWidth - 20).
+ ].
v origin:org.
v realize.
- v enableButtonMotionEvents.
- v enableMotionEvents.
currentHelpView := v.
currentView := view.
showTime := self showTime.
- (showTime notNil and:[showTime > 0]) ifTrue:[
+ (showTime > 0) ifTrue:[
p :=
[
[
- (Delay forSeconds:showTime) wait.
+ Delay waitForSeconds:showTime.
[
|v|
(v := currentHelpView) notNil ifTrue:[
currentHelpView := nil.
- v unmap.
v destroy.
]
] valueUninterruptably
@@ -508,6 +511,7 @@
"Modified: / 31-08-1995 / 19:20:45 / claus"
"Modified: / 06-06-2017 / 15:06:41 / cg"
+ "Modified (format): / 16-04-2018 / 17:29:10 / stefan"
!
stopHelpDisplayProcess