> I am using FlexGridSizer to layout a window and am having problems
> getting a Panel to display when added to the Sizer with the Panel or
> its row set not to grow. If I set it to grow then it displays. Also when
> I remove the Panel and have the StaticTexts as children of $this then
> the content displays.
>
> I want the Panel to be only as high as it needs to be to display its
> content (message headers) leaving the rest of the window for the message
> text. Which is why I don't want to set wxGROW or AddGrowableRow().
>
> I am using a Panel so I can set the background and a border around a
> collection of StaticTexts.
>
> The testcase below shows the problem. If I remove the wxGROW from line
> 48 or comment out line 52 the the Panel doesn't display.
>
> Can someone tell me what I am doing wrong as I have tried everything I
> can think of without success?
>
> I am using WxPerl 0.11 with ActivePerl Build 629.
The attached modified program works:
1 - change the top FlexGridSizer to a BoxSizer (not necessary...)
2 - call $headsizer->Fit($headpanel)
Explanation:
When not using wxGROW/setting the second parameter to add to 0,
sizers use the original size to get the width/height of the window;
if you don't give an explicit size to the window, it defaults to [-1,-1]
for a panel, hence it is not visible.
Not related: you should use a red-only TextCtrl instead of a StaticText,
otherwise the user can't do cut'n'paste
Regards
Mattia
|