I have a MSFlexgrid and want to allow users to right click on a row and get a menu with some options on it.
So how do I :
1. Get a row to become highlighted when it is right clicked
2. Display a menu with some options
Printable View
I have a MSFlexgrid and want to allow users to right click on a row and get a menu with some options on it.
So how do I :
1. Get a row to become highlighted when it is right clicked
2. Display a menu with some options
The popupmenu is easyI think you will need to do a left click for the hightlight, and then a right click for the menu.VB Code:
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = vbRightButton Then PopUpMenu mnuMyMenu End If End Sub
Thanks Hack, thats something I've never used before.
I'm still trying to get the right click to highlight the row, I'll let you know if I manage it.
VB Code:
Private Sub xgrid_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) If Button = vbRightButton Then xgrid.Row = xgrid.MouseRow 'Sets the selected row to row mouse is over xgrid.Col = 0 'set start point for row selection xgrid.ColSel = xgrid.Cols - 1 'sets end point for row selection End If End Sub
I don't know about the menu part, but it looks like hack is on to something.
JPicasso, brilliant it works perfectly!!
Thanks a lot.