|
Hi, good Control, but is there a C# Version of ths easy-to-use Control. There are a few on The Code Project, but many of them are very difficult to use.
Thanks
hullihulli
|
|
|
|
|
|
Ted,
Thank you for the great control. We started using it in our application. I converted your control to C# using an online converter and also fixed a couple of small bugs. I would post the C# version, but not sure how to attach a file to the comment.
|
|
|
|
|
Great component and just saved me a week or two of coding work as this was exactly what I needed. I already started writing my own, but then I realised how much work that really is and made a web search for one...
I noticed some weird behaviour in the column resizing. When you have a lot of columns, say, more than the control can show at one glance, and resize one the columns that you have scroll into vicinity.. poof.. the column headers will be inactive for some distance from the right edge of the control.
A little research on the code showed that the problem lies in _generateHeaderRect sub in ContainerListView.vb file. I changed it to
Me._HeaderRect = New Rectangle(Rect.Left + 2, Rect.Top + 2, Rect.Width - 4, 20)
and it started to work.
Also, it was not possible to resize the rightmost column at all, because the scrollbar did not bring the right edge of column to vicinity. Again a little tuning, this time in _adjustScrollBars sub in TreeListView.vb file:
'SET SOME UNAFFECTED PROPERTIES 0F THE HSCROLL
With Me.HScroll
.Left = Rect.Left + 2
.Top = Rect.Top + Rect.Height - .Height - 2
Try
If (Me.Columns.Count > 0) Then .SmallChange = ColWdths \ Me.Columns.Count Else .SmallChange = 0
Catch ex As Exception
.SmallChange = 0
End Try
.Maximum = ColWdths + 8 '<-- Added eight pixels to see the edge
End With
and -poof- there it goes again.
|
|
|
|
|
Definitely not the end to all other tree list view conrols because of the image list problem. Only thing this ends is my use of it.
|
|
|
|
|
It's pretty good, but their are bugs
|
|
|
|
|
Hi,
how can i scroll to the First Node?
Thanks
|
|
|
|
|
This one is very easy to reproduce. Open the sample application, and copy and paste the populate button. Rename the caption to Clear, double click and paste the following code for the ClickEventHandler:
If TypeOf Me._CurLstVw Is TreeListView Then
CType(Me._CurLstVw, TreeListView).Nodes.Clear()
Else
Me._CurLstVw.Items.Clear()
End If
Run the application, click Populate, then click Clear, now right click anywhere in the TreeListView and it throws an error in _showSelectedItems. It seems to retain a copy of all of the nodes (?) even though the Tree is cleared out and is trying to show them as selected, but this is not valid.
|
|
|
|
|
I tried that, and yes, that's the way it works. But no worries, it can be fixed by modifying _showSelectedItems subroutine in TreeListView.vb file. With this modification the error will be avoided:
Else
Dim TempNode As TreeListNode = Me._FirstSelectedNode
If TempNode IsNot Nothing Then '<-- add this line...
...
Me.EndUpdate()
End If '<-- and this, too.
End If
|
|
|
|
|
Hi,
i want to change the "Editable" property to false so the user can not edit a sub item.
how do i do that??
Thanks,
Ron.
|
|
|
|
|
Hi,
First I will say "NICE JOB" a realy cool controll that I am using now.
My question is how can I set images for different levels. I have noticed that only 2 images are working 'inageindex' and 'selectedimageindex'.
e.g.
-- RootNode
----ChildNode
------ChildNodeItems
I have 6 images, 2 for each level but cannot get any onther image displayed except the 2 default ones..
Mark Lassooij
|
|
|
|
|
Have you already found the solution to this problem?
|
|
|
|
|
No, have not received any feedback yet...
|
|
|
|
|
Firstly, great control Tosberg. Works very well and a good port from C#.
I am using it in a small program that allows a user to see a list of folders then type in a number of sub-folders to move to a pre-defined location. I have three columns in the treeview, the folder name, number of available sub-folders and an editable column to type in the number to move. I have made the first two columns not editable.
I want the user to be able to press the up/down arrow keys to move up/down to the previous node and edit the number to move in that. I have managed to trap the up/down key event in the edit box and the code below is entered (for the key down event).
Friend Sub EditNextRow()
Dim TestNode As TreeListNode = Nothing
TestNode = Me._CurNode.NextSiblingNode
If (TestNode IsNot Nothing AndAlso Not TestNode Is Me._CurNode) Then
Me._CurNode.EndEdit()
Me._CurNode = TestNode
If (MyBase._MultiSelectMode = MultiSelectModes.Single) Then
Me.SelectedItems.Clear()
Me._CurNode.Selected = True
Me._CurNode.Focused = True
** Me.GetItemAt(Me._CurNode.SubItems(1).Bounds.Location).BeginEdit()
End If
Me._showSelectedItems()
Me.Invalidate()
End If
End Sub
My question, at the line marked with the two asterisks (**), how do I get the second sub-item to BeginEdit()? The current code as above starts editing the folder name (first column) rather than the third column.
|
|
|
|
|
Hi,
There is a problem with the column when you double-click on the separator to set the width to be able to see all the items in that column.
A couple of things that need to be done to fix this:
The aMwid parameter in the OnProcessColumnMouseDownItems method needs to be passed ByRef rather than ByVal, i.e.:
Protected Overridable Sub OnProcessColumnMouseDownItems(ByVal aColIndex As Integer, ByRef aTwid As Integer, ByRef aMwid As Integer)
The above change needs to be made in ContainerListView.vb and TreeListView.vb
The second change is in TreeListView.vb in the _autoSetCOlWidth sub:
ElseIf (aColIndex = 0) Then
aTwid = Tools.GetStringWidth(Node.Text.ToUpper, Node.Font) + (Node.Bounds.Left) + 4
(i.e. remove the -Node.RootNode.Bounds.Left).
|
|
|
|
|
Can i do the same in VC++??
|
|
|
|
|
cool control, thanks for sharing. I am a bit of a beginner so please excuse the elementary questions. How do you add a sub-node to a selected node? More specifically how do you get the selected node. .Nodes does not have a "selected" property. .SelectedItems(0) will give you the selected item, but it's a ContainerListViewObject which won't accept a node being added to it. So I'm a little confused, could someone please point me in the right direction?
Thanks
|
|
|
|
|
There is a SelectedItems property on the TreeListView, this will get you the selected nodes, but you'll have to cast them to TreeListNode.
Also, each Node has a Nodes property, you can use this to add child nodes to an existing Node.
|
|
|
|
|
oh, CAST it to TreeListNode, that was easy. Dang newbies
Thanks for your help, that works quite well.
|
|
|
|
|
on the screenshot you've provided control looks great
I tried it on the WinXP, compiling with .NET 2.0 and it draws without 3D border around the control.
I could send a screenshot if needed.
Also one more suggestion: it would be more logical to finish column row with column color, not the control one.
modified on Sunday, October 26, 2008 12:12 PM
|
|
|
|
|
Dmitriy,
Please send a screenshot and I'll take a look at it. Could you please explain further what you mean when you say "it would be more logical to finish column row with column color, not the control one"? I'm not sure I understand what you mean. Thanks!
|
|
|
|
|
Yes, the border was missing under framework 2.0. The core of the problem is the very interesting (and sometimes also annoying) feature in Visual Studio. If you modify a class object given as a parameter to a function (or a sub) somewhere in the unction code, the modifications will be visible in the calling code, too. Even if you have defined the parameter as ByVal! This does not happen with simple datatypes, such as Integer or so. So, be careful not to modify any class objects in subroutines!
This was the problem with the control borders as well. OnPaint was calling _drawColumnHeaders and then _drawBorders. But, because _drawColumnHeaders made changes to the aGr object passed to it, the changes were visible in the calling function and then again in _drawBorders.
I fixed this by commenting out the lines saying
aGr.Clip = something in the _drawColumnHeaders function. I don't know yet what side-effects this fix has, but the control still passed my Q.C.
|
|
|
|
|
why grid lines are not rendered in the first column?
|
|
|
|
|
Dmitriy,
In my first version of the control, I actually did render the gridlines in the first column but it didn't look right to me so I left it out. I suppose I could make it optional in a future version. I'll look into it.
|
|
|
|
|
First of all, thank you for the great component!
Since ImageList have problems with images with transparency, we need a mechanism to draw this images in a different way. The first suggestion is not using ImageList at all, use your own or ImageSet, for example. The second suggestion is in adding OwnerDraw property and call DrawItem/DrawSubItem/DrawColumn methods.
Thank you for the control once again
|
|
|
|