Link to home
Start Free TrialLog in
Avatar of naamnih
naamnih

asked on

Use right mouse click to select the row in MSFlexGrid

hi,

I'm using MSFlexGrid, how i can let use the right mouse click to select row in the MSFlexGrid ..
in other words let the right mouse be like the left mouse in the MSFlexGrid..

i want to select row by right click because i'm using popup menu so when i click the right mouse it select row then popup the menu..

Best Regards,
Avatar of zzzzzooc
zzzzzooc

..something like this?

Form1:
-----------
Private Sub Form_Load()
    With MSFlexGrid1
        .Rows = 4
        .Cols = 4
        .TextMatrix(1, 1) = "Test1"
        .TextMatrix(2, 1) = "Test1"
        .TextMatrix(3, 1) = "Test2"
    End With
End Sub
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = vbRightButton Then
        With MSFlexGrid1
            .Row = .MouseRow
            .Col = .MouseCol
        End With
    End If
End Sub
Avatar of naamnih

ASKER

thanks zzzzzooc, but your code will not HighLight the row, i mean that i want when i click on the right mouse to highlight (the blue color that appers when we click on the left click) the row..
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = vbRightButton Then
        With MSFlexGrid1
            .RowSel = .MouseRow
            .ColSel = .MouseCol
        End With
    End If
End Sub
Avatar of naamnih

ASKER

Man, your code has a problem.. first i want to select one row not more.
in your example.. run your project then click right click on the second row and then right click on the third row .. the second row will still selected and it will select 2 rows !! the second and the third !!
ASKER CERTIFIED SOLUTION
Avatar of zzzzzooc
zzzzzooc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of naamnih

ASKER

thanks, that what i want :)