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
Printable View
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
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.
Do you know how I check to see if it is a right mouse click?
Thanks!
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
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.