Bug with selection in TreeListView?

  • I am trying to make a TreeListView where I can drag and drop the nodes from
    the OLV component onto another component (not OLV) and drop them there. The
    drag and drop itself works well, but I have problems with the selection of the
    node to start dragging it.

    All the nodes have small images next to them and if I click once on the image,
    holds down the left mouse button and drags, everything works. But if I instead
    do the same on the text next to the image, often it doesn't gets selected and
    nothing gets dragged. I often have to click many times to get it selected when
    clicking on the text, but only once on the image. Is this a bug or some
    setting I haven't found yet?

    In the .NET TreeView it works equally well with dragging both from the text
    and from the image.

    Please help as this is breaking the TreeListView for me!

  • Sorry to bother. Now when I READ the documentation more carefully I found

    "NOTE: Giving a SmallImageList to each TreeListView is very important. If you
    don’t do this, the hit testing on the tree will not work correctly. The image
    list doesn’t need any images – it just needs to exist."

    Which solved the problem. But I post it here if someone else does the same
    stupid mistake I did.

    But I have found another potential problem with the TreeListView:

    TreeListView.TreeRenderer renderer = orgTreeListView.TreeColumnRenderer;
    renderer.LinePen = new Pen(Color.Gray, 0.25f);
    renderer.LinePen.DashStyle = DashStyle.Dot;

    The last line should makes dots, I guess. Like in the .NET TreeView. But I
    only get solid lines. Another mistake from my side or a bug this time? =)

  • stepr


    renderer.LinePen = new Pen(Color.Gray, 1.5f);

    and look again. You should see lots of dots now.

  • Thanks! Now I get dots. But with the setting 1.5f they blur together so I used

    renderer.LinePen = new Pen(Color.Gray, 1.001f);

    They still blur somewhat (more than the .NET TreeView), but it is acceptable
    and now I got the dots at least. =)

  • stepr

    you can of course create your own pen with it's own dash pattern.

                renderer.LinePen = new Pen(Color.Firebrick, 1.5f);
                renderer.LinePen.DashPattern = new float[] { 2.0F, 1.0F, 2.0F, 1.0F };
                renderer.LinePen.DashStyle = DashStyle.Dot;

    There you go size two dots separated by size one spaces.