Right click not caught

Ducati

New member
Local time
Today, 07:33
Joined
Nov 30, 2010
Messages
6
Hi,

I have something strange going on here with the mousedown-event of a detail section.

I was planning on creating a right-click popup menu for a continuous form. But, for some reason the right-click does not always get caught. I created a simple statement which returns nicely 1 for every left click. When I click the right mouse button, 9 out of 10 times, nothing happens.

Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

MsgBox Button

End Sub

The same behavior occurred when I tried it with the mousedown-event of the form. Anybody any ideas on what I am missing here?

Regards,

Mike
 
I can't reproduce it in Access 2003.

Can you upload a small sample database? (Just one Form should do.)

Chris.
 
I believe that the detail section events won't happen if the mouse is on any other object. And I did notice that it won't capture it until you have right clicked, or left clicked, on a control that is in the detail section. It is because the focus isn't set to that particular record that you are right-clicking on. If you first right click on a control in that other record then right clicking on the detail section away from any controls will work.

So it is a matter of where the focus is, because remember - the continous form just uses one detail section and one set of controls. Each record is just a Clone, so to speak, of the one set of controls. The only one active is the set in the currently selected record.
 
Well, Bob’s correct about the reason for the problem.

If I understand the requirement, attached is a small A2003 workaround.

It uses the right click to display a user defined shortcut menu.
The definitions of the shortcut menus are Table driven and only work as far as I’ve been able to test them.
They do work with a continuous subform.

Might be useful and might solve your problem.

Chris.
 

Attachments

ChrisO,

Thanks for your sample. Working through the shortcut menu works indeed fine. The problem I have with this approach, is that I cannot control the content of the menu based on the clicked record.

For example, I would only like to enable the menu-item 'Delete' when the user actually right-clicks an existing record (and not when he clicks somewhere below the list or so). If the mousedown on the detail/form would work, I could put the handling of menu-items in there. With your approach, I do not see an immediate solution for this.

Regards,

Mike
 
I don't have the code to do it but if you could get the code to select the record based on the mouse coordinates using the MOUSE MOVE event, it could make things work for you. But I don't know where that would be. I did something using mouse coordinates in a VB6 program I created 4 to 6 years ago but I haven't done anything with them since.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom