Click to See Complete Forum and Search --> : menu


batsheva
May 3rd, 2001, 08:06 AM
I would like to create a pop-up menu when a user clicks the right mouse button on a cell in a flexgrid.

Any suggestions?

Thanks,
Batsheva

Cimperiali
May 3rd, 2001, 08:24 AM
Option Explicit
use menu editor to add menus to your form. Set main(top) menu visible = false
leave submenu visible true.
Here I have a 3x2 flexgrid
a main menu called mnupop
a submenu called mnupopme
when I click last flexgrid cell, the mnupop appear
Beware: it appears also when I click on fixed cell at its left...
Private Sub MSFlexGrid1_Click()
With MSFlexGrid1
If .Row = 2 And .Col = 1 Then
PopupMenu mnupop
End If
End With
End Sub


Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.

batsheva
May 3rd, 2001, 08:41 AM
Do you know how I check to see if it is a right mouse click?

Thanks!

shree
May 3rd, 2001, 08:54 AM
If you need to know what button it is, use the MouseDown Event. Then, you get a parameter Button, and you can check

If Button=vbRightButton then
...
endif

Cimperiali
May 3rd, 2001, 09:12 AM
Sorry, Shree. Although you're right, it is better to use the mouseUp event or it will not be triggered correctly showing a menu...

Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.