Solved

Use right mouse click to select the row in MSFlexGrid

Posted on 2004-07-31
6
1,842 Views
Last Modified: 2013-12-25
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,
0
Comment
Question by:naamnih
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 11690958
..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
0
 

Author Comment

by:naamnih
ID: 11691623
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..
0
 
LVL 17

Expert Comment

by:zzzzzooc
ID: 11691731
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
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:naamnih
ID: 11692188
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 !!
0
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 125 total points
ID: 11692310
Left-click selection involves multi-selection so I figured you wanted it like that. If you only want to hilight the current selection, you'll have to remove the "focus" rect.


Form1:
-----------
Private Sub Form_Load()
    With MSFlexGrid1
        .FocusRect = flexFocusNone
        .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
            .RowSel = .MouseRow
            .ColSel = .MouseCol
            .HighLight = flexHighlightAlways
        End With
    End If
End Sub
0
 

Author Comment

by:naamnih
ID: 11696711
thanks, that what i want :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question