473,625 Members | 2,677 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 1236
It is something like:

Protected Overrides Sub OnDoubleClick(B yVal e As System.EventArg s)

If SelectedNode.Ge tType() Is GetType(TreeNod e) Then
CType(SelectedN ode, TreeNode).Open( )
End If

End Sub

Public Sub Open()
System.Diagnost ics.Process.Sta rt([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_LBUTTONDBLCL K event:

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

Const WM_LBUTTONDBLCL K As Integer = &H203

Dim bHandled As Boolean = False

Select Case m.Msg

Case WM_LBUTTONDBLCL K
Me.OnDoubleClic k(EventArgs.Emp ty)
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******** ********@TK2MSF TNGP14.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*****@NOSPAM sogecable.com> schrieb im
Newsbeitrag news:OO******** ******@TK2MSFTN GP15.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_LBUTTONDBLCL K event:

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

Const WM_LBUTTONDBLCL K As Integer = &H203

Dim bHandled As Boolean = False

Select Case m.Msg

Case WM_LBUTTONDBLCL K
Me.OnDoubleClic k(EventArgs.Emp ty)
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******** ********@TK2MSF TNGP14.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******** ******@TK2MSFTN GP10.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******** ********@TK2MSF TNGP14.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
2421
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 WM_LBUTTONDBLCLK = 0x203; pTreeNode.TreeView.SelectedNode = pTreeNode;
3
2160
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, System.Windows.Forms.MouseEventArgs e) { currentNode = MyTreeView.GetNodeAt(e.X, e.Y); }
3
1800
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
11219
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" DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None" CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False"> <LevelStyles> <asp:TreeNodeStyle CssClass="homenav" Font-Underline="False" />
1
2129
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 the left Treeview, all the nodes in BOTH Treeview disappear for some milliseconds. First question: Why do I get this nasty effect? Second question: Why does it affect BOTH Treeview, since they are
1
2423
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 sorry for reposting but I've already googled for hours and I see others have asked about this here without getting replies, this is starting to look like some Bermuda phenomenon nobody wants to answer to! I really need to accomplish the task below...
8
12750
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 form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if every time that a user selects a node, the whole page has to reload. Is there a way to have a node...
7
7833
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 event handler. How do I determine which Treeview Node signalled the menu event in the common event handler?
9
6123
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
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8692
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8354
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1499
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.