Norton Allen
|
PtDivider and dynamically adding children
|
Norton Allen
03/18/2009 12:42 PM
post24720
|
PtDivider and dynamically adding children
I'm having some trouble figuring out the best way to dynamically add a new child to a PtDivider. My application uses a
simple PtWindow containing a single PtDivider widget anchored Top/Top,Bottom/Bottom,Left/Left,Right/Right to the window.
It starts with a single PtPane child taking up the entire PtDivider. I need to dynamically add additional panes.
If I simply add a new PtPane and realize it, the PtDivider increases its size to contain the new pane, so it no longer
fits in the window. If I reset the size of the PtDivider, it's contents are now larger than the divider, and until the
window gets resized larger than the divider's contents, the divider won't resize the contents to fit. I have tried
resizing the contents myself, but the PtDivider seems to keep a record of the larger size, and actually increases the
size of the contents to reach that larger size instead of it's own size.
I've tried several approaches, and I have a few more up my sleeve to try, but I thought it was worth asking if there is
a clear way to do this.
My next two attempts will be:
1. Unrealizing the PtDivider, adding the new PtPane and setting the sizes of all the Panes to fit within the PtDivider,
then realizing the PtDivider.
2. Adding the PtPane with a small size, then increasing the window size to match the new size of the PtDivider, then set
the pane sizes the way I want them and possibly shrinking the window size back to where it started.
|
|
|