Link to home
Start Free TrialLog in
Avatar of ystahl
ystahl

asked on

How to dynamically create tooltips? without the resource editor help.

Hi,
I have a dynamically created toolbar with a few buttons on it,
and I want to assign a tooltip to each of these buttons in run-time! How do I do it???
 
B.T.W The id's of these buttons are also created in run-time so I cannot use the resource editor help...
 
Thanks in advance
 
Yoav Stahl.
 
 
ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vinayak Kumbar
Vinayak Kumbar

Hi,

Dynamically means, even buttons also u have created dynamically?. Can't go for using the resource editor?. Just U can insert a toolbar give it Ur own ID, and add the buttons and then do

bar = new CToolBar;
      if (!bar->Create(this) ||
            !bar->LoadToolBar(IDR_MY_TOOLBAR))
      {
            TRACE0("Failed to create toolbar\n");
            return ;      // fail to create
      }
      
      bar->SetBarStyle(bar->GetBarStyle() |
            CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

      bar->ShowWindow(SW_SHOW);

here bar is the pointer of CToolBar. Then U can set the tooltips also at the design time!!!.

Try it out.

VinExpert