I'm designing some screens which will be similar in appearance and contain
the same underlying code regarding multiple sizers to hold panels etc.
However the main grid sizer on the panels will have different numbers of rows
dependant on program context, , and each row may or may not have multiple
controls.
Is it possible to have a routine like:
Class BasicPanel(wxPanel):
etc
code in here for sizer configuration
including grid sizers, background etc..
and pass down to that routine an array of sizers which I have 'preloaded'
with the necessary controls pertaining to a particular screen display?
Probably sounds confusing, but I'd appreciate any thoughts
I think it *should* be possible. I wrote a short script to test the idea
of dynamically (re)assigning sizers to a window, but it crashes out (on
both wxGTK and wxMSW2K) when you call the SetSizer() method on the panel
for a second time. The script it attached. If anyone can explain why it
doesn't work, I'd appreciate it.
According to the wxWindows documentation, passing a NULL argument to the
SetSizer() method should disassociate the current sizer from a window.
Is this implemented in wxPython, Robin?
I'm designing some screens which will be similar in appearance and contain
the same underlying code regarding multiple sizers to hold panels etc.
However the main grid sizer on the panels will have different numbers of rows
dependant on program context, , and each row may or may not have multiple
controls.
Is it possible to have a routine like:
Class BasicPanel(wxPanel):
etc
code in here for sizer configuration
including grid sizers, background etc..
and pass down to that routine an array of sizers which I have 'preloaded'
with the necessary controls pertaining to a particular screen display?
Probably sounds confusing, but I'd appreciate any thoughts
I think it *should* be possible. I wrote a short script to test the idea
of dynamically (re)assigning sizers to a window, but it crashes out (on
both wxGTK and wxMSW2K) when you call the SetSizer() method on the panel
for a second time. The script it attached. If anyone can explain why it
doesn't work, I'd appreciate it.
When you call SetSizer the old one (if any) is deleted so the crash happenss
when you try to access a deleted C++ object. In 2.3.3 there is a new 2nd
parameter to SetSizer that specifies if the old one should be deleted or
not.
According to the wxWindows documentation, passing a NULL argument to the
SetSizer() method should disassociate the current sizer from a window.
Is this implemented in wxPython, Robin?
It should be automatic. I'll see if I can figure out why it isn't working.
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
> I think it *should* be possible. I wrote a short script to test the idea
> of dynamically (re)assigning sizers to a window, but it crashes out (on
> both wxGTK and wxMSW2K) when you call the SetSizer() method on the panel
> for a second time. The script it attached. If anyone can explain why it
> doesn't work, I'd appreciate it.
When you call SetSizer the old one (if any) is deleted so the crash happenss
when you try to access a deleted C++ object. In 2.3.3 there is a new 2nd
parameter to SetSizer that specifies if the old one should be deleted or
not.
> According to the wxWindows documentation, passing a NULL argument to the
> SetSizer() method should disassociate the current sizer from a window.
> Is this implemented in wxPython, Robin?
It should be automatic. I'll see if I can figure out why it isn't working.
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!