473,498 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView Question

Dear all,

is it possible to implement a tree node so that double click on the tree
node does some operation and double click on "+" of this tree node only
expands tree without doing this operation. Unfortunately I only know
GetNodeAT(x,y), which don't differentiate "+" from the node.

Thanks in advance for your help.

Boni


Nov 21 '05 #1
5 1226
It is something like:

Protected Overrides Sub OnDoubleClick(ByVal e As System.EventArgs)

If SelectedNode.GetType() Is GetType(TreeNode) Then
CType(SelectedNode, TreeNode).Open()
End If

End Sub

Public Sub Open()
System.Diagnostics.Process.Start([Node Name Here])
End Sub

-------------------

The above code is out of a control I created that extends the TreeView. The
'[Node Name Here]' is obviously the selected node name

You'll have to play around with the code slightly, but it should give you a
general idea.

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
There is no easy way to differentiate the "+" from the remaining zone, but
anyway the "+" requires only a single click, not a double click. The code
below shows how to override the WM_LBUTTONDBLCLK event:

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

Const WM_LBUTTONDBLCLK As Integer = &H203

Dim bHandled As Boolean = False

Select Case m.Msg

Case WM_LBUTTONDBLCLK
Me.OnDoubleClick(EventArgs.Empty)
bHandled = True

End Select

If Not bHandled Then
MyBase.WndProc(m)
End If

End Sub
--
Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Boni" <oilia@nospam> escribió en el mensaje
news:en****************@TK2MSFTNGP14.phx.gbl...
Dear all,

is it possible to implement a tree node so that double click on the tree
node does some operation and double click on "+" of this tree node only
expands tree without doing this operation. Unfortunately I only know
GetNodeAT(x,y), which don't differentiate "+" from the node.

Thanks in advance for your help.

Boni

Nov 21 '05 #3
Dear Carlos,
I am sorry, but I don't understand how to use your code.
As you wrote, I do need a double click for a "remaining zone", but only a
single click for +.
Thanks a lot,
Boni
"Carlos J. Quintero [.NET MVP]" <ca*****@NOSPAMsogecable.com> schrieb im
Newsbeitrag news:OO**************@TK2MSFTNGP15.phx.gbl...
There is no easy way to differentiate the "+" from the remaining zone, but
anyway the "+" requires only a single click, not a double click. The code
below shows how to override the WM_LBUTTONDBLCLK event:

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

Const WM_LBUTTONDBLCLK As Integer = &H203

Dim bHandled As Boolean = False

Select Case m.Msg

Case WM_LBUTTONDBLCLK
Me.OnDoubleClick(EventArgs.Empty)
bHandled = True

End Select

If Not bHandled Then
MyBase.WndProc(m)
End If

End Sub
--
Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Boni" <oilia@nospam> escribió en el mensaje
news:en****************@TK2MSFTNGP14.phx.gbl...
Dear all,

is it possible to implement a tree node so that double click on the tree
node does some operation and double click on "+" of this tree node only
expands tree without doing this operation. Unfortunately I only know
GetNodeAT(x,y), which don't differentiate "+" from the node.

Thanks in advance for your help.

Boni


Nov 21 '05 #4
You must derive a class TreeViewEx from Treeview and put that code inside.

What I meant is that since "+" requires only a single click, likely users
won´t double-click on that zone, you I would not worry about that, but if
you really want, the TVM_HITTEST message will tell you:

http://msdn.microsoft.com/library/de...vm_hittest.asp

--
Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Boni" <oilia@nospam> escribió en el mensaje
news:us**************@TK2MSFTNGP10.phx.gbl...
Dear Carlos,
I am sorry, but I don't understand how to use your code.
As you wrote, I do need a double click for a "remaining zone", but only a
single click for +.
Thanks a lot,
Boni

Nov 21 '05 #5
Dear Carlos, Dear Crouchie1998,
Thank you,
"Boni" <oilia@nospam> schrieb im Newsbeitrag
news:en****************@TK2MSFTNGP14.phx.gbl...
Dear all,

is it possible to implement a tree node so that double click on the tree
node does some operation and double click on "+" of this tree node only
expands tree without doing this operation. Unfortunately I only know
GetNodeAT(x,y), which don't differentiate "+" from the node.

Thanks in advance for your help.

Boni

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2408
by: Sonia Igla | last post by:
Hi. I need to perform DBLCLK on TreeView Node. I try the following: private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam, UInt32 lParam); private const UInt32...
3
2145
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
3
441
by: Michael C | last post by:
Hi all, Quick question about the TreeView control. I'm using code like this to determine the currently clicked TreeNode in the TreeView. private void MyTreeView_MouseDown(object sender,...
3
1793
by: Tom | last post by:
Sorry... new to this. I trying to figure out how to do a page redirect when someone clicks a treeview node. Does someone have a code snippet for this?
3
11207
by: Gerhard | last post by:
I have the following code in an .net 2.0 project: <asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation" Width="165px"> <asp:TreeView ID="TreeView1" runat="server"...
1
2123
by: Sam | last post by:
Hi, On my main form in my MDI application, I have two treeview, one on the right, which is actually a UserControl inherited from Treeview, and the other on the left. When I click on a node in...
1
2406
by: Daves | last post by:
Sorry folks but I will be reposting this question from 6/5 until someone gives me an answer - the question is very easy and so ought the answer to be. I really need the answer! ------- I'm...
8
12724
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
7
7816
by: Joe Cool | last post by:
Let's say I have a Treeview control on a form. Each leaf node in the Treeview has a ContextMenuStrip, each with one ToolStripMenuItem, and all ToolStripMenuItems Click event is handled by a comment...
9
6117
by: auntiejack56 | last post by:
Hi, I've got a treeview, and I want to display the node text property that I have a) clicked on or b) highlighted using the up or down arrows
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7167
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7208
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5464
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.