|
-
August 30th, 2010, 02:24 PM
#1
How to build my own 'Intellisense' with tooltips?
I would like to reproduce the kind of tooltips that Visual Studio provides through its 'Intellisense' component. Any idea how to summon a particular tooltip when the cursor hovers over a keyword? I know I could readily map all the keywords to tooltip phrases, but I have no clue as to how to get the hovering cursor to send some sort of message that it's time to display the mapped tooltip message.
There is a nice article on how to employ tooltips in a CRichEditView.
RichText Tool-tip Control By Paul Vickery | 7 Oct 2008
A tool-tip control with support for rich-text formatting
Source Code at: http://www.codeproject.com/KB/miscct...px?msg=1660051
Any ideas greatly appreciated.
mpliam
-
August 31st, 2010, 02:19 PM
#2
Re: How to build my own 'Intellisense' with tooltips?
I wrote a HTML rendering control a few years ago, and this problem is essentially the same problem as detecting a mouse over hyperlinked text.
I never looked at Mozilla code, or any other source. I wanted to figure out everything for myself. So I'm not sure if the way I did it was the way everyone else does it.
Essentially, you have to write your own text edit box. All text is held in an array and taken pieces at a time to get line lengths to ouput.
This is where you detect your keywords. Then you output the text one character at a time to your "edit" box. When you get to your keyword, you take the bounding rectangle of that character along with the last character of the keyword on that line, and "merge" the two rectangles to get the overall bounding rectangle. Then you store those coordinates away in a memory array.
Then when the mouse moves, you just do a hit test for any rectangles visible on your display, and then you can detect which keyword the mouse is over, and send a trigger to display your intellisense.
I hope that helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|