Event handler for Mouse right click and Select

Shaimaa T

Registered User.
Local time
Today, 23:56
Joined
Aug 11, 2014
Messages
40
Hi all,

I want to handle the event when I right click and choose "Paste" to pop up a message to the user that he cannot paste; disabling

the pasting functionality.

I understand that the Button parameter refers to right or left button , but I need further help on which event to best use (mouse

up ,mouse down , mouse move - as it seems to be a mixture of the three) and the code for that event.



Code:
Private Sub List_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 
     ' See if the right mouse button was clicked
    If Button = acRightButton Then 
         'DoCmd.CancelEvent
         'do event here
    End If 
End Sub


I don't want to cancel after there is a right click , but rather after right clicking and choosing "Paste".

Thank you

Best Regards,
Shaimaa
 
Create your own context (or shortcut) menu that doesn't include Paste or disable the context menu altogether.
 
I am not sure how do I create a context menu without paste and remove this one (since this is a client application I am supporting so I am not sure if it is OK to do this but I want to learn how to anyways).

Also , besides this is there a way to do this by handling this if we assume I will not remove the paste in the menu ...How can I just send a message after the paste is clicked ?

If you do not want to directly answer me , please refer me to a good source (I mean I intended to search first myself but found that I was spending a lot of time trying to google mouse down or mouse event handling with right click etc).
 
Removing the context menu is a property of the form. So look in the property sheet of the form for the Shortcut Menu option and change that to No. That will block all short cut menus for the form as a whole.

There's no quick way to trap the click event of any of the shortcut menus or or trap when a paste occurs. That's why you'll need to create your own shortcut menus or disable it all together. Just google "context menus + ms access + vba".
 
Thank you very much for your immediate help.

Is there any way to handle the right clicking of a menu using a mouse and checking any of the menu items in it ?

I mean if I will be able to do it with a context menu I created, then perhaps I can do the same with an existing menu ?(Just be able to access the items and if the select was Paste then fire a message)

Much appreciated
 
It turns out that the solution of disabling the context menu is problematic since I delete other functionalities with it .

So as you suggested, after disabling it I can create my own which would be the same as the old one without the paste functionality. Can you please help with this one?

Thank you
 
There are lots of resources on the net for this.

Or look for an Access 2003 db to create one via the GUI and import it from there.
 
The approach of sending a message after capturing Ctrl+V has a problem:

I want it to not paste only if the whole record is selected , but to paste in a control(single field) is actually needed.

I thought that by putting it in the form's event rather than control , this would be it . but it seems to not allow pasting to single fields as well.

Solution?
 
The approach of sending a message after capturing Ctrl+V has a problem:

I want it to not paste only if the whole record is selected , but to paste in a control(single field) is actually needed.
Post in the relevant thread.
 

Users who are viewing this thread

Back
Top Bottom