Why does EVT_TREE_ITEM_HYPERLINK trigger on selection

27 views
Skip to first unread message

Dag Wastberg

unread,
May 14, 2012, 11:08:31 AM5/14/12
to wxpytho...@lists.wxwidgets.org
Hi

I'm trying to use a hypertreelist (wx 2.9.3) in an app where some of
the tree items are hyperlinks. So far so good, no problems. However
my problem comes with the events bound to these items. They trigger
on both left click and when I happen to highlight the item via
keyboard navigation. I've read the customtreectrl.py source code and
this is clearly the intended behavior, but it's not the behavior I
need or want. I want it to only trigger on left clicks. What is the
reasoning behind this behavior, and is there a simple way (short of
editing customtreectrl.py) to change it? I've tried to come up with
some way of differentiating between the two in the callback, but
nothing has worked.

Any suggestions?

Dag

Andrea Gavana

unread,
May 15, 2012, 3:32:51 AM5/15/12
to wxpytho...@googlegroups.com
Hi,
I believe you may be right, but short of modifying the CustomTreeCtrl
source there isn't much you can do. In any case, if there is someone
using hyperlink events on CustomTreeCtrl or HyperTreeList via keyboard
navigation, please speak up. Otherwise I'll modify the sources in SVN
to correct this behaviour when I get back home tonight.

Andrea.

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

Dag Wastberg

unread,
May 15, 2012, 3:48:22 AM5/15/12
to wxpytho...@googlegroups.com
Hi

That would be excellent. Looking forward to it.

Dag
> --
> To unsubscribe, send email to wxPython-user...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-users?hl=en

Gadget/Steve

unread,
May 15, 2012, 5:37:09 AM5/15/12
to wxpytho...@googlegroups.com
Andrea,

Can I suggest modifying it so that select via keyboard doesn't raise a
left click event, (as it should really count as a hover), but that
pressing enter when a hyperlink is selected does raise the event, this
will enable people to use keyboard navigation in an intuitive manner to
select between such hyperlinks and to follow them.

Gadget/Steve


signature.asc

Andrea Gavana

unread,
May 15, 2012, 10:43:17 AM5/15/12
to wxpytho...@googlegroups.com
Hi Steve,
Yes, that's a good suggestion. I'll see what I can do about it.

Andrea Gavana

unread,
May 17, 2012, 4:03:20 PM5/17/12
to wxpytho...@googlegroups.com
On 14 May 2012 17:08, Dag Wastberg wrote:
This should now be fixed in SVN, could you please test and see if it
works correctly?

Dag Wastberg

unread,
May 21, 2012, 5:21:47 AM5/21/12
to wxpytho...@googlegroups.com
On Thu, May 17, 2012 at 10:03 PM, Andrea Gavana <andrea...@gmail.com> wrote:
> On 14 May 2012 17:08, Dag Wastberg wrote:
>> Hi
>>
>> I'm trying to use a hypertreelist (wx 2.9.3)  in an app where some of
>> the tree items are hyperlinks.  So far so good, no problems.  However
>> my problem comes with the events bound to these items.  They trigger
>> on both left click and when I happen to highlight the item via
>> keyboard navigation.  I've read the customtreectrl.py source code and
>> this is clearly the intended behavior, but it's not the behavior I
>> need or want.  I want it to only trigger on left clicks.  What is the
>> reasoning behind this behavior, and is there a simple way (short of
>> editing customtreectrl.py) to change it?  I've tried to come up with
>> some way of differentiating between the two in the callback, but
>> nothing has worked.
>>
>> Any suggestions?
>
> This should now be fixed in SVN, could you please test and see if it
> works correctly?

Just tested it and it seems to work fine. Thanks!
Now that that works, I'm thinking about the possibility to trigger a
hyperlink with space/enter. What do you think?

Dag

Dag

Andrea Gavana

unread,
May 21, 2012, 4:05:32 PM5/21/12
to wxpytho...@googlegroups.com
Hi,
I gave it a try and implemented it in SVN. Could you test it and see
if it works?

Andrea Gavana

unread,
May 22, 2012, 3:16:49 AM5/22/12
to wxpytho...@googlegroups.com
Bad attempt. Shame on me for not testing it... I'll fix it when I get
back home tonight :-(

Andrea Gavana

unread,
May 22, 2012, 3:03:13 PM5/22/12
to wxpytho...@googlegroups.com
Should be fixed now in the latest SVN revision.
Reply all
Reply to author
Forward
0 new messages