GUI: fitting containers to contents

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GUI: fitting containers to contents

Ross Boylan
I would like to display something that visually is boxes inside of
boxes.  If I add an inner box, or change its size, I want the outer
boxes to resize to accomodate the change.

Does anyone have recommendations about how to handle this?  VisualParts
seem to be oriented toward having the container tell the contained
object how big it should be, rather than the other way around.
preferredBounds do indicate how  big an object would like to be.

The application I have in mind is a tree, with each node having a text.
The nodes are categories, with subitems being subcategories.  As one
types the text the width of the box needs to grow.

Thanks for any hints.

Happy New Year!

Ross Boylan



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: GUI: fitting containers to contents

Ross Boylan
I noticed a few more things that might be relevant.
On Sat, 2011-01-01 at 11:25 -0800, Ross Boylan wrote:
> I would like to display something that visually is boxes inside of
> boxes.  If I add an inner box, or change its size, I want the outer
> boxes to resize to accomodate the change.
>
> Does anyone have recommendations about how to handle this?  VisualParts
> seem to be oriented toward having the container tell the contained
> object how big it should be, rather than the other way around.
> preferredBounds do indicate how  big an object would like to be.
CompositePart>>computePreferredBounds does compute bounds based on
components.  However, it uses the components' bounds, not their
preferredBounds, and it is not clear to me how or if the preferred
bounds get translated into actual bounds.  There is a
changePreferredBounds:forComponent:

Second, there is a class ReComposingComposite.  The class comment is
somewhat baffling:
<quote>
ReComposingComposite notices changes in the preferredBounds of its
components and forces relayout of all components.  This is useful for
implementing things like menu bars which can have dynamically changing
heights based on the allocated width (due to wrapping).


Object Reference
A ReComposingComposite is a CompositePart that automatically adjusts the
layout of its components whenever its containing window is resized. This
is useful when one of the components can forcibly occupy more height
when its width is reduced, such as a MenuBar, causing other components
to adjust.
All of a ReComposingComposite's public abilities are inherited.
</quote>

The first sentence of the comment says this class notices changes, but
rather than sending them up it redoes the elements it contains.
However, the second sentence seems to suggest the outer level object
(the menu) *will* resize (vertically).  The second paragraph seems to do
about the same zig-zag.

Ross

>
> The application I have in mind is a tree, with each node having a text.
> The nodes are categories, with subitems being subcategories.  As one
> types the text the width of the box needs to grow.
>
> Thanks for any hints.
>
> Happy New Year!
>
> Ross Boylan
>
>
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc