|
-
April 2nd, 2001, 08:45 PM
#1
Datagrid Double-click event
I have a datagrid with records from Database. When the user double-clicks on a record, the code will open that record. My problem is that if the user double-clciks on the column header, I will get the event and the current selected record will be opened. I don't want this to happen since I use HeadClick to sort the column. If the user clicks on the column header too fast, it will be treated as double-click and opens the current selected record. I want to open the record only when the user clicks on the data rows, not the header. Is there any way to achieve this? Thanks.
Dion
-
April 3rd, 2001, 07:17 AM
#2
Re: Datagrid Double-click event
on double click event check if row =0
if Grid1.row = 0 then
'do something
else
'do something
end if
Iouri Boutchkine
[email protected]
-
April 3rd, 2001, 07:34 AM
#3
Re: Datagrid Double-click event
Thanks for your reply. However, if I double -click on the first row, it also has datagrid1.row = 0. Therefore datagrid1.row = 0 does not necessary mean that click is on the column header. Any suggestions? Thanks very much.
-
April 3rd, 2001, 11:40 AM
#4
Re: Datagrid Double-click event
I have used this on a MSFlex Grid to reset the "Right" clicked cell for a popup menu. It should give you the right Cell number and with a little modification you can check for Row Zero.
private Sub Grd1_MouseUp(Button as Integer, Shift as Integer, X as Single, Y as Single)
Dim I as Long
Dim J as Long
Dim K as Long
Dim Off as Long
If Button = 2 then
K = 0
Off = 0
If Grd1.LeftCol <> 1 then
for I = 1 to Grd1.LeftCol - 1
Off = Off + Grd1.ColWidth(I)
next I
End If
K = Off * -1
for I = 0 to 15
K = K + Grd1.ColWidth(I)
If X < K then
K = 0
Off = 0
If Grd1.TopRow <> 1 then
for J = 1 to Grd1.TopRow - 1
Off = Off + Grd1.RowHeight(J)
next J
End If
K = Off * -1
for J = 0 to Grd1.rows - 1
K = K + Grd1.RowHeight(J)
If Y < K then
Exit for
End If
next J
Exit for
End If
next I
Grd1.Row = J
Grd1.Col = I
PopupMenu frmStart.mnuPopup13
End If
End Sub
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
|