Can't use Keydown event in treeview

Can't use Keydown event in treeview

Post by Paul Johns » Thu, 15 Apr 2004 20:24:23


I have a TreeView control and a listbox on my form. The treeview displays
folders, and the listbox displays reports that are contained in the folders.
I would like to use the keydown event to force an update of the listbox when
the user moves through the treeview using the cursor keys or letters. When
I add a sub for the keydown event, like

Private Sub xTreeKeyDown(KeyCode As Integer, Shift As Integer)

I get an error message that says "The expression [MouseMove, for example]
you entered as the event property setting produced the following error:
Procedure declaration does not match description of event or procedure
having the same name."

The MouseMove example is only one of the messages that pop up for each of
the events that fire, and I have to click OK on each of the error messages
until they have all been visited once: MouseDown, MouseUp, Click, DblClick,
KeyPress, KeyDown, KeyUp, NodeClick, OLEStartDrag, etc.

If I write a sub for the other TreeView events, I get the same string of
messages, except for the KeyPress event. KeyPress doesn't satisfy my needs,
because it doesn't respond to the cursor keys.

What is the conflict?

TIA
Paul Johnson
 
 
 

Can't use Keydown event in treeview

Post by Alex Dyben » Fri, 16 Apr 2004 03:18:49

Paul,
try the following: open form's class module, delete keydown sub, in top left
combo select xTree, in right - keydown - access will insert you correct sub
definition

BTW - you can also consider using NodeClick event

--
Alex Dybenko (MVP)
http://www.yqcomputer.com/
http://www.yqcomputer.com/




folders.
when
When
DblClick,
needs,

 
 
 

Can't use Keydown event in treeview

Post by Paul Johns » Fri, 16 Apr 2004 17:19:16

Ah, yes. That worked, and it also answered another question I had, which
was "Where can I go to learn about the available events for the Treeview
control?" There it was all along, but I have never been in the habit of
using the drop down boxes, and I wouldn't have known that they make the
difference between success and failure.

I thank you, Alex.

Paul



left
sub


displays
example]
of
messages
 
 
 

Can't use Keydown event in treeview

Post by » Sat, 29 May 2004 11:36:19


folders.
when
When
DblClick,
needs,