Capturing datagrid events | Double click and mouse move

G

Guest

Hey guys,

I have 2 events on a windows forms datagrid, the mouse move as well as the
double click events.
What's happening is that when I double click on a row in the grid, the mouse
move event gets triggered and the double click is not identified at all.

Is there any way I can invoke the double click when the mouse move also
exists?

The basic thing for which I have captured the mouse move event is the fact
that I need to display a tooltip when the mouse rolls over a certain column
in the datagrid. If capturing double click after mouse move is improbable,
then what approach shall I take in order to facilitate both the scenarios?

Any pointers are gladly appreciated.

Cheers!
Nick
 
G

Guest

your can do a double click on your datagrid

do something like this (vb.net)


Private Sub dtgrid_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles dtgrid.MouseUp
Dim pt = New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = dtgrid.HitTest(pt)
If hti.Type = DataGrid.HitTestType.Cell Then
dtgrid.CurrentCell = New DataGridCell(hti.Row, hti.Column)
dtgrid.Select(hti.Row)
End If
If dubbelklik = True Then
dowhatyouwant()
Else
dubbelklik = True
End If
End Sub


greets,

if this post was helpfull, click on the bottom of the post on yes :p
 
G

Guest

But then how can i set the dubbelklik variable?
That, actually speaking, is not the double click event...its just a mouse up.
Any more points around it?
 
G

Guest

Look at the code.

when you do a mouse up on the datagrid... it checks wich cell you have
selected... then the dubbelklik variable is set to "true"... the second time
you click on it you click on the same cell you execute another function. all
you need extra is a timer to set the time of your click event.

works great for me.
 
G

Guest

Gee thanx!!!!

You're the man!!!!
This solved a lot of other stuff as well. Now that I'm not capturing the
double click event, I got rid of a couple of bugs wherein even double
clicking the header or the empty area in the grid was resulting in the action
to be performed only on clicking the cells.

Cheers!
 
G

Guest

Great !

I'm glad that it was helpfull.

Nick said:
Gee thanx!!!!

You're the man!!!!
This solved a lot of other stuff as well. Now that I'm not capturing the
double click event, I got rid of a couple of bugs wherein even double
clicking the header or the empty area in the grid was resulting in the action
to be performed only on clicking the cells.

Cheers!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top