Hi All,
Cody Precord wrote:
Hello,
The bug was related on the style of automatic AuiNotebooks: I have
exceeded the number of style I can use before interfering with
wxWindow styles, so the style AUI_NB_DRAW_DND_TAB has actually the
value of wx.CLIP_CHILDREN, which shouldn't happen. Now, which is the
best practice to implement when the styles are too many? Using extra
styles as wx.Window does?
I would say its a matter of preference, but I would look at the current
style flags and sort out the ones that would probably not be very commonly
used in a bare non subclassed version of the control and move them to being
properties that can be set on or off.
Agreed. Things that are visual could be kept as styles, and others can be
handled with setters and getters. If you want to be able to still set them
in the call to __init__ then you can add additional keyword parameters that
set those properties.
The usefulness of having everything in a single "style" keyword is,
apart of being able to write:
AuiNotebook.__init__(self, parent, style=AUI_STYLES|wxWINDOW_STYLES)
that the "style" keyword is passed directly to the tab rendering
engines (AuiTabArt), without messing up with other properties. The
AuiTabArt knows only about this "style" keyword and nothing else, and
this keyword contains all the information needed to properly draw a
tab. If I have to use properties for some of the flags, I need either
to pass a bunch of properties to the tab rendering engine like this:
self.SetArtProvider(AuiTabArt(flags, property1, property2, property3,
..., propertyN))
Or to pass a reference of the AuiNotebook to the AuiTabArt. This is
somehow cumbersome and not consistent with what AuiDockArt (the
rendering engine for AuiManager) does. AuiDockArt knows only about the
"style". So, I believe I am going to split window styles and AUI
styles in 2 keywords, so that the __init__ method of AuiNotebook can
be written like this:
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize,
aui_style=AUI_NB_DEFAULT_STYLE, win_style=0)
I know it might break someone else's code (although the only person I
know that is using (?) AUI is Werner) and I also know it will not be
interchangeable with wx.aui.AuiNotebook. Unless someone can come up
with a better solution...
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On Tue, Apr 21, 2009 at 9:35 PM, Robin Dunn wrote:
On Tue, Apr 21, 2009 at 8:14 AM, Andrea Gavana <andrea.gavana@gmail.com >> <mailto:andrea.gavana@gmail.com>> wrote: