Here's where you'll really run into problems doing things
your way. But
if you use sizers as they're intended, then there's no such problem.
I'd recommend maintaining a separate list of subpanels in
your parent
window, and attaching your event handlers there (if not
simply putting
the event handlers on the subpanels themselves). Then it
won't matter
what order panels are in the sizer, and you can even move them
dynamically without needing to worry about event handlers. Let the
sizer do just sizing/positioning, and your life will be much
simpler.
I think the original poster has the same problem as
me. That is lets say you have 4 panels in a sizer
then you reorder the panels so that you place
the panel 4 at second place. This is not that easy
with the current API, but if the sizer behaved more
like list you would easily be able to remove the panel
and the insert it in second place.
Right now I am rebuilding the sizer from scratch
since this seems to be the easiest way to handle
it right now. But there is a function for inserting items in a sizer
where you want. The below is cut and pasted from a post by
Patrick O'Brien.
Yes, but it inserts before, not after:
def Insert(self, before, item, proportion=0, flag=0, border=0,
userData=wx.NULL):
"""Same as Add, but inserts item into list of items (windows,
subsizers or spacers) owned by this sizer."""
The entire sizer API is documented here: