Click to See Complete Forum and Search --> : Flexgrid double-click


rlecjr
April 16th, 2001, 10:25 AM
I am using a flexgrid countrol with one fixed row (row 0) and three fixed columns (col 0,1,2). I would like to take one action when a user double-clicks on a column header or another action when a user double-clicks on a row header. I am using the following code:


private Sub grd_DblClick()
If grd.Row = 0 then
If grd.TextMatrix(grd.Row, grd.Col) <> "" then
action 1 (grd.textMatrix(grd.Row, grd.Col))
End If
else
If grd.col = 0 then
action 2 (grd.textMatrix(grd.Row, grd.Col))
End If
End If
End Sub




However, when selecting a row header (actually column 0), the col value is 3... and when selecting a column header (actually row 0), the row value = 1. Does anyone know why this is? Is there any way to resolve this?

Thanks,
Ron

Iouri
April 16th, 2001, 01:45 PM
I never noticed that before. Now I tried your sampple and was amazed by this behavior.

I found a solution. Use grd.MouseRow instead grd.Row

....
If grd.TextMatrix(grd.MouseRow, grd.MouseCol) <> "" then


Here is the code I tried

Private Sub grd_DblClick()
Dim iCol As Integer
Dim iRow As Integer

With grd
MsgBox .MouseRow & "-" & .MouseCol
End With


Iouri Boutchkine
iouri@hotsheet.com

rlecjr
April 16th, 2001, 01:45 PM
Anyone? Would love some help with this. Thanks.

rlecjr
April 16th, 2001, 01:53 PM
Perfect!! Thanks a lot. I appreciate your response!