Solved

Use right mouse click to select the row in MSFlexGrid

Posted on 2004-07-31
6
1,807 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

816 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now