Layout Editor: Resize only parent

Use this forum for:
- Discussion regarding unofficial CEGUI related tools, scripts and utilities.
- User to user help for the obsoleted CELayoutEditor and CEImagesetEditor tools.

Moderators: CEGUI MVP, CEGUI Team

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Layout Editor: Resize only parent

Postby Rackle » Wed May 31, 2006 14:59

I created a FrameWindow and started adding children. Sadly it turned out that I had under-estimated the width of my FrameWindow; I now need to stretch it to the right. When I drag the border of the Framewindow it also resizes the children. How can I expand/shrink a parent window without having it resize the children? Right now I have to resize every child widget after resizing the parent.
Last edited by Rackle on Fri Jan 18, 2008 15:30, edited 1 time in total.

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:

Postby scriptkid » Thu Jun 01, 2006 09:43

Hi Rackle,

ATM there isn't anything to do about this behaviour. However we have received a patch from a user who mentiones that this kind of support is added. I don't have it here yet, but i can have a look and might be able to tell you more, or apply the patch.

HTH.

User avatar
Nitro
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Wed Jan 12, 2005 12:06

Postby Nitro » Sat Dec 30, 2006 12:23

Was this feature ever included into the editor? Or does anybody know where I can get that patch?
I am facing exactly the same problem and I wonder how people can seriously use the editor without it. It's a really vital feature imo.

-Matthias

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Sat Dec 30, 2006 13:42

I'm doing it manually:
  • Add a widget
  • Set the Right Scale to the same value as the Left Scale
  • Set the Bottom Scale to the same value as the Top Scale
  • Set the Right Offset to the "relative" width I want
  • Set the Bottom Offset to the "relative" height I want


By relative I mean relative to the widget's (0,0) coordinate, rather than relative to the parent's (0,0) coordinate. This makes it easy to have multiple widgets of the same height and width

User avatar
fezztah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jun 20, 2007 14:50

Postby fezztah » Fri Jan 18, 2008 11:33

Sorry to awaken an old thread, but I'm coming up against this issue too.

Buttons always need to comply to some app specific fixed size and this can be set manually as mentioned above, but then gui's get tidied up and moved around and everything starts scaling again.

I wondered if a simple solution is just to detect the fact RightScale==LeftScale and BottomScale=TopScale and in that specific case keep the right and bottom values matching the left and top values as the widget gets moved around or re-aligned? That way you could manually fix the size of certain widgets and they'd stay that way even if moved.

For example, after prototyping a complex gui I go through all the buttons and manually set the bottom and right scales to match their top and left values and set them all to 60x30. Now I've got a uniform button size on every page of the gui and they won't resize when I move windows around or generally tidy things up.

I wouldn't know where to begin in the code, can anyone point me in the right direction. Is this a minor fix or just madness? :)

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Fri Jan 18, 2008 17:00

fezztah I personally prefer for old threads to be reawakened if the new text is pertinent; the old thread wasn't resolved and new information or simply new interest is added.

It's been a while since I created a GUI so let this topic slide. Well, that and my solution posted above. But now that time has elapsed I think I see the problem differently.

There are multiple possible situations. In the first I want my child widgets to retain their sizes when resizing the parent, such as when I'm creating a window and find that my initial dimension is either too small or too large.

In the second situation I want to anchor the right side of an EditBox to the right border of the parent FrameWindow such that resizing the FrameWindow will stretch the EditBox to the right but not increase its height. This can be accomplished by specifying the bottom scale and the bottom offset as within the post above.

I think the best solution would be to add a toggle within the Layout Editor to activate/deactivate the special case situation where we do not want to modify the size of the children.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Fri Jan 18, 2008 18:09

To continue my previous post...

Maybe resizing a parent while holding down a key (shift, ctrl, alt) could be the command to retain the children's dimensions. One difficulty would be when the child is anchored to the parent.

1) convert the child into absolute units (10% into 40 units)
2) resize the parent (400 units into 500 units)
3) calculate the scale component based on the child's absolute units and the parent's new dimension (40 units over 500 units is 8%)

With fake numbers this approach works well. But once we use real number with many decimal places I'm afraid we may lose precision and the child of 40 absolute units may become 39 or 41 units, a situation that becomes worse the more frequently we resize the parent.

Another approach would be change the Layout Editor's GUI such that widgets are positioned with absolute units (at position 52, 43 and a dimension of 8, 7) and possibly anchored left, top, right, bottom. When resizing the parent only the anchored children would be changed, such as an EditBox anchored to the right would be stretched.

Yet another approach is to design additional layout managers such as the one presented in GridLayout to satisfy other situations. This approach bypasses the Layout Editor completely.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sat Jan 19, 2008 01:42

Rackle wrote:Yet another approach is to design additional layout managers such as the one presented in GridLayout to satisfy other situations. This approach bypasses the Layout Editor completely.

Personally, I think this is the only viable/perfect solution. Anyone already uset the QT Designer ? It's the way it works, and ... it just works !

good night :)

User avatar
fezztah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jun 20, 2007 14:50

Postby fezztah » Mon Jan 28, 2008 15:23

Rackle wrote:To continue my previous post...

Maybe resizing a parent while holding down a key (shift, ctrl, alt) could be the command to retain the children's dimensions.


That sounds great. :)

Rackle wrote:One difficulty would be when the child is anchored to the parent.

Is this some future feature you're considering, I don't see any way of doing that in the current layout editor?

Rackle wrote:With fake numbers this approach works well. But once we use real number with many decimal places I'm afraid we may lose precision and the child of 40 absolute units may become 39 or 41 units, a situation that becomes worse the more frequently we resize the parent.


Is there a requirement to use decimal places in the layout editor, I'd have thought sticking to integer units would be a good idea?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Jan 28, 2008 15:44

>> Is this some future feature you're considering

This is only a discussion of ideas, nothing concreate. However the code for the Layout Editor is available and submissions are welcomed; anyone could code this feature. However I feel that there are some kinks that need to be worked out before starting to code.


Return to “Unofficial CEGUI-Related Tools”

Who is online

Users browsing this forum: No registered users and 8 guests