473,320 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Treeview 6 MouseDown Event

Hello,

I am trying to create a context menu for right clicking on a TreeView control (for deleting, etc...), using either the MouseDown or MouseUp event. When I put following code in:

Expand|Select|Wrap|Line Numbers
  1. Private Sub TestTree_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  2. If Button = acRightButton Then MsgBox ""
  3. End Sub
  4.  
I get an error message when I try to open the form with the TreeView on it:

"The expression On Open you entered as the event property setting produced the following error: Prodcedure declaration does not match description of event or procedure having the same name"

I have nothing in the form's On Open event. If I remove the mousedown sub from the code, everything compiles fine. Any ideas?
Aug 21 '08 #1
6 7207
FishVal
2,653 Expert 2GB
Hello.

I have no problem to run the handler in my form.
Have you checked Form.OnOpen property?
Additionally that type of errors is usually caused by inappropriate functions/subs/global variables declarations.
Sometimes it really appears without any reason and goes away without any obvious reason too. ;)
Sometimes only full form rebuild helps. ;)

Regards,
Fish

P.S. A stupid question - are you sure TestTree is the name of TreeView object, not the name of the form control embedding this object?
Aug 21 '08 #2
Hello.

I have no problem to run the handler in my form.
Have you checked Form.OnOpen property?
Additionally that type of errors is usually caused by inappropriate functions/subs/global variables declarations.
Sometimes it really appears without any reason and goes away without any obvious reason too. ;)
Sometimes only full form rebuild helps. ;)

Regards,
Fish

P.S. A stupid question - are you sure TestTree is the name of TreeView object, not the name of the form control embedding this object?
The Form.OnOpen property = "[Event Procedure]". I forgot that there is a call to a sub there to populate the tree. The sub runs fine if I don't have the Mousdown handler in the form's code.

TestTree is the name of the object - I tested this by defining handlers for the object's dblClick event. I will try to rebuild the form and report the results.
Aug 21 '08 #3
The Form.OnOpen property = "[Event Procedure]". I forgot that there is a call to a sub there to populate the tree. The sub runs fine if I don't have the Mousdown handler in the form's code.

TestTree is the name of the object - I tested this by defining handlers for the object's dblClick event. I will try to rebuild the form and report the results.

Rebuilt - same problem. Added TreeView 6.0 control to a blank form. The only code I put in the module was the MouseDown handler - I get the same error except that instead of referring to On Open, it refers to On MouseMove. I tried to check the control's OnMouseDown property and I get "Object doesn't support this property or method." Same if I try to set the OnMouseDown property. This also happens when I try MouseUp. DblClick works, but I really need something that returns which mousebutton is clicked.

Dumb question, but you're using VBA in Access right?
Aug 21 '08 #4
FishVal
2,653 Expert 2GB
Rebuilt - same problem. Added TreeView 6.0 control to a blank form. The only code I put in the module was the MouseDown handler - I get the same error except that instead of referring to On Open, it refers to On MouseMove. I tried to check the control's OnMouseDown property and I get "Object doesn't support this property or method." Same if I try to set the OnMouseDown property. This also happens when I try MouseUp. DblClick works, but I really need something that returns which mousebutton is clicked.

Dumb question, but you're using VBA in Access right?
Sure I talk about VBA in Access.Form module.

I have a little doubt as for event handler sub declaration.

In you code it goes without argument pass type qualifier, so assumed by default as ByRef.

Expand|Select|Wrap|Line Numbers
  1. Private Sub TestTree_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  2. If Button = acRightButton Then MsgBox ""
  3. End Sub
  4.  
In my code arguments are being passed ByVal.

Expand|Select|Wrap|Line Numbers
  1. Private Sub trvGroupsTree_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
  2.     If Button = acRightButton Then MsgBox ""
  3. End Sub
  4.  
Aug 21 '08 #5
Thank You. It didn't work at first, but then I rebuilt the form w/ just the MouseDown handler (with ByVal qualifiers) and that worked. Then, I slowly copied code and controls from my old form. It appears to be working. Still very strange. I've got essentially identical forms with identical code modules and controls - one works and one doesn't. Weird. Thanks for your help!
Aug 21 '08 #6
FishVal
2,653 Expert 2GB
:)

You are welcome.

Regards,
Fish

P.S. I think some our experts known to launch S-300 rocket every time they here about using ActiveX in Access will be happy to have one more example of Fatal Error Produced By ActiveXXX.
Aug 21 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Plumer | last post by:
Hello everyone, I am using MS .NET Framework 1.0 Version 1.0.3705 developing a C# client application using SQL Server on the server side. I am looking to implement drag & drop in a TreeView...
1
by: Jürgen Müllder | last post by:
Hi! I have a TreeView in my Application. I have the MouseDown Attached to the TreeView. When i click at a Node it makes that what it should. But when i Expand a Node by clicking at the Plus Sign...
7
by: Michael C | last post by:
Hi all, I half-resolved my previous TreeView issue. Now I was wondering if anyone knows of a way to keep a TreeNode from being highlighted when it is left-clicked? It seems like there should...
1
by: Marc Jennings | last post by:
Hi There is probably a very simple answer to this, but I am not too familiar with the treeView control... I have a treeview control, populated from a database. I want to be able to get the...
3
by: vijaynats | last post by:
I have a treeview with a ContextMenu attached. When i click on a node, AfterSelect fires but does not fire when right clicked (the context menu pops up). (Background: I have loaded a list of...
1
by: Aleksey | last post by:
Hi, All! I have a problem with TreeView component. My TreeView consists of two nodes Node1 and Node2. On click of right mouse button TreeView has event. In this event I check wich node is...
5
by: A-PK | last post by:
Hi, I am using treeview as my menu. my menu is like the following + Users & Groups - Users -Groups + Departmenuts - Engineering
3
by: Gary Dunne | last post by:
I'm writing an app that requires drag and drop operation between a ListView and a TreeView control. (The source is the ListView). During the drag drop operation I want to be able to detect the...
2
by: Andrew Ducker | last post by:
I have a treeview linked to a series of panels, making the correct panel visible depending on which node is selected. I now want to check that the user is allowed to leave the current node...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.