|
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
|
|
|
|
|
Thanks for the tip, Dmitriy. I'll add this to my growing list.
|
|
|
|
|
Good job on your control. I really like it.
I have one problem with the colors for the subitems. When I set the BackColor property, the color is not right : it is the same color, but washed out. Is it a bug or how can I get the right color. The ForeColor property gets me the right color.
Also, when I set the text alignment for the subitems, there seems to be a problem with the HorizontalAlignment.Center or the HorizontalAlignment.Right setting. Sometimes, I cannot see the whole string inside the subitem.
Thank you
Frank
|
|
|
|
|
You are right about the washed out color - it's definitely a bug. I'll look into the alignment issue, but this sounds like a bug as well.
|
|
|
|
|
I think the problem with the Text Alignment lies in the MeasureDisplayString method in the Tools.vb file.
If you change it to:
Public Shared Function MeasureDisplayString(ByVal aGraph As Graphics, ByVal aText As String, ByVal fontVal As Font) As SizeF
Dim Bmap As Bitmap = New Bitmap(1, 1, aGraph)
Dim Anagra As Graphics = Graphics.FromImage(Bmap)
Dim Sz As SizeF = aGraph.MeasureString(aText, fontVal)
Bmap.Dispose()
Anagra.Dispose()
Return Sz
End Function
Then the Text Alignment works better.
|
|
|
|
|
How are things coming on the washed out subitem bug? It is a show stopper for me at the moment.
Karl
|
|
|
|
|
first of all thanks for the the source. I am trying to build up a view like filezila's upload and download GUI. which is basicly adds lots of files into listview and upload or download them. for this I think 2 column will be enough for one filename and second for the progressbar to show how is it going. actually I did it and working nicely. but I need to put 3 columns into ContainerListView. otherwise my progressbars does not show up. I dunno where am I doing wrong.
any idea ?
|
|
|
|
|
How would i programatically expand the columns similar to double clicking on the column headers but not. This expanding should be large enough that both the header text AND the columns content are all visble.
In short i would like to adjust all the columns widths as the tree gets expanded. So that at all times all text is (all text thats expanded anyway) is visble to the user.
Thanks for a great control
Ps. I tried a hack that ive used on the default listviews and it doesnt work. Any help is appriciated!!
For Each col As WinControls.ListView.ContainerColumnHeader In Clv.Columns
col.Width = -3
Next
|
|
|
|