[Solved] Combo boxes and Vertical Layout Containers

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

TheWanderer
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Wed Feb 03, 2016 21:58

[Solved] Combo boxes and Vertical Layout Containers

Postby TheWanderer » Fri Jun 09, 2017 16:44

So I have a vertical layout container which I'm using to display a list of entries which a user can modify (imagine an Excel sheet). Each entry consists of a row of elements, one of which is a Combobox.

Now, when I initially create my Combobox, I set it's height to be just enough to show the currently selected item in the Combox box. When that combobox is expanded though, I increase it's size to show the selectable options. Since the parent LayoutContainer is listening to changes in size, it ends up pushing all the rows below down, which looks odd. I'd prefer if the layout container did not change size when I did that.

So my question is what is the best way to handle said situation? Should I mute the EventSet when I resize the comboxbox? Or should I unsubscribe from the event itself? Or is there another option?

Thanks for any help!

Code: Select all

---- Version: 0.8.4 (Build: Jul 13 2016 Static Debug Microsoft Windows MSVC++ 11.0 32 bit) ----
---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
---- XML Parser module is: CEGUI::RapidXMLParser - Official RapidXML based parser module for CEGUI ----
---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
---- Scripting module is: None ----

User avatar
Ident
CEGUI Team
Posts: 1836
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Combo boxes and Vertical Layout Containers

Postby Ident » Sat Jun 10, 2017 14:27

That's an unfortunate combination of behaviours :| . Honestly, I always have found it quite weird that the expanded version of the combobox depends on the combobox's original size at all. Maybe it would make more sense if the expanded element acted like a child that ignores its parents clipping in general. But then no parent would clip it at all. Not sure if that is desirable either...

I do not have a suggestion on how to turn the reaction of the parent layoutcontainer off, on any size changes, but yea muting the eventset would be one way to do this. It might have side-effects though.

What if you place the combobox into a defaultwindow (doesnt render anything on its own) , setting it to the size you want and let it have the combobox as child, which may change its size however it wants. For the combobox turn the parent clipping off. Sounds like it could work and it would have less side-effects than muting all events. :pint:

Tell me if this worked for you.
CrazyEddie: "I don't like GUIs"

TheWanderer
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Wed Feb 03, 2016 21:58

Re: Combo boxes and Vertical Layout Containers

Postby TheWanderer » Fri Jun 23, 2017 16:25

Hey Ident,

Thank you for the quick reply and apologies for the late response; I went down the rabbit hole on a new feature and have just now resurfaced.

Wrapping the comboboxes (and their rows) in a Default Window did indeed work. It was an quick replacement since I was already wrapping them in a horizontal layout container (HLC) and I just had to chang one into the other. I'm thinking of adding the HLC I replaced as a child of the Default Window, though I start to worry about the costs of adding so many wrappers (though I guess that is not any different from what the UI is already doing).

Many thanks for the suggestion, Ident!

User avatar
Ident
CEGUI Team
Posts: 1836
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Combo boxes and Vertical Layout Containers

Postby Ident » Fri Jun 23, 2017 17:22

CEGUI is very efficient, especially if things dont change much it practically costs you almost nothing to have an extra DefaultWindow. This is except for when you might be interacting with the UI, but then again how often do you click per tick ;)
CrazyEddie: "I don't like GUIs"


Return to “Help”

Who is online

Users browsing this forum: No registered users and 1 guest