Tooltips and Widget::eventToolTip not being triggered

djpcradock

06-04-2010 21:07:33

I'm trying to figure out tooltips and looking through the examples, I've come to the following probably wrong conclusion...

I want to create a button, which, once the mouse is over after a short delay, some form of tooltip is displayed.

So I happily go along, init MyGUI and create a button, something like below (slightly modified for easier reading)...

MyGUI::OgrePlatform *mpGUIPlatform = new MyGUI::OgrePlatform();
mpGUIPlatform->initialise(gpApp->mpWindow, gpApp->mpSceneMgr); // Where mpWindow and mpSceneMgr are already init
MyGUI::Gui *mpGUI = new MyGUI::Gui();
mpGUI->initialise();

Then, withing the class calling the above, I also have a method who's declaration looks something like this...

// I guess, this is supposed to be called when the mouse is over a Widget and the tooltip is to be shown
void SCGUI::cbTooltip(MyGUI::Widget *_sender, const MyGUI::ToolTipInfo &tti);

// Then I create the button...
MyGUI::Button *mpButton = mpGUI->createWidget<MyGUI::Button>("Button", 100, 0, 100, 20, MyGUI::Align::Default, "Main");
mpButton->setCaption("TestButtonWeee");

// Then I probably wrongly assign the above cbTooltip method to the eventToolTip member of the button object...
mpButton->eventTooltip = MyGUI::newDelegate(this, &SCGUI::cbTooltip);

// And just for extra sanity check, I also enable the tooltip of the widget with...
mpButton->setEnableToolTip(true);

I then add a breakpoint within the SCGUI::cbTooltip() method, but it never gets called, am I totally missing something somewhere?

I'll add the "I've searched the forums, read the MyGUI wiki and looked through the example source" thing, I'm missing something, I'm a little clueless.
I believe that I do the above (but working), then within the method which isn't being called, create a Window or something, which acts as the tooltip, or am I wrong there also?

I hope the above is clear and to the point, I've had a glass of wine... however, I've been trying to figure this out for about 2 hours before drinking :)

my.name

07-04-2010 09:54:37

setNeedToolTip(true)

djpcradock

07-04-2010 09:59:53

I've spent another hour this morning fiddling and I can't believe I missed that!
Now the callback gets called no problems.

Thank you.