I can't seem to select more than one item in a CustomTreeCtrl with
wx.TR_MULTIPLE style on. See attached example. I would expect both
item1 and item2 to be selected, but they're not. What am I doing
wrong?
I can't seem to select more than one item in a CustomTreeCtrl
with wx.TR_MULTIPLE style on. See attached example. I would
expect both
item1 and item2 to be selected, but they're not. What am I
doing wrong?
CustomTreeCtrl takes 2 "style" keywords: the first, names "style", assigns the style to the underline wx.PyScrolledWindow. The other one, called "ctstyle", is used for CustomTreeCtrl itself. On your sample, try this:
ctstyle=wx.TR_DEFAULT_STYLE | wx.TR_MULTIPLE
It works for me.
Andrea.
···
_________________________________________
Andrea Gavana (gavana@kpo.kz)
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London
Ah darn, I did try ct_style because that keyword is used for
AppendItem... Why two spellings?
Also, since a CustomTreeCtrl is a TreeCtrl first and a
PyScrolledWindow second wouldn't it be more logical to have a new
keyword for the scrolledwindow style and use 'style' for the tree
style?
Thanks, Frank
···
2007/2/12, Gavana, Andrea <gavana@kpo.kz>:
CustomTreeCtrl takes 2 "style" keywords: the first, names "style", assigns the style to the underline wx.PyScrolledWindow. The other one, called "ctstyle", is used for CustomTreeCtrl itself. On your sample, try this:
Ah darn, I did try ct_style because that keyword is used for
AppendItem... Why two spellings?
I have no idea .
I suppose I didn't pay too much attention when I wrote CustomTreeCtrl,
so it just slipped in as a perfect inconsistency.
Also, since a CustomTreeCtrl is a TreeCtrl first and a
PyScrolledWindow second wouldn't it be more logical to have a new
keyword for the scrolledwindow style and use 'style' for the tree
style?
Yes, I believe it would be much more logical. Any suggestion about the
new keyword? Actually, I think that these 2 modifications plus the
patch about the UnselectAll() bug plus the fix on the classmethod
missing in CustomTreeCtrl should go in a patch for Robin, if he has
time to integrate it for the new release.
Also, since a CustomTreeCtrl is a TreeCtrl first and a
PyScrolledWindow second wouldn't it be more logical to have a new
keyword for the scrolledwindow style and use 'style' for the tree
style?
Yes, I believe it would be much more logical. Any suggestion about the
new keyword?
Is there any reason why a single style parameter can't be used? The style flags with values in the upper half of the 32-bit value are reserved for generic window styles, but the lower half is reserved for the individual controls. So you should be able to have up to 16 styles in the range of 1 .. 2^15 without conflicting with anything that the scrolled window is going to be looking for.
Actually, I think that these 2 modifications plus the
patch about the UnselectAll() bug plus the fix on the classmethod
missing in CustomTreeCtrl should go in a patch for Robin, if he has
time to integrate it for the new release.
Sure.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Andrea Gavana wrote:
>> Also, since a CustomTreeCtrl is a TreeCtrl first and a
>> PyScrolledWindow second wouldn't it be more logical to have a new
>> keyword for the scrolledwindow style and use 'style' for the tree
>> style?
>
> Yes, I believe it would be much more logical. Any suggestion about the
> new keyword?
Is there any reason why a single style parameter can't be used? The
style flags with values in the upper half of the 32-bit value are
reserved for generic window styles, but the lower half is reserved for
the individual controls. So you should be able to have up to 16 styles
in the range of 1 .. 2^15 without conflicting with anything that the
scrolled window is going to be looking for.
No, actually I don't think there is a special reason for that. At that
time, I was still influenced by "special" keywords (as in
FoldPanelBar), so I just decided to use "ctstyle" instead of grouping
everything together in a single keyword. I didn't realize it was a
silly behavior.
However, I'll try to modify the source code for CustomTreeCtrl:
obviously, this will break every app that uses the actual __init__
construction. While I don't really care about my apps (it's simply a
keyword to change), I suspect I will se a bunch of bug reports for the
different behavior across version and a ton of insults from
programmers that have to support different wxPython versions
Andrea Gavana wrote:
>> Also, since a CustomTreeCtrl is a TreeCtrl first and a
>> PyScrolledWindow second wouldn't it be more logical to have a new
>> keyword for the scrolledwindow style and use 'style' for the tree
>> style?
>
> Yes, I believe it would be much more logical. Any suggestion about the
> new keyword?
Is there any reason why a single style parameter can't be used? The
style flags with values in the upper half of the 32-bit value are
reserved for generic window styles, but the lower half is reserved for
the individual controls. So you should be able to have up to 16 styles
in the range of 1 .. 2^15 without conflicting with anything that the
scrolled window is going to be looking for.
No, actually I don't think there is a special reason for that. At that
time, I was still influenced by "special" keywords (as in
FoldPanelBar), so I just decided to use "ctstyle" instead of grouping
everything together in a single keyword. I didn't realize it was a
silly behavior.
However, I'll try to modify the source code for CustomTreeCtrl:
obviously, this will break every app that uses the actual __init__
construction. While I don't really care about my apps (it's simply a
keyword to change), I suspect I will se a bunch of bug reports for the
different behavior across version and a ton of insults from
programmers that have to support different wxPython versions
You can leave a ctstyle parameter with a default value of zero, and then combine it with the style parameter in the __init__
···
On 2/13/07, Robin Dunn wrote:
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!