Shortcut menu for a control?

  • Thread starter JimBurke via AccessMonster.com
  • Start date
J

JimBurke via AccessMonster.com

I know that you can create shortcut menus for a form. What I would like to do
is create one for controls. I have a form with many controls on it. I would
like to be able to have the user right click on a control and have a shortcut
menu appear, and be able to know that that the option the user selects is
associated with the control that was clicked. The trick is capturing the
right click within that control - is there a way to do that? Any help is
appreciated.
 
C

Clifford Bass via AccessMonster.com

Hi Jim,

Just set each control's Shortcut Menu Bar property.

Clifford Bass
 
J

JimBurke via AccessMonster.com

Well duh! Never noticed that property. I figured that if there wasn't an
event to handle right clicks (seems like it would be the obvious way to do it
to me) then there was no property to handle this. Thanks.

Clifford said:
Hi Jim,

Just set each control's Shortcut Menu Bar property.

Clifford Bass
I know that you can create shortcut menus for a form. What I would like to do
is create one for controls. I have a form with many controls on it. I would
[quoted text clipped - 3 lines]
right click within that control - is there a way to do that? Any help is
appreciated.
 
C

Clifford Bass via AccessMonster.com

Hi Jim,

It is odd that there is no right- or middle- click event.

Glad to help,

Clifford Bass
 
S

Stuart McCall

JimBurke via AccessMonster.com said:
Well duh! Never noticed that property. I figured that if there wasn't an
event to handle right clicks (seems like it would be the obvious way to do
it
to me) then there was no property to handle this. Thanks.

Clifford said:
Hi Jim,

Just set each control's Shortcut Menu Bar property.

Clifford Bass
I know that you can create shortcut menus for a form. What I would like
to do
is create one for controls. I have a form with many controls on it. I
would
[quoted text clipped - 3 lines]
right click within that control - is there a way to do that? Any help is
appreciated.

I see you have your answer, but for future reference, the event you use to
detect which mouse button was pressed is either the MouseDown event or the
MouseUp. From the help file:

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

If Button = acLeftButton Then
MsgBox "You pressed the left button."
End If
If Button = acRightButton Then
MsgBox "You pressed the right button."
End If
If Button = acMiddleButton Then
MsgBox "You pressed the middle button."
End If

End Sub
 
C

Clifford Bass via AccessMonster.com

Thanks for posting that Stuart. I will file it away mentally for possible
future use.

Clifford Bass
 
J

JimBurke via AccessMonster.com

In my case the shortcut menu ended up being what I neeed, but this could be
handy for future purposes. thanks.

Stuart said:
Well duh! Never noticed that property. I figured that if there wasn't an
event to handle right clicks (seems like it would be the obvious way to do
[quoted text clipped - 14 lines]
I see you have your answer, but for future reference, the event you use to
detect which mouse button was pressed is either the MouseDown event or the
MouseUp. From the help file:

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

If Button = acLeftButton Then
MsgBox "You pressed the left button."
End If
If Button = acRightButton Then
MsgBox "You pressed the right button."
End If
If Button = acMiddleButton Then
MsgBox "You pressed the middle button."
End If

End Sub
 
S

Stuart McCall

Clifford Bass via AccessMonster.com said:
Thanks for posting that Stuart. I will file it away mentally for possible
future use.

Clifford Bass

You're welcome. FWIW I've used right-click to pop calendar forms, specialist
calculators, that kind of thing. Some like it, some don't.
 
S

Stuart McCall

JimBurke via AccessMonster.com said:
In my case the shortcut menu ended up being what I neeed, but this could
be
handy for future purposes. thanks.

Stuart said:
Well duh! Never noticed that property. I figured that if there wasn't an
event to handle right clicks (seems like it would be the obvious way to
do
[quoted text clipped - 14 lines]
right click within that control - is there a way to do that? Any help
is
appreciated.

I see you have your answer, but for future reference, the event you use to
detect which mouse button was pressed is either the MouseDown event or the
MouseUp. From the help file:

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

If Button = acLeftButton Then
MsgBox "You pressed the left button."
End If
If Button = acRightButton Then
MsgBox "You pressed the right button."
End If
If Button = acMiddleButton Then
MsgBox "You pressed the middle button."
End If

End Sub

No problem. Glad to help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top