|
-
Apr 30th, 2007, 01:09 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] MSFlexGrid - Selects Last Row Even When No Row Selected
I've no doubt this issue was addressed somewhere at some time, but I can't find it.
I give the user the option of deleting a row via a PopupMenu (left click row, menu pops up).
It works great on all the rows I use it on.
However, if I click below the last row (still within the grid), the .Col property thinks the user clicked the last row and my popup Menu allows deletion of that row.
I don't want the PopupMenu to show if the user clicks the grid anywhere but on a valid row.
Suggestions?
-
Apr 30th, 2007, 01:46 PM
#2
Re: MSFlexGrid - Selects Last Row Even When No Row Selected
Which event are you using to show the menu? Regardless, in order to do what you want you must use the MouseDown/MouseUp event. You can then check where on the grid the click occured.
Code:
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
With MSFlexGrid1
If y < .RowHeight(.Row) + .RowPos(.Row) And _
x < .ColWidth(.Col) + .ColPos(.Col) Then
Debug.Print "popupmenu"
End If
End With
End If
End Sub
-
Apr 30th, 2007, 04:14 PM
#3
Thread Starter
Hyperactive Member
Re: MSFlexGrid - Selects Last Row Even When No Row Selected
Worked perfectly. Thanks very much!
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
|