Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - PtDivider and dynamically adding children: (3 Items)
   
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.
Re: PtDivider and dynamically adding children  
Check your PtDivider's Pt_ARG_RESIZE_FLAGS. Set them to 0.
I think anchoring is on your way here. Try to disable anchoring before you start adding children. Adjust size of all 
children accordingly. Set anchors back.
Re: PtDivider and dynamically adding children  
Thanks! I think it was the resize flags. Unrealizing the divider and
realizing it again worked as well, but this seems like the right thing
to do. I didn't touch the anchoring, so it apparently wasn't the problem.

Misha Nefedov wrote:
> Check your PtDivider's Pt_ARG_RESIZE_FLAGS. Set them to 0.
> I think anchoring is on your way here. Try to disable anchoring before you start adding children. Adjust size of all 
children accordingly. Set anchors back.
>
>
> _______________________________________________
> QNX Momentics Community Support
> http://community.qnx.com/sf/go/post24725
>