471,582 Members | 1,363 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,582 software developers and data experts.

Capturing datagrid events | Double click and mouse move

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
Nov 25 '05 #1
5 4543

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
"Nick" wrote:
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

Nov 25 '05 #2
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?

"interwanderer" wrote:

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
"Nick" wrote:
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

Nov 25 '05 #3

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.

"Nick" wrote:
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?

"interwanderer" wrote:

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
"Nick" wrote:
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

Nov 25 '05 #4
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!

"interwanderer" wrote:

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.

"Nick" wrote:
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?

"interwanderer" wrote:

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
"Nick" wrote:

> 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

Nov 26 '05 #5

Great !

I'm glad that it was helpfull.

"Nick" wrote:
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!

"interwanderer" wrote:

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.

"Nick" wrote:
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?

"interwanderer" wrote:

>
> 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
>
>
> "Nick" wrote:
>
> > 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

Nov 26 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by John Champaign | last post: by
reply views Thread by Emerson | last post: by
3 posts views Thread by bardo | last post: by
2 posts views Thread by Snig | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Vinnie | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.