General layout strategy questions

Sorry, I should have mentioned that it is designed to have a sister
class "Control" that all of these fake controls are derived from. So it
first checks to see if the passed in object is a "Sizer" which is the
fake sizer class, if not then it checks to see if it is a "Control"
which would be a custom draw-on-parent class, and lastly it just passes
whatever it is to the real wx.Sizer class in case it is a real
wx.Control or (w,h) tuple for an actual spacer, etc. So your non-widget
classes need to derive from "Control". See the attached Control class
as an example. All the code I'm sending you is hacked from what I
actually use so I haven't tested it yet :slight_smile:

Note that your controls need to implement GetBestSize() (Another little
detail I forgot to mention).

I'll see if I can put together a demo tonight. You wouldn't happen to
have a 2.7 preview installed would you? Or just a windows machine (I
have a wxruntime built fomr CVSHEAD). All my code is designed to use
the new PseudoDC class I wrote that's in 2.7. If not I can still come
up with a demo, just takes longer.

-Paul

Controls.py (2.68 KB)

Hello Paul,

Sorry, I should have mentioned that it is designed to have a sister
class "Control" that all of these fake controls are derived from.

Yes, I figured out this :-D, I have only misinterpreted the code.

first checks to see if the passed in object is a "Sizer" which is the
fake sizer class, if not then it checks to see if it is a "Control"
which would be a custom draw-on-parent class, and lastly it just passes
whatever it is to the real wx.Sizer class in case it is a real
wx.Control or (w,h) tuple for an actual spacer, etc.

Ok, at last I was doing the right thing, but it took me a while to
understand... probably it's time for a vacation for me :smiley:

Note that your controls need to implement GetBestSize() (Another little
detail I forgot to mention).

Yes, I was doing that. Quite a little mess, but going forward at the moment.

I'll see if I can put together a demo tonight. You wouldn't happen to
have a 2.7 preview installed would you?

Yes, I have both 2.6.3.3 and 2.7 on Windows XP, so no problem for that :smiley:

Thanks for your help.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/