This is a migrated thread and some comments may be shown as answers.

capture DoubleClick or Click event

4 Answers 188 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 04 Jul 2009, 02:16 PM

VB.NET
.NET 3.5

RadControls for WinForms Q1 2009 SP1
MS Visual Studio 2008

I have been able to do just about everything else I need to do in the Treeview control, except capturing click events in my form. The tree is generated from SQL tables and otherwise appears fine. Ultimately I am hoping to wire the tree nodes to files in the filesystem.
Following is the code to capture the DoubleClick event (copied from documentation):

Private

 

Sub RadTreeView1_DoubleClick(ByVal sender As Object, ByVal e As EventArgs)

 

 

 

Dim args As MouseEventArgs = TryCast(e, MouseEventArgs)

 

 

 

Dim clickedNode As RadTreeNode = RadTreeView1.GetNodeAt(args.X, args.Y)

 

 

 

If clickedNode <> Nothing Then

 

 

 

 

    MessageBox.Show("Node Text: " + clickedNode.Text + " Node Value: " + clickedNode.Tag)

 

 

 

End If

 

 

 

 

End Sub

 

 

 

 

 

 

The only other block of code in my form is my form load which loads the tree with data from the database.

I have 2 questions/problems:
1. Visual Studio is complaining about the IF statement: "Operator '<>' is not defined for types 'Telerik.WinControls.UI.RadTreeNode' and 'Telerik.WinControls.UI.RadTreeNode'. What does this mean?
2. It appears the DoubleClick event isn't being captured since nothing happens when I double click a node. Is the IF statement error related to this? What am I missing? For my testing I simply commented out the 'If...' and 'End If' lines.

Thanks in advance for any guidance you can provide.
Matt

4 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 06 Jul 2009, 04:41 PM
I found samples that do what I need to do.

Sorry for the inconvenience.
0
scottw
Top achievements
Rank 1
answered on 02 Jan 2012, 06:14 PM
I am also having problems having my double click event actually captured. I have both a DoubleClick event and a MouseDoubleClick event, and either both of them get captured, or neither of them do. Double clicking really, really fast mostly doesn't work, though curiously clicking the left and right mouse buttons in quick succession seems more likely to fire the event/

Where did you find your solution?


Thanks
0
Matt
Top achievements
Rank 1
answered on 04 Jan 2012, 04:34 PM
In my case the problem was incorrectly calling the event handler, which was really a VS/VB problem. Instead of letting VS "create" the handlers for me I was hand coding them, and I had incorrectly called out the handler.

Since then, I learned how to create the handlers in VS the "VS way" which has eliminated many headaches for me.

FWIW, I have discovered that, while the Telerik tree control functions as advertised, it can be finicky.

Hope that helps you.
Matt
0
Stefan
Telerik team
answered on 05 Jan 2012, 12:30 PM
Hello Scott,

I have performed some tests and both DoubleClick and MouseDoubleClicked events are fired correctly. Furthermore, if you double click a node, the NodeMouseDoubleClick is triggered too. Attached is a sample application.

If you are aware of a case, where those events are not fired, please provide me with details describing how to reproduce this case, or open a support ticket, where you can attach sample project demonstrating the undesired behavior. Once we are able to replicate such a behavior, we will take the necessary actions in order to address it. 

I hope this helps.

Greetings,
Stefan
the Telerik team

SP1
of Q3’11 of RadControls for WinForms is available for download (see what's new).
Tags
Treeview
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
scottw
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or