I'd like to support the (standard?) Windows behavior of executing DblClick
processing when an item is selected and the user presses Enter
I got focus to stop moving to the next control via Tools|Options|Keyboard|Move
after enter....but now it just sits there and neither KeyDown nor KeyPress seems
to catch it.
Is this the end of the road?
--
PeteCresswell
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
David
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.aspx?scid=kb;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
I've got a couple out there with no reported problems.
("Reported" being the operative word....)
Anything special I should be on the lookout for?
--
PeteCresswell
Still no-go.
I checked it with ?frmWhatever.Keypreview in the immediate window....and,
indeed, it still fires KeyDown and KeyPress for the space bar and other
keys...but not Enter.
I think I see why, though. The list is already using Enter to toggle nodes'
.Expanded. Hit Enter on a collapsed node and it expands...do the same thing
on an expanded node and it collapses.
I guess that about wraps it.... I guess I'll just trap SpaceBar and tell the
users to learn to love it.
--
PeteCresswell
Hi
Problems with common controls arise mainly in MDE/run time systems
when older or newer versions of the DLL are on the user's PC
David