Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / November 2003

Tip: Looking for answers? Try searching our database.

TreeView problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott Rymer - 12 Nov 2003 14:31 GMT
I have a treeview on a form and it is causing a lot of grief.  The treeview
has the focus.  I press enter to expand the treeview and it does but then
the focus shifts to the next tabstop instead of staying in the treeview.
Secondly, none of the Key events seem to fire for the treeview either.  I am
trying to catch vbKeyEnter on KeyPress to process the DblClick event.  Any
ideas or suggestions?
Scott McDaniel - 13 Nov 2003 01:38 GMT
Can you use the NodeClick event instead?

Signature

Scott McDaniel
CS Computer Software
www.thedatabaseplace.net

> I have a treeview on a form and it is causing a lot of grief.  The treeview
> has the focus.  I press enter to expand the treeview and it does but then
> the focus shifts to the next tabstop instead of staying in the treeview.
> Secondly, none of the Key events seem to fire for the treeview either.  I am
> trying to catch vbKeyEnter on KeyPress to process the DblClick event.  Any
> ideas or suggestions?
Alick [MSFT] - 13 Nov 2003 09:31 GMT
Hi Scott,

That seems a problem; for the focus problem, a workaround could be in the
Form_KeyDown event capture the Enter key, and enable Form's timer control,
in the timer event, reset the focus back to the treeview control. Remember
to set Form's KeyPreview to be true.

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

If Me.ActiveControl.Name = "TreeView1" And 13 = KeyCode Then
           
           Me.TimerInterval = 100
       
 End If

End Sub

Private Sub Form_Timer()

TreeView1.SetFocus

Me.TimerInterval = 0

End Sub

For capturing vbKeyEnter, we need to capture it in form's keydown event,
since it seems the treeview control has some built-in code to process
vbKeyEnter and we are unable to capture it in treeview's keydown event. The
code is similar:

If Me.ActiveControl.Name = "TreeView1" And 13 = KeyCode Then
           
'your code
       
 End If

Note: 13 stands for vbkeyenter.

Please feel free to reply to the threads if you have any questions or
concerns.

Sincerely,

Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <www.microsoft.com/security>

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| From: "Scott Rymer" <me@work.com>
| Subject: TreeView problems
[quoted text clipped - 7 lines]
| trying to catch vbKeyEnter on KeyPress to process the DblClick event.  Any
| ideas or suggestions?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.