overriding default tree key down behaviour?

I have a subclass of wxTreeCtrl that allows nodes to be moved up and down
and to be promoted and demoted. The user achieves this using ALT-UP,
ALT-DOWN, ALT-LEFT and ALT-RIGHT respectively.

However, when the user presses (for example) ALT-DOWN, not only is my
OnKey method (registered with EVT_KEY_DOWN) called (which performs the
node movement) but the default event handler takes the DOWN arrow event
and changes the selection down a node.

This is on Windows XP and doesn't seem to happen on OS X.

I tried using EVT_TREE_KEY_DOWN to prevent DOWN from its default
behaviour if ALT is pressed, but nothing I do in the method registered
with EVT_TREE_KEY_DOWN seems to affect the default tree behaviour when
the down arrow is pressed.

Is there a way to override the default key down tree behaviour? Or am I
forced to not use modified arrow keys for any behaviour on trees.

Thanks

James

···

--
  James Tauber
  http://jtauber.com/

James Tauber wrote:

I have a subclass of wxTreeCtrl that allows nodes to be moved up and down
and to be promoted and demoted. The user achieves this using ALT-UP,
ALT-DOWN, ALT-LEFT and ALT-RIGHT respectively.

However, when the user presses (for example) ALT-DOWN, not only is my
OnKey method (registered with EVT_KEY_DOWN) called (which performs the
node movement) but the default event handler takes the DOWN arrow event
and changes the selection down a node.

Does your handler call event.Skip for the ALT-arrow keys? (It shouldn't.) Does it have the same problem if you catch Ctrl-arrow keys instead?

···

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

James Tauber wrote:
> I have a subclass of wxTreeCtrl that allows nodes to be moved up and down
> and to be promoted and demoted. The user achieves this using ALT-UP,
> ALT-DOWN, ALT-LEFT and ALT-RIGHT respectively.
>
> However, when the user presses (for example) ALT-DOWN, not only is my
> OnKey method (registered with EVT_KEY_DOWN) called (which performs the
> node movement) but the default event handler takes the DOWN arrow event
> and changes the selection down a node.

Does your handler call event.Skip for the ALT-arrow keys? (It
shouldn't.)

I thought it might be that but it doesn't (although I tried both calling
it and not calling it).

Does it have the same problem if you catch Ctrl-arrow keys instead?

The problem doesn't exist with Ctrl-arrow (or Shift-arrow incidently),
only Alt-arrow.

Shift or Ctrl would likely be an acceptable alternative to Alt for this.
I had just wondered if I was doing something wrong, but it sounds like
it's a property of Alt.

Thanks for you help (as always!)

James

···

On Sat, 20 Dec 2003 11:02:41 -0800, "Robin Dunn" <robin@alldunn.com> said:
--
  James Tauber
  http://jtauber.com/