wxSizer problem.
James Bigler
bigler at cs.utah.edu
Mon May 14 09:25:02 PDT 2007
Hi,
Tommy W wrote:
> Hi, I have a small problem
>
> I'm using the following layout
> _____
> | |
> | | <-- wxBoxSizer(wxVERTICAL)
> |-------|
> |_|___| <--- wxFlexGridSizer(2,2,0,0);
> |_|___|
> |_|___|
> | TEXT| <--- wxStaticText added to the wxVERTICAL-box sizer
> |_____|
>
> And everything is added to a wxPanel which is added to a wxFrame.
>
> The problem is the following code
>
> void MyFrame::SetText(const wxString &text)
> {
> m_text->SetLabel(text);
> m->Layout();
> m->Fit();
> }
>
> I've tried calling them in different order but nothing seems to work.
> Under wxMSW it seems to be resized very very sporadic.
> Under wxGTK it works most of the time, but not all the time.
>
> What I want to happen is, if the text is too long for the window to display it
> all, the window should be resized.
> But the thing is, it doesn't work all the time. for some reason.
> What could be the reason?
> do I have to call panel->Layout(); panel->Fit();
> I'm not quite sure how this should work ...
Have you tried calling Layout() on the parent ( I guess this would be
panel or the flex grid sizer)? I know if you hide or unhide widgets you
need to call Layout() on the parent to get things to look proper.
James
More information about the wx-users
mailing list