problem about ItemEntry

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

lcy03406
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Apr 24, 2009 01:18

problem about ItemEntry

Postby lcy03406 » Tue Jun 01, 2010 13:22

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.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: problem about ItemEntry

Postby scriptkid » Tue Jun 01, 2010 15:24

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 :)
Check out my released snake game using Cegui!

lcy03406
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Apr 24, 2009 01:18

Re: problem about ItemEntry

Postby lcy03406 » Wed Jun 02, 2010 03:44

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!

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: problem about ItemEntry

Postby scriptkid » Wed Jun 02, 2010 07:54

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!
Check out my released snake game using Cegui!

lcy03406
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Apr 24, 2009 01:18

Re: problem about ItemEntry

Postby lcy03406 » Wed Jun 02, 2010 08:42

:D 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 8 guests