Layout Editor: Resize only parent
Moderators: CEGUI MVP, CEGUI Team
Layout Editor: Resize only parent
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.
I'm doing it manually:
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
- 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
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?
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?
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.
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.
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.
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.
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
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?
>> 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.
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