On Sun, 09 Jan 2005 22:21:21 GMT, "(Pete Cresswell)" <x@y.z> wrote:
Per David Schofield:Hi
The KeyDown and KeyUp events don't occur when you press the ENTER key
if the form has a command button for which the Default property is set
to Yes.
So maybe if you make sure it hasn't they will. You will have to to
trap and act on the enter key for command buttons yourself.
HTH
No Command buttons w/.Default=True - and I tested that by putting a regular
ListBox on the same form. The regular ListBox's KeyDown event fires when
Return/Enter are pressed (KeyCode=13).
It's starting to sound like the TreeView's behaviour is somewhat different.
--
PeteCresswell
Hi
Um ...
You can set the form.KeyPreview = true and catch ENTER with KeyDown at
the form level, check that the treeview is active and in a suitable
state (use the treeview events to set up this) and then call your
doubleclick event. But the ENTER will still be passed to the treeview
control as KeyDown doesn't have a cancel argument.
Straightforward subclassing the treeview doesn't catch Enter, but if
you are up for heavy coding see
How To Prevent the ENTER Key From Firing in TreeView Control
http://support.microsoft.com/default...b;en-us;216664
This is written for VB.
It is a bold developer who deploys any Access app with treeview in it,
let alone one with subclassing!
David
HTH
David