|
-
Nov 14th, 2002, 04:13 PM
#1
Flexgrid and right-click...
Is there a simple way to set the active column and row of a flexgrid when you right-click? Since it only seems to set them itself with a left-click.
As it stands, I can loop through each col and row, and check the CellLeft and CellTop properties, along with the RowHeight and ColWidth to see if the mouse is within the cell, but to do this, the active cell must be changed in the loop, and it looks pretty awful. Not to mention that its time consuming as the grid gets bigger.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 14th, 2002, 04:22 PM
#2
Frenzied Member
you can use MouseCol and MouseRow in the MouseUp or MouseDown event to determine the rol / col the user right-clicked in.
-
Nov 14th, 2002, 04:24 PM
#3
Try:
VB Code:
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim lCol As Long, lRow As Long
If Button <> vbRightButton Then Exit Sub
With MSFlexGrid1
For lRow = 0 To .Rows - 1
For lCol = 0 To .Cols - 1
If x >= .ColPos(lCol) And x < (.ColPos(lCol) + .ColWidth(lCol)) And _
y >= .RowPos(lRow) And y < (.RowPos(lRow) + .RowHeight(lRow)) Then
Exit For
End If
Next
If lCol < .Cols Then Exit For
Next
If lRow < .Rows Then
.Col = lCol
.Row = lRow
End If
End With
End Sub
-
Nov 14th, 2002, 04:27 PM
#4
Originally posted by John McKernan
you can use MouseCol and MouseRow in the MouseUp or MouseDown event to determine the rol / col the user right-clicked in.
Simple enough. Thanks.
EDIT: Thanks anyway Aaron 
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|