|
Hi when I update the treelistview and all the nodes is expanded. If I checked the very last node and update treelistview, I get a red cross over the control. This does not happen when the list is node expanded(collapseAll) and also not when I select the first node.
Does anybody know how to fix this?
|
|
|
|
|
So i have added over a hundred items to the TreeListView and everything works fine but when i add more children the the current size on the screen can show then when i scroll down to see them it jumps to the next node at the parent level. i tried using the mouse wheel and the scroll bar on the right, both of them having the same effect. If i click on one of the children and use the keyboard arrow keys to scroll down then it will move down to where i need it but i need to be able to use the mouse to show these nodes. Does anyone know how to fix this issue?
|
|
|
|
|
Hey there!
I really appreciate your work - it's pretty usefull but I need to do something more specific...
I need to resize a whole row due to a colum with multilines like:
A | B | C | D | entry_1 | val_1 | alv_1 | lva_1a | | | | lva_1b | | | | lva_1c | entry_2 | val_2 | alv_2 | lva_2a | | | | lva_2b | | | | lva_2c |
I tried to place a Control (ListView and Textbox with Multilines=true) but it still displays the .Text-Property! Is there a way to realize what I want to do?
Thanks in advance
|
|
|
|
|
Hello,
I use this control in one of my projects.
I found 2 bugs and I add 1 feature :
1) Bug :
When I pressed a Home ou End key and I not have any item selected, it raised a NullReferenceException in function : TreeListView._moveToIndex
Correction :
Replace lines :
Me._CurNode.Focused = False
Me._FirstSelectedNode.Focused = False
by :
If Me._CurNode IsNot Nothing Then Me._CurNode.Focused = False
If Me._FirstSelectedNode IsNot Nothing Then Me._FirstSelectedNode.Focused = False
2) bug :
When I expand child nodes before expand parent node, it miscount visible items.
I have not enough time to corrected that, but the way to reproduct the bug is easy :
Example :
Inherits a class from WinControls.ListView.TreeListNode.
Make a Sub UpdateNode (for example)
Public Sub UpdateNode()
ExpandChilds
ExpandMe
End sub
So, visible childs nodes are count as many times as they are expand parent.
3) New feature
Expand and collapse all nodes/sub nodes by keys * and / (as the classic TreeNode control)
In the function
TreeListView.OnKeyDown
Add in the Select Case structure :
Case Keys.Multiply
If SelectedItems IsNot Nothing AndAlso SelectedItems.Count > 0 Then
For Each lItem As TreeListNode In SelectedItems
lItem.ExpandAll()
Next
End If
Case Keys.Divide
If SelectedItems IsNot Nothing AndAlso SelectedItems.Count > 0 Then
For Each lItem As TreeListNode In SelectedItems
lItem.CollapseAll()
Next
End If
Thanks for this usefull control.
|
|
|
|
|
Hi Ted Osberg. Thank you for your project. It helps me much in my work.
But i found something wrong when resize treelistview. If i move the scrollbar to the right and maximize the form, when left click to subitem (i added about 15 subitem column) , it isn't selected. something wrongs and i cant solve this problem. I try to make hscroll always in the left, but subitem cannot be selected. Can you give me an idea to solve this problem. Thanks
|
|
|
|
|
I am trying to figure out a way to display the selected node if it is not being displayed. Any help would be appriciated.
|
|
|
|
|
I'm experiencing a similar issue. I've tried using the node variable directly and casting SelectedItems(x) to treelistnode. I've tried using the node object and RowIndex property in the EnsureVisible parameter to find location. Using the RowIndex property works sporadically - often it throws OutOfRange error with this code:
If Not nd Is Nothing Then
tlvSystems.EnsureVisible(DirectCast(tlvSystems.SelectedItems(0), TreeListNode).RowIndex)
End If
modified 31-Mar-15 12:40pm.
|
|
|
|
|
Great work! It will be better if the checkbox becomes Three-State. The state changes automatically if the state of parent node or child node changes.
|
|
|
|
|
Hi experts, just want to ask how can I change the icon in the subitems?
modified 11-Oct-12 0:03am.
|
|
|
|
|
I added an image list to the TreeListView, but I fail to display other images than the one with the index in the property "DefaultImageIndex" (default 0). If I switch the property "DefaultFolderImages" to false, there won't be displayed any icons at all. If I switch it to true and add an image list (property "ImageList"), which contains of course several images, only the image with the index in the property "DefaultImageIndex" (default 0) is displayed, no matter how I create the nodes or set their properties. An example:
TreeListNode node = new TreeListNode();
node.Text = "Image Index = 1";
node.ImageIndex = 1;
node.SelectedImageIndex = 1;
treeListView1.Nodes.Add(node);
However, displayed is the image with the index in the property "DefaultImageIndex" (default 0).
Any hints? Advices?
|
|
|
|
|
I want this too. Please help us about this please.
Also thus is possible to add two imageIcon in the same row?
|
|
|
|
|
i have the same issue,any help regarding to this?
|
|
|
|
|
Hi experts, thus possible to hide a certain column using this treeListView?
Regards,
|
|
|
|
|
For the solution:
.Add("AssetCode", 10, HorizontalAlignment.Center).Hidden = True
|
|
|
|
|
Hi experts, it is possible to put a gridlines in this TreeListView?
|
|
|
|
|
As with the "AlphaComponent", the control has a "GridLines" property that you can set either via the VS Designer (GUI) or at runtime via code (ControlName.GridLines).
You can choose between:
None
Both
Column (default)
Row
So, if you wanted a SpreadSheet like view with total grids, you would select "Both". Note that this this control does NOT apply gridlines to the actual tree, only the "subitem" columns for each entry.
My personal preference is to keep the default Column entry and use an alternating node background color to provide visual aid to separate items. Though this approach can cause two rows of the same color to be next to each other depending on what's expanded/collapsed vs the order that the entries were added. But I find this to be less of a trouble than trying to tweak the drawing code.
|
|
|
|
|
Hi, how can I get the node index after I select the row?
|
|
|
|
|
I needed to do something similar when the user Right Clicks on the control.
I needed some Details about the selected node in order to turn on/off various
choices in the context menu....
Something like this works well for me:
Private Sub Control_MouseDown(sender as Object, e As System.Windows.Forms.MouseEventArgs) Handles blah blah
dim tlvNode as TreeListNode
tlvNode = TreeControlName.GetItemAt(e.Location)
if tlvNode IsNot Nothing then
tlvNode.Properties
msgbox(tlvNode.Index)
End If
End Sub
So basically, if you pass a set of coordinates to the Control.GetItemAt() function, it will return to you a Node object that you can use to access any available properties of that node, such as its Index value.
Another option is the ControlName.SelectedItems collection. If you don't allow "multi-select" then the current selected node is simply ControlName.SelectedItems(0).properties
Otherwise, you'll have a list of all selected nodes (SelectedItems(Index)) in the list.
|
|
|
|
|
Thanks for this.
But, while changing to DoubleClick. It doesn't allow it.
Private Sub Control_DoubleClick(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tlvMain.DoubleClick
Is there any workaround to get the index by double clicking it?
modified 20-Sep-12 21:23pm.
|
|
|
|
|
This works just fine for me with VB.Net on VS 2010:
Private Sub tlvMain_MouseDoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) _
Handles tlvMain.MouseDoubleClick
If tlvMain.GetItemAt(e.Location) IsNot Nothing Then
MsgBox(tlvMain.GetItemAt(e.Location).Index)
End If
End Sub
Be aware that almost every control that can contain "dead" or "white" space (area of a control that can, but does not contain an object) can mess up your code if you assume that the user clicked on a node, object, item, etc. For example, on a TreeView control, you have a space that can contain nodes, but may not. The user can interact with this space, so you need to validate objects you want to interact with. Thus, the above If/Then statement that checks to see if there is even a selected node to get properties of. Without these kind of checks, you will have very unstable programs.
modified 21-Sep-12 9:02am.
|
|
|
|
|
I want to alternate the background color of each visible row within the grid.
Currently, I set the background color of each node prior to adding them, but it displays very light and faint in the control. It's almost like the color is being washed out as though it was being displayed through a white object on top of the tree.
What am I doing wrong?
Edit:
I found the answer, the control has a property called "AlphaComponent". It is an overlay transparency factor that overides the alpha value of whatever color you choose. The default is 65 (out of 255 being no transparency vs 0 total transparency). I set the value to 255 and got the color I wanted.
modified 18-Sep-12 17:03pm.
|
|
|
|
|
Hi can you post your code please?
|
|
|
|
|
In Visual Studio, when you select the control on your form, in the "Properties" window for the control is a property called "AlphaComponent" which will have a default value of 65. I simply changed it to 255 to remove any "transparency" (fading) effect.
There was no "code" involved there.
Now, obviously, there a lot of ways of setting properties of the control/nodes
here is just a basic example of creating a node object, setting some properties
and adding it in the first level (root) of the tree:
dim tlvNode as new TreeListNode
dim RootNodeIndex as Integer
tlvNode.Text = "Whatever you want"
tlvNode.BackColor = vbColor.Blue
tlvNode.SubItems.Add("Text for the appropriate column(s)")
RootNodeIndex = TreeListControl.Nodes.Add(tlvNode)
The "AlphaComponent" property of the control will be applied against the color you specify
even if the color already has it's own "alpha" value. If left at the default level of 65, it has a very intense faded effect on highlight, row select and node background colors. Changing it to 255 (no fade effect) caused me to have to set a different "RowSelectColor" value for the control as the default Blue was way to bold without any fading.
|
|
|
|
|
Thanks for this dude.
|
|
|
|
|
I integrated your treelistview code in my VB project and works very well. However I sometime hit a condition where the treelistview disappears and shows a red "X". While debugging the code, I realized that this has to do with scrolling and collapsing the tree, so while the tree is scrolled to a lower position, you try to collapse a node, this causes an issue with a node wanting to be drawn, but it´s outside of the displayable area. I can provide more details, but wanted to know first if you ever came across this issue. Thx, SD
|
|
|
|