Simple CToolTipCtrl trouble.
-
Hi. Well.. I need to add some tooltips to my main window (CDialog). So... I do this in OnInit
bool test21=TTC.Create(this); //creating tooltipwindow theApp.tooltip=&(TTC); m\_but.MoveWindow(0,0,500,500); bool test11=theApp.tooltip->AddTool(m\_but,"Cool?"); TTC.Activate(TRUE);
and
BOOL MainDial::PreTranslateMessage(MSG* pMsg)
{
if (NULL != theApp.tooltip)
theApp.tooltip->RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}Appears a great button, but hint doesn't. Why? Any idea? Smthng that i'am missing? Huh?
-
Hi. Well.. I need to add some tooltips to my main window (CDialog). So... I do this in OnInit
bool test21=TTC.Create(this); //creating tooltipwindow theApp.tooltip=&(TTC); m\_but.MoveWindow(0,0,500,500); bool test11=theApp.tooltip->AddTool(m\_but,"Cool?"); TTC.Activate(TRUE);
and
BOOL MainDial::PreTranslateMessage(MSG* pMsg)
{
if (NULL != theApp.tooltip)
theApp.tooltip->RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}Appears a great button, but hint doesn't. Why? Any idea? Smthng that i'am missing? Huh?
Could it be that in your
OnInitDialog
theTTC
variable, which is i assume aCToolTipCtrl
a local variable? If so then when yourOnInitDialog
is done and returns,TTC
will be deleted and its destructor also destroys the tooltip. Of course that you don't get a crash inPreTranslateMessage
suggests this is not the case but it might happen. Try making yourTTC
a member of the dialog class if it is not and use that instance instead of storing a pointer at it.> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
-
Could it be that in your
OnInitDialog
theTTC
variable, which is i assume aCToolTipCtrl
a local variable? If so then when yourOnInitDialog
is done and returns,TTC
will be deleted and its destructor also destroys the tooltip. Of course that you don't get a crash inPreTranslateMessage
suggests this is not the case but it might happen. Try making yourTTC
a member of the dialog class if it is not and use that instance instead of storing a pointer at it.> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
Well.. My CToolTipCtrl is member of MainDial of course. And by the way i already made it work with this button, but now i have another trouble. I create lots of dynamic buttons, inside of MPictureBox.Create i write:
BOOL result = CButton::Create(lpszCaption,dwStyle,rect,pParentWnd,nID); this->SetParent(pParentWnd); theApp.tooltip->AddTool(this,"HM?!");
but once again it doesn't help. Hint doesn't appear. Any idea?
-
Well.. My CToolTipCtrl is member of MainDial of course. And by the way i already made it work with this button, but now i have another trouble. I create lots of dynamic buttons, inside of MPictureBox.Create i write:
BOOL result = CButton::Create(lpszCaption,dwStyle,rect,pParentWnd,nID); this->SetParent(pParentWnd); theApp.tooltip->AddTool(this,"HM?!");
but once again it doesn't help. Hint doesn't appear. Any idea?
You probably need to relay messages received by your picture box also to the tooltip control not only ones targeted at your dialog box. Aside of that, no idea. Just out of curiosity, what was your first problem?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
-
You probably need to relay messages received by your picture box also to the tooltip control not only ones targeted at your dialog box. Aside of that, no idea. Just out of curiosity, what was your first problem?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
My original problem was to make some sort of game. Jackal. It's a board game invented 30-40 years ago at MGU (principal university of Moscow). For now i made it, but it's possible to play it only for humans against humans on the same cpu (hot seat mode). (Later i plan to make net support and cpu gamers). If you want to see what i have done for now drop.io/shchepin/ release.rar (requires redistributable package for vs2008 sp1). P.S. I intented with
BOOL MPictureBox::PreTranslateMessage(MSG* pMsg)
{
if (NULL != theApp.tooltip)
theApp.tooltip->RelayEvent(pMsg);
return CButton::PreTranslateMessage(pMsg);
}Didn't helped... =(
-
My original problem was to make some sort of game. Jackal. It's a board game invented 30-40 years ago at MGU (principal university of Moscow). For now i made it, but it's possible to play it only for humans against humans on the same cpu (hot seat mode). (Later i plan to make net support and cpu gamers). If you want to see what i have done for now drop.io/shchepin/ release.rar (requires redistributable package for vs2008 sp1). P.S. I intented with
BOOL MPictureBox::PreTranslateMessage(MSG* pMsg)
{
if (NULL != theApp.tooltip)
theApp.tooltip->RelayEvent(pMsg);
return CButton::PreTranslateMessage(pMsg);
}Didn't helped... =(
What kind of a control is that picturebox?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <
-
What kind of a control is that picturebox?
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <