By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

Capturing datagrid events | Double click and mouse move

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a

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

P: n/a
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

P: n/a

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

P: n/a
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

P: n/a

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.