However, being an old-school-hardcore-unix-console-guy I run into a few
problems. I'm writing an installer type application that has one wxFrame
that displays a series of wxPanels displaying different installation
options (I'm testing this in win2000, wxPython 2.3.2.1 btw)
1. The first frame displays an empty wxEditableListBox. The 'new'-button
is greyed out although I can press it and it works as expected. Can I fix
that in some way?
2. All panels are laid out as following. They have an outer sizer that
contain an upper (the configuration options) and a lower (back, next,
cancel buttons). When next/back buttons are pressed, I
curnt_panel.Show(false), lay out next_panel and next_panel.Show(true). The
first panel fills the frame nicely (upper sizer is wxBoxSizer), but
subsequent panels only fill as much of the panel as needed to hold the
contents (upper sizer is wxFlexGridSizer). Clues?
3. I want to be able to hit one button, and have new buttons/text
controls/whatever appear in the panel, and disappear if the button is hit
again. I can make them appear ok (upper_sizer.Add), but when I want them
to disappear (upper_sizer.Remove) they just end up on top of other
buttons/controls. What's the correct way to do this?
4. Also partly, connected to the past two, how do I automagically resize
the wxFrame if a panel's size exceeds that of the frame?
2. All panels are laid out as following. They have an outer sizer that
contain an upper (the configuration options) and a lower (back, next,
cancel buttons). When next/back buttons are pressed, I
Forgot to mention that 'upper' and 'lower' are both sizers. Sorry about
that.
1. The first frame displays an empty wxEditableListBox. The 'new'-button
is greyed out although I can press it and it works as expected. Can I fix
that in some way?
What style are you giving it?
2. All panels are laid out as following. They have an outer sizer that
contain an upper (the configuration options) and a lower (back, next,
cancel buttons). When next/back buttons are pressed, I
curnt_panel.Show(false), lay out next_panel and next_panel.Show(true). The
first panel fills the frame nicely (upper sizer is wxBoxSizer), but
subsequent panels only fill as much of the panel as needed to hold the
contents (upper sizer is wxFlexGridSizer). Clues?
panel.SetSize(frame.GetClientSize())
3. I want to be able to hit one button, and have new buttons/text
controls/whatever appear in the panel, and disappear if the button is hit
again. I can make them appear ok (upper_sizer.Add), but when I want them
to disappear (upper_sizer.Remove) they just end up on top of other
buttons/controls. What's the correct way to do this?
You need to Hide() or Destroy() the controls you are removing from the
sizer.
4. Also partly, connected to the past two, how do I automagically resize
the wxFrame if a panel's size exceeds that of the frame?
Normally you would do someting like this:
sizer.Fit(frame)
But since you are swapping panels that would make the frame size (possibly)
change each time you called Fit... This might be better:
>
> 1. The first frame displays an empty wxEditableListBox. The 'new'-button
> is greyed out although I can press it and it works as expected. Can I fix
> that in some way?
What style are you giving it?
What styles are there ? Looked in various docs, but I can't find any.
I don't specify one in my example, btw.
Also, what events may be catched with the wxEditableListBox?
> [snip, how to make a panel's size match a frame]
panel.SetSize(frame.GetClientSize())
Great! My head was really starting to ache from being banged against the
wall
> [snip, how to make controls disappear from a frame]
You need to Hide() or Destroy() the controls you are removing from the
sizer.
Right. And apparently, don't touch (Remove(), Destroy()) nested sizers,
justs the children?