Bug 257986 - [JFace] The cursor cannot enter a tooltip with a positive offset
Summary: [JFace] The cursor cannot enter a tooltip with a positive offset
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-08 16:27 EST by Matthew Bisson CLA
Modified: 2019-09-06 16:07 EDT (History)
6 users (show)

See Also:


Attachments
Snippet to demonstrate problem (3.09 KB, text/plain)
2008-12-08 16:28 EST, Matthew Bisson CLA
no flags Details
Patch to allow the cursor to enter the tooltip (4.17 KB, patch)
2008-12-08 16:56 EST, Matthew Bisson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Bisson CLA 2008-12-08 16:27:18 EST
Build ID: I20081202-1812

Steps To Reproduce:
1. Create a tooltip
2. Try to move the cursor into it (e.g. to access a widget inside).
3. The tooltip disappears.

- Alternatively -
1. Create a tooltip and move it so when it appears it's underneath the cursor.
2. Hover over a user interface element - the tooltip appears, preventing you from interacting with the widget you were hovering over.


More information:
This was discovered from Bug 257903. In it, I have a CheckboxTreeViewer that when you hover over a tree item, a tooltip appears, with links in it. The two problems described above occur.
Comment 1 Matthew Bisson CLA 2008-12-08 16:28:40 EST
Created attachment 119839 [details]
Snippet to demonstrate problem

This snippet demonstrates the problem - javadoc comments explain how to run and use to simulate error.
Comment 2 Matthew Bisson CLA 2008-12-08 16:56:40 EST
Created attachment 119841 [details]
Patch to allow the cursor to enter the tooltip

This patch adds two methods to the JFace ToolTip class: setAllowCursorToEnter(boolean) and isAllowCursorToEnter().

Setting allowCursorToEnter to false (the default value) causes the default behaviour.

Setting it to true allows the user to move his cursor into the tooltip. What it does is add a condition to the shouldHideToolTip method that checks if the allowCursorToEnter field is true and if the cursor is between its initial location and the tooltip. If so, it allows the tooltip to remain visible, thus allowing the cursor to enter the tooltip. Once the cursor is inside the tooltip, a listener on the tooltip itself will cause the tooltip to disappear should the cursor leave the tooltip at all - i.e. this new functionality only keeps the tooltip open when the cursor is approaching it, and the old behaviour resumes once the cursor reaches the tooltip.
Comment 3 Matthew Bisson CLA 2008-12-08 16:59:28 EST
Boris: we're proposing adding this as new API, so we'd like to run it past you.

Kevin: we're not happy with the current name of the methods and attribute, we were hoping you'd help us come up with a more appropriate name
Comment 4 Thomas Schindl CLA 2008-12-09 14:02:00 EST
I'm taking owner-ship because I wrote the ToolTip things. 

Some comments:
a) There's already an option which prohibts recreating the ToolTip while moving 
   the mouse inside a control (passing ToolTip#NO_RECREATE) this solves not 100% 
   of your problems though I guess

b) Instead of adding a method I'd favour a new constant which is passed to the 
   constructor like ToolTip#NO_RECREATE
Comment 5 Eric Moffatt CLA 2008-12-09 14:23:05 EST
Tom, which ever you think is best if fine by me. We'd like to be able to get this into M4 though (it's our New & Noteworthy entry for this milestone), is there a chance we can get this in today/tomorrow?
Comment 6 Matthew Bisson CLA 2008-12-09 14:25:00 EST
I will post a revised patch shortly...
Comment 7 Kevin McGuire CLA 2008-12-09 14:26:20 EST
(In reply to comment #3)
> Kevin: we're not happy with the current name of the methods and attribute, we
> were hoping you'd help us come up with a more appropriate name

Agree that "allowCursorToEnter" isn't right.  It's not that you're allowing it, it's that you're promising to stick around if it looks like the user is trying to do that.

Since it's work in conjunction with "shouldHideToolTip", then maybe "dontHideToolTipIfEntering"?
Comment 8 Matthew Bisson CLA 2008-12-09 14:47:35 EST
Thanks Tom, it turns out that ToolTip#NO_RECREATE does the job perfectly - no need for my patch. (You can confirm this by testing it with the snippet I included, if you're so inclined). 
Comment 9 Matthew Bisson CLA 2008-12-09 15:36:07 EST
Ok, so ToolTip#NO_RECREATE does not work "perfectly" - Eric found a behaviour that conflicts with what we need.

When the NO_RECREATE flag is set, the tooltip stays up even when we move the mouse - which is what we need. But, if the cursor goes to hover over another tree item, the old tooltip stays up, instead of closing and allowing us to open a new tooltip. 

What we need is simply the ability to allow the cursor to enter the tooltip. The way I implemented it in my attached patch is: we choose not to close the tooltip while the cursor is inside the rectangle formed by the cursor's original position and the opposite corner of the tooltip. Once the cursor is inside the tooltip, however, when it exits, the tooltip closes. 

I think that between the extensive javadoc comment I put in the patch, and the patch code itself, our solution is pretty clear.

Tom, based on my patch, how do you think we should implement this behaviour (since you know the code better than we do)?
Comment 10 Thomas Schindl CLA 2009-01-27 16:39:45 EST
Moving to M6 - I'm completely swapped with company work. Is there still action needed?
Comment 11 Eric Moffatt CLA 2009-01-28 14:30:41 EST
No rush Tom, the way we're doing it now (making it 1 pixel inside the cell works OK for this particular case. 

It's still a valid enhancement I think but we're not blocked in any way on it...feel free to change the severity to 'enhancement', I won't argue...;-).

Comment 12 Thomas Schindl CLA 2010-01-28 17:13:27 EST
multi change because of intenion of stepping back as platform-ui committer
Comment 13 Eclipse Webmaster CLA 2019-09-06 16:07:51 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.