Stopping Default Right Click Shortcut Menu

  • Thread starter Thread starter RzB
  • Start date Start date
To disable shortcut menus for a single form, change the Shortcut Menu
property for that form to No. (You'll find it on the 'Other' tab in the
Properties window in form design view). To disable shortcut menus for all
forms, select 'Startup' from the Tools menu, and uncheck the 'Allow Default
Shortcut Menus' check box.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Marshall & Brendan,
Many thanks for your responses.

I realise now that its a bit more complicated
than I spelt out in my original post. The subform
has some test boxes that do have a custom
shortcut. So I can't turn it off at the form level.
I guess I need to be able turn it off at the individual
control level... Any thoughts..

Thanks,
Roy
 
You can create an empty shortcut menu, and assign that to the Shortcut Menu
Bar property of the control, or you can simply assign some text that is not
the name of an existing command bar or macro, e.g. ="NoSuchMenu". Either
way, you get an empty, sinlge-line shortcut menu.

If you don't like that effect, you could try the following. I have only
briefly tested this one, I haven't used it in the 'real-world', but so far
it seems to work OK. Be sure to test the property before setting it, as in
this example, rather than just setting it regardless of whether it needs to
be set or not, to avoid screen-flicker as the mouse moves across the form.

In this example, 'Address' is the name of the control that we don't want to
have a shortcut menu.

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

If Me.ShortcutMenu = True Then Me.ShortcutMenu = False

End Sub

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

If Me.ShortcutMenu = False Then Me.ShortcutMenu = True

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Brendan,

Many thank for your help. I did in fact, as you
suggested, create a new shortcut saying -
"No Right Click Actions Available".

I was a little concerned about the performance
implications of using the mouse move solution.
I have some rows of text boxes that user can
update very quickly. A bit like putting the same
number in consecutive cells on a spreadsheet.
I have had some performance problems previously
when adding too much processing behind these items...

However the new shortcut doesn't look too bad...

Many thanks,
Roy
 
Back
Top