Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TreeView Update help

78 views
Skip to first unread message

jg

unread,
Jun 5, 2002, 10:33:25 AM6/5/02
to
I am using Delphi 6 and am incorporating drag and drop functionality
into my app. When I drag a file over from one TreeView to another,
after the file copies over successfully, I delete the file from the
originating folder. However, I cannot get the folder to refresh its
contents. The file is no longer there in reality, but still shows in
the TreeView. I have tried Update, Repaint and Refresh. I have set
the AutoRefresh to True at Design Time. Any suggestions?

AlanGLLoyd

unread,
Jun 5, 2002, 2:00:35 PM6/5/02
to
In article <8f13e995.02060...@posting.google.com>,
jasp...@hotmail.com (jg) writes:

I hesitate to suggest the obvious, but you have deleted the TTreeNode from the
TTreeNodeS colllection, haven't you.

Try covering the treeview with another window by hand, and then exposing it -
does the treeview refresh properly, or is the "deleted" node still there.

Alan Lloyd
alang...@aol.com

jg

unread,
Jun 6, 2002, 11:08:18 AM6/6/02
to
Yes, I have deleted the Node, usings items.Delete(GetNodeAt(X,Y)) but
should I not be able to call Repaint after that and be done with it?
Do I need an OnDeletion Event Handler? Thanks for your input. (And
don't hesitate about pointing out the obvious, been playing with
Delphi less than a week)

alang...@aol.com (AlanGLLoyd) wrote in message news:<20020605140035...@mb-fe.aol.com>...

AlanGLLoyd

unread,
Jun 6, 2002, 12:48:56 PM6/6/02
to

>Yes, I have deleted the Node, usings items.Delete(GetNodeAt(X,Y)) but
>should I not be able to call Repaint after that and be done with it?
>Do I need an OnDeletion Event Handler? Thanks for your input. (And
>don't hesitate about pointing out the obvious, been playing with
>Delphi less than a week)
>

I must admit that I would have gone with ...

with TreeView1 do
Items.Delete(Selected);

Are you sure that a deletion is actually going on, TreeView1.Items.Count will
give you the number of nodes in the treeview. If they're the same before and
after deletion, then you're not deleting, if they differ, then something very
strange is going on. As soon as I delete a node with the above code it repaints
without the node.

Alan Lloyd
alang...@aol.com

jg

unread,
Jun 7, 2002, 10:01:27 AM6/7/02
to
I had also tried TTreeNode.Delete with no luck. But your last snippet
of code did the trick! Thanks.

alang...@aol.com (AlanGLLoyd) wrote in message news:<20020606124856...@mb-fe.aol.com>...

0 new messages