TreeCtrl HitTest

Hi

I'm trying to get a tree control to expand when I left click on the label and not just on the +/- button. The expansion using the button is handled in the default right down event of the tree control and I am toggling the state in the left up. This leads to the desired behaviour when the label is clicked but not so when the button is clicked. To avoid this I was going to use the flags return from HitTest but the flags returned on the button is 4104, an integer, and wxTREE_HITTEST_ONITEMBUTTON is 8. I'm using wxPython 2.4.0.2 on Redhat 8.0.

Nigel

···

--
Nigel W. Moriarty
Building 4R0230, Physical Biosciences Division
Lawrence Berkeley National Laboratory
Berkeley, CA 94720-8235
Phone : 510-486-5709
Fax : 510-486-5909
Email : NWMoriarty@LBL.gov
Web : CCI.LBL.gov

Nigel Moriarty wrote:

Hi

I'm trying to get a tree control to expand when I left click on the
label and not just on the +/- button. The expansion using the button
is handled in the default right down event of the tree control and I
am toggling the state in the left up. This leads to the desired
behaviour when the label is clicked but not so when the button is
clicked. To avoid this I was going to use the flags return from
HitTest but the flags returned on the button is 4104, an integer, and
wxTREE_HITTEST_ONITEMBUTTON is 8. I'm using wxPython 2.4.0.2 on
Redhat 8.0.

The return value is a bitmask of multiple flags. You need to test it
using binary operators like this:

  if flags & wxTREE_HITTEST_ONITEMBUTTON:
    ...

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!