Tooltip following mouse cursor |
Post Reply |
Author | |
Dmitry
Groupie Joined: 28 November 2004 Location: Australia Status: Offline Points: 31 |
Post Options
Thanks(0)
Posted: 27 July 2008 at 9:28pm |
Hi,
In MFC, it possible to create a CToolTipCtrl tooltip in a CView that follows the mouse cursor around. The tooltip is activated using Activate() and its text is updated using UpdateTipText. For example, add the following changes to the Scribble sample: static CToolTipCtrl * tooltip = 0; void CScribbleView::OnLButtonUp(UINT, CPoint point) { if (tooltip) { tooltip ->Activate (false); delete tooltip; tooltip = 0; } else { tooltip = new CToolTipCtrl (); tooltip -> Create (this); tooltip -> AddTool (this); tooltip -> Activate (true); tooltip -> UpdateTipText ("Tooltip", this); } // Mouse button up is interesting in the Scribble application ... void CScribbleView::OnMouseMove(UINT, CPoint point) { if (tooltip) { CString toolText; toolText .Format ("Mouse: (%d, %d)", point.x, point.y); tooltip -> UpdateTipText (toolText, this); } // Mouse movement is interesting in the Scribble application ... BOOL CScribbleView::PreTranslateMessage (MSG * pMsg) { if (tooltip) tooltip -> RelayEvent (pMsg); return __super :: PreTranslateMessage (pMsg); } Run the application. Click to turn the tooltip on or off, and move the mouse – it will show mouse coordinates just under the cursor, as it moves: Is there a way to create a similar scenario in XTP, using other styles of tooltip (RTF, Office, etc)? All the existing examples of CXTPToolTipContext currently use OnToolHitTest, but not Activate+UpdateTipText. Thanks, Dmitry |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Afraid, no. CXTPToolTipContext currently works only with OnToolHitTest.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Dmitry
Groupie Joined: 28 November 2004 Location: Australia Status: Offline Points: 31 |
Post Options
Thanks(0)
|
Hi,
Are there plans to make this functionality available? And if so, when? Regards, Dmitry |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |