Full Version: Treeview: Processes Click From Previous Form
UtterAccess Forums > Microsoft® Access > Access Forms
PDTech
I have a continuous form with a number of text boxes. On the double click event of the text boxes is a function to open/display a form with a TreeView and select a corresponding node.
When the treeview appears it initially displays the desired node but, if the the mouse pointer happens to be over another node (rather than white space in the TreeView) then that node is selected and a click event (for the node under the mouse) is fired.
I.e. Although I have double clicked on the search form and the code associated with double clicking has completed, a 'click' is registered on the TreeView form even though there have been no further mouse clicks.
Any suggestions on how I prevent this phantom 'click' or make the TreeView form ignore it?
Many thanks
Paul
AvgJoe
Paul,
reetings. Not sure if this will help, but here's a link to a recent post regarding TreeView controls. You may be able to gleam something to remedy your situation.
HTH,
AvgJoe
TreeView link
cheekybuddha
Hi, in addition to the info from AvgJoe, have you checked the treeview properties (right-click on the tree view in design view) and make sure hot tracking is not enabled.
th
d
genoma111
I think you can try to handle the problem you have something like this (taking in account Paul's recommendation):
CODE
Private Sub SetupTreeview()
With Me.The Name of your Form
.HotTracking = False
End With
End Sub

egards,
Diego
Edited because I did some tests, and my initial approach didn't work
PDTech
Thanks for the suggestions but I already had HotTracking set to false in the properties for the treeview (and setting to false programmatically doesn't seem to make any difference).
cheekybuddha
Any chance you can post an example so we can see what's going on?
genoma111
Don't know if this will help, but at least you can try.
lay a little bit with the mouse events, something like
CODE
Private Sub The name of your TreeView Control_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal Y As Long)
Const vbLeftButton As Integer = 1
    If Button = vbLeftButton Then
       MsgBox "This is the left button"
    End If
End Sub

You can add extra lines for right and middle buttons, and do the same for other mouse events in case this doesn't work.
In this way I think you will know at least what button is "fired" in which event, and from there you will be able to control it.
Hope this helps.
Diego
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.