magiconexxx
17-04-2009 04:02:32
kungfoomaster:
I tried creating an event handler for a button that used the WIDGET_EVENT_ON_HOVER eventype, but this doesn't seem to work. I set my hover timer to 2 seconds:
My HoverCallback function never got called, though.
I looked through some of the QuickGUI code, and it seems like the only function that actually fires this widget event is the void GUIManager::hoverTimerCallback() function, which never gets referenced anywhere else in the QuickGUI code. I looked at the GUI manager, and I see it creates a timer at the constructor, then starts a timer at every mouse movement event, and it looks like an ogre framelistener runs through all of the timers and updates them. I set a breakpoint to the Timer::update section, and mCallback->execute(); never seems to get called. A little more digging, and it looks like mCallback needs to instantiated by Timer::setCallback, but I don't actually see this get called anywhere, either. I'm guessing there is missing glue to hook Timer::setCallback to GUIManager::hoverTimerCallback?
Am I on the right track, or am I missing something in my code?
I tried creating an event handler for a button that used the WIDGET_EVENT_ON_HOVER eventype, but this doesn't seem to work. I set my hover timer to 2 seconds:
QuickGUI::ButtonDesc* bd = QuickGUI::DescManager::getSingleton().getDefaultButtonDesc();
bd->resetToDefault();
bd->widget_name = name;
bd->widget_hoverTime = 2;
bd->widget_dimensions = QuickGUI::Rect(0,0,64,32);
QuickGUI::Button *pButton = mpPanel->createButton(bd);
pButton->setSkinType(name);
pButton->addWidgetEventHandler(QuickGUI::WIDGET_EVENT_MOUSE_BUTTON_DOWN, &StructurePanel::StructureSelectedCallback, this);
pButton->addWidgetEventHandler(QuickGUI::WIDGET_EVENT_ON_HOVER, &StructurePanel::StructureHoverCallback,this);
pButton->addWidgetEventHandler(QuickGUI::WIDGET_EVENT_MOUSE_LEAVE, &StructurePanel::StructureHoverGoneCallback,this);
My HoverCallback function never got called, though.
I looked through some of the QuickGUI code, and it seems like the only function that actually fires this widget event is the void GUIManager::hoverTimerCallback() function, which never gets referenced anywhere else in the QuickGUI code. I looked at the GUI manager, and I see it creates a timer at the constructor, then starts a timer at every mouse movement event, and it looks like an ogre framelistener runs through all of the timers and updates them. I set a breakpoint to the Timer::update section, and mCallback->execute(); never seems to get called. A little more digging, and it looks like mCallback needs to instantiated by Timer::setCallback, but I don't actually see this get called anywhere, either. I'm guessing there is missing glue to hook Timer::setCallback to GUIManager::hoverTimerCallback?
Am I on the right track, or am I missing something in my code?