Hi,
I put a child window onto my ItemEntry. With MousePassThroughEnabled be True, the ItemEntry looks fine. But I want the child window to handle some mouse events, such as clicked. So I am in a dilemma now, if the child window's MousePassThroughEnabled is True, the chiled window cannot receive the clicked event, otherwise, if the chiled window's MousePassThroughEnabled is False, the child is ok, but the ItemEntry cannot switch to hover state when mouse moves into the child, and cannot switch to selected state if clicked in the child, even when the child does not actually handle that click.
I cannot rewrite my ItemEntry using no child windows, because my child window is something complex custom window.
problem about ItemEntry
Moderators: CEGUI MVP, CEGUI Team
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Re: problem about ItemEntry
Interesting. I'm not sure whether the mouse can be in more then one window at the same time. You could easily check this by adding MouseEnter and MouseLeave listeners to both your parent and child to catch those.
If it weren't for the hover state (visually), you could trap all events in your main item entry, and, in case of a click loop all children to check if the mouse is inside one of them, and them perform a click action programatically on it.
I will try to fiddle a bit inside on of the sample files myself, since i'm curious too
If it weren't for the hover state (visually), you could trap all events in your main item entry, and, in case of a click loop all children to check if the mouse is inside one of them, and them perform a click action programatically on it.
I will try to fiddle a bit inside on of the sample files myself, since i'm curious too
Check out my released snake game using Cegui!
Re: problem about ItemEntry
It seems that we have to manually dispatch the clicked events for such ItemEntries. It looks not so beautiful, but it should work. I'll try it! Thank you!
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Re: problem about ItemEntry
Hi, yes. I have setup a little sample. And as soon as a child gets mouse focus, the parent looses it. However, when dispatching the mouse events to children, only the parent item will appear to have focus, be clicked or what ever. But if it's enough when only your ItemEntries look hovered, then this should be a fairly common solution imo.
Good luck!
Good luck!
Check out my released snake game using Cegui!
Re: problem about ItemEntry
It works, thank you. But I wonder how you notify the child of clicked. My custom child window does something in onMouseClicked, so I cannot just fire an event from the child window. But onMouseClicked is a protected function, I must call it from a Window derived class. I do not want to write an ItemEntry derived class just for this, so, I add a public function to the child just wrapping onMouseClicked, and call this public funcion from my clicked handler function of the ItemEntry. What's the common solution, write an ItemEntry derived class for every such compound entry, or hack into onMouseClicked of every child of such entry?
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 6 guests