|
Hi,
If i have two sibling and the former has many child nodes ( more than what
the screen can hold, the lines that link to the next sibling node does shows only when the sibling node comes into view.
Also, your help files does not show the class hirarchy charts between the various classes. I'm unable to understand the relation between ContainerListViewItem and TreeListNode.
I'm implementing a search box on the tree. If a user types in it, it will seach and highlight all the matching nodes. I need to expand all the parent nodes of the matched nodes and present it to the user. I'm maintaining a hashtable of all the nodes since its easier to search thru the list. How ever, after i'v expended all the required nodes, and scroll using the scroll bar to the bottom, i get a null exception. The Code is a follows:
Public Sub SelectNodes(ByVal txt As String, ByRef nodecount As Integer)
Dim nds() As TreeListNode
nodecount = 0
For Each node As TreeListNode In _nodesByValueMember.Values 'Hashtable
node.BackColor = Color.White
If node.Text.ToUpper.StartsWith(txt.ToUpper) And txt <> "" Then
' node.leaf is a property added by me. I need to differentiate between Groups: can have child nodes and Leafs: Terminal Nodes.
If (LeafOnly And node.Leaf) Or Not LeafOnly Then
node.BackColor = Color.Green ' highlight the node
nodecount += 1
If node.Text <> node.FullPath Then 'has parents
'(node.hasparent=false, did not work here)
nds = node.ParentNode.GetNodesInPath()
For i As Integer = 0 To nds.Length - 1
If Not nds(i).IsExpanded Then nds(i).Expand()
Next
End If
End If
End If
Next
End Sub
thanks,
|
|
|
|
|
Hi,
I've tried your control.
It's very good.
But I have changed default font and i get items in TreeListView in the original control font.
I have also derived a form from my base form which has Calibri as default font.
Then i have dragged TreeListView control on the form but the control font remains TreeListView default font and not the base form default font.
Happens it only to me?
Thanks in advance
Bye
Gianluca
|
|
|
|
|
Gianluca,
I'll look into this soon. Thanks for the update.
|
|
|
|
|
Gianluca - Dragging onto a base form will not change the font. You will have to do it manually. Also, I cannot reproduce the problems changing the font in the treelistview as it seems to be working for me. Can you send me a small sample recreating the error?
|
|
|
|
|
Hi,
I have recompiled all the projects of my solutions with Visual Studio 2008 / .Net 3.5 and now it works.
For your information this is how i have used your TreeListView
- I have a standard form called Base (with Default font Calibri, 11 bold). This form has been compiled as a library (dll).
- I have created a form (named Main) derived from Base where i have inserted your control TreeListView.
- I have manually changed the font for TreeListView in Calibri, 11 bold from standard Visual Studio WinForm Designer (property font).
In Visual Studio 2005 the first row of the control (column headers) is in Calibri 11 Bold but 2nd, 3rd, ... rows are in another font.
With Visual Studio 2008 / .Net 3.5 it's ok
Thanks for the control
Bye
Gianluca
|
|
|
|
|
This is an excellent control. Thanks for sharing.
I noticed that when you set backcolor property for TreeListNode and your tree list view has a horizontal scrollbar, scrolling horizontally scrolls the background color of the node as well.
|
|
|
|
|
Thanks for the finding the bug. I'll add it to the list and get to it soon, hopefully. Right now I'm swamped with work. If you happen to fix it before I do let me what did the trick. Thanks!
|
|
|
|
|
Great component, But very damage that the data cannot be typed, (Integer, Boolean, Dates, ...)
How to select the data body for some to do a copy, in laquel a single column changes value before final copy?
Thank you a lot
Claude Excuse my English, a French 
|
|
|
|
|
Great suggestion on the typed data! I'll get that in a future release.
I'm not sure if I understand what you are saying about the copy. Can't you add your own ContextMenuStrip on the control with selection options? Does this answer your question?
|
|
|
|
|
I used this control on a database, and I want to be able to do a copy of the body of the nodes and subitems, next put back them in entirety in having to change only the value of a column (fields ref DB)
|
|
|
|
|
|
As I use this superb component with a database, I have of the to modify this component at the level of the classes, For the under nodes (Listview) not need of icon and it lacked me 3 property ,(
Key,Value,WithImage, (of a column))
Claude
|
|
|
|
|
Claude,
Sorry, but i'm still not sure what you are getting at here.
|
|
|
|
|
The control looks pretty good man. I'm glad people are still working on these controls, as I have had such a hard time finding time to do any personal projects. I would love to dive back in and rewrite my original controls, but I don't think it will ever happen. Keep up the good work, and keep the project alive. 
|
|
|
|
|
Your article was my inspiration to get it started and extend it. I looked at several other attempts at TreeListView controls but all of them were either underdeveloped or very buggy. So I took your design as the base and decided to merge all of the good aspects of the other controls (as well as my own ideas) into one control! I tried to keep it as extensible as possible so others could build on top of it easily if necessary. I've actually had this control since 2004 (working on it here and there) but, unfortunately, my aversion to writing articles and my lack of any free time (2 kids, full time job as well as maintaining a small side business) for personal projects actually kept me from posting it on CodeProject but I finally mustered up enough motivation to post it here.
Thanks for your original article. If it wasn't for that I probably never would have started it.
|
|
|
|
|
But you may want to look at the performance.
When you add say 500, 1,000 or even 5,000 nodes the control works well, but when you add 10,000 the control becomes sluggish and slow to respond.
Other than that, very well done!
I think this control will be very useful and has great potential.
Kind regards
Gary
|
|
|
|
|
Thanks! I'll check it out and hopefully get it fixed.
|
|
|
|
|
Performance of this control is a tricky thing to work out. I messed with quite a few versions of rendering code after I posted my final version of the extended listview control years ago, and never fully solved all of the performance problems. I am convinced that there is a nice, simple, and elegant solution, however. Since my first attempt at writing a control like this, I've learned quite a bit about fundamental algorithms and structures. Trees follow strict rules and have certain attributes, like depth, that should provide the simple answer that will allow a control like this to function with an unlimited number of records (rendering only the visible nodes, ignoring all the rest).
I may be able to dig up all my old versions and notes of the extended listview control and provide them....maybe it will help.
|
|
|
|
|
That would be great, Jon. Thanks!
|
|
|
|
|
It works nicely and is full featured.
I think checking a node should check all the subnodes of the checked node.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Tadah! That's what 'Branching' is for! You can capture the AfterCheckStateChanged event on the TreeListView and control the child nodes using the 'Branch' property like this:
Private Sub tlvMain_AfterCheckStateChanged(ByVal sender As Object, ByVal e As WinControls.ListView.EventArgClasses.ContainerListViewEventArgs) Handles tlvMain.AfterCheckStateChanged
DirectCast(e.Item, TreeListNode).Branch.SetProperty("Checked", e.Item.Checked)
End Sub
You pass in the property name you want to set/unset and it will set that same property on all the children.
|
|
|
|
|
Tosberg wrote: You can capture the AfterCheckStateChanged
event on the TreeListView and control the child nodes using the 'Branch' property like this
Right, I did exactly that in my own code for a different project, and thought it should be nice to have.
BTW, any plan to support various column types in the listview (say combobox, checkbox etc)?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hmmmm... I hadn't thought of that. I'll put that down on the list for future development.
|
|
|
|
|
A screenshot would have been nice...
Apart from that, it looks like a very nice control, so I'll give you a 5 nonetheless.
I do have a problem, though: I've only run your demo to see what it looks like, and in that demo it doesn't appear that the checkboxes/Radiobuttons work. Isn't it enough just to set Checkboxes=true?
Cheers,
Johnny J.
modified on Wednesday, June 11, 2008 6:40 AM
|
|
|
|
|
I'll work on getting a screenshot out later today after work. Sorry about that. I was in a rush to get the control out to CodeProject.
Once you set the 'CheckBoxes' property to TRUE, you should see the checkboxes appear on the control as it should refresh instantly. The 'CheckBoxType' property sets it to Checkboxes or RadioButtons. I haven't run into this issue before and I've run this on both XP and Vista. What operating system are you running this on?
modified on Wednesday, June 11, 2008 7:38 AM
|
|
|
|