Hi~
In our project with CEGUI, the windows' prompt(window) is showing when onMouseEnters and disappear when onMouseLeaves,because the CEGUI's tool tips is too weak for us.But CEGUI system haven't called onMouseLeaves when window destroyed ,so that our prompt window always show.
Do anyone had any idea that calling onMouseLeaves when window's destoryed in long CEGUI development journey, or has some special problem our haven't considered?
Thanks great GUI system.
onMouseLeaves when window destoryed
Moderators: CEGUI MVP, CEGUI Team
Re: onMouseLeaves when window destoryed
I can see how this could be a problem. However, technically speaking the mouse is not leaving the window; I'm not sure that CE would add this feature just because it is convenient.
In any case, you can implement this yourself by subscribing to the global event for window destruction and fireing the mouse-leaves event yourself. Ex (this is only pseudo code):
In any case, you can implement this yourself by subscribing to the global event for window destruction and fireing the mouse-leaves event yourself. Ex (this is only pseudo code):
Code: Select all
...
CEGUI::GlobalEventSet::getSingleton().subscribeEvent( "Window/DestructStart", &windowDestructHandler );
...
bool windowDestructHandler (const CEGUI::EventArgs& e)
{
const CEGUI::Window* wnd = static_cast<const CEGUI::MouseEventArgs&>(e).window;
window.fireEvent(Window::EventMouseLeaves, MouseEventArgs(&window));
return true;
}
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
Re: onMouseLeaves when window destoryed
Thanks for reminding.
we just change the source code of CE directly :
forgive my poor English
we just change the source code of CE directly :
Code: Select all
void Window::destroy(void)
{
// because we know that people do not read the API ref properly,
// here is some protection to ensure that WindowManager does the
// destruction and not anyone else.
WindowManager& wmgr = WindowManager::getSingleton();
// .....
releaseInput();
if(System::getSingleton().getWindowContainingMouse() == this){
// in our project the prompt window disappearing will be injected in
// mouse leaves event , so will inject this event before window destroyed
//
System::getSingleton().injectMouseLeaves();
}
// .....
}

- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: onMouseLeaves when window destoryed
Calling injectMouseLeaves is not correct here. This is used to inform CEGUI that the mouse has left the host window (i.e. the window provided by your operating system or window manager toolkit). The correct thing would be to listen for destruction events as Jamarr suggested, or if you want to modify the code, just call Window::onMouseLeaves instead.
CE
CE
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 8 guests