[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

CSliderCtrl tooltip

Posted on 2001-07-19
2
Medium Priority
?
1,057 Views
Last Modified: 2013-11-20

I have derived CSliderNew from CSliderCtrl that can handle both integer and decimal numbers. I would like to know how to replace the CSliderCtrl's tooltip for decimal numbers? Is there a way to intercept the tooltip event and change its text string?
0
Comment
Question by:rrashedi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6298500
you can get the tooltipctrl using GetToolTips from there you may be able to change the tip text
0
 
LVL 12

Accepted Solution

by:
migel earned 1164 total points
ID: 6298566
Hi!
you can handle TTN_ notifications from tooltip:
for example:
in the class CMySliderCtrl add this:

virtual BOOL OnNotify(WPARAM wParam, LPARAM, LRESULT* pResult);
// and implmentation
BOOL CMySliderCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
     NMHDR* pnmh = (NMHDR*)lParam;
     *pResult = TRUE;
     static bool bReentrant = false;
     if (pnmh->code == TTN_SHOW && !bReentrant)
          {
          bReentrant = true;
          char szText[80] = "";
          TOOLINFO ti;
          memset(&ti, 0, sizeof(ti));
          ti.cbSize = sizeof(ti);

          ::SendMessage(pnmh->hwndFrom, TTM_ENUMTOOLS, 0, (LPARAM)&ti );
          //::SendMessage(pnmh->hwndFrom, TTM_GETTOOLINFO, 0, (LPARAM)&ti);
          ti.hinst = AfxGetInstanceHandle();
          ti.lpszText = szText;
          int nPos = SendMessage(TBM_GETPOS);
          sprintf(szText, "%4d.0", nPos); // just add zero after decimal point.
// you can implement your own formatting
          ::SendMessage(pnmh->hwndFrom, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
          bReentrant = false;
          return TRUE;
          }
     return CSliderCtrl::OnNotify(wParam, lParam, pResult);
}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question