Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Tooltip following mouse cursor
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Tooltip following mouse cursor

 Post Reply Post Reply
Author
Message Reverse Sort Order
Dmitry View Drop Down
Groupie
Groupie


Joined: 28 November 2004
Location: Australia
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmitry Quote  Post ReplyReply Direct Link To This Post Topic: Tooltip following mouse cursor
    Posted: 28 July 2008 at 8:46pm
Hi,

Are there plans to make this functionality available? And if so, when?

Regards,
Dmitry
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2008 at 2:08am
Hello,
 
Afraid, no. CXTPToolTipContext  currently works only with OnToolHitTest.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Dmitry View Drop Down
Groupie
Groupie


Joined: 28 November 2004
Location: Australia
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmitry Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.094 seconds.