[solved] What is the deal with tooltips?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

[solved] What is the deal with tooltips?

Postby Jamarr » Fri Jun 06, 2008 21:53

Code: Select all

Void Init()
{
   ...
   CEGUI::System::getSingleton().setDefaultTooltip("WindowsLook/Tooltip");
   ...
}

// time since last call
Void HandleTime(Float inTimeCall)
{
   CEGUI::System::getSingleton().injectTimePulse(inTimeCall);
}


This does not work if I call HandleTime() every frame (~.01-.025s). However, if I call it every .5s it kinda works.

What I mean by 'kinda' is that the tooltips for my Editbox and MutiLineEditbox seem to work fine, but my ItemListBox's do not and my PushButton's randomly work: sometimes the button just flashes (hover highlight on/of), and other times it actually displays the tooltip.

This leads me to believe that either the internal elapsed time variable is not being updated correctly, or some event is causing it to reset before the tooltips hover time is ever triggered. But I just recently downloaded CEGUI so I'm not very familiar with it yet, so I haven't been able to track down the problem area.

I tried searching for the issue on the forums, and found a few threads that seemed to have the same problem but no solution was actually posted, and the general response was something like "well it's supposed to work" and then //threadover. Help?
Last edited by Jamarr on Thu Jul 03, 2008 20:32, edited 1 time in total.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Fri Jun 06, 2008 23:06

Ok, so I went back to look at the Samples and I noticed that the OpenGL sample was working correctly, but that the Direct3D9 sample was not. However, that just turned out to be a bug in the Direct3D9 SampleHelper code not injecting the correct time value.

So, then I thought well if it's working in the sample it must be an event that is resetting cegui's internal elapsed time. Well, I noticed that Tooltip::resetTimer() is called by Tooltip::setTargetWindow(), which is called by Window::onMouseEnter(), which is *always* called by System::injectMouseMove(), which is also called by System::injectMousePosition().

Well, I happen to be using System::injectMousePosition() inside a callback for the SDK I'm using which just happens to make this callback *every frame*, even if the mouse position did not change. I guess I assumed that System::injectMousePosition() would handled this case (as the name sort of implies). So, I was able to fix my tooltips by caching the position inside my callback and only calling System::injectMousePosition() when the mouse's position actually changed.

This could be avoided in the future if cegui checked for this internally, but if nothing else this behavior should at least be documented in the "Injecting Inputs" tutorial, etc.

Hopefully this information will save someone else the trouble :)

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Sat Jun 07, 2008 08:20

Hi,

Thanks for raising the mouse position injection issue, I'll look into it.

With reference to the broken sample helper code - this has been (or should be!) fixed in SVN branches/v0-6 ready for the next release :)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 4 guests