[programming] Re: D1 TOutline Component

  • From: "John" <spyder@xxxxxxxxxxxxxxx>
  • To: <programming@xxxxxxxxxxxxx>
  • Date: Sat, 18 Aug 2001 15:44:54 -0500

Hello All,

Well I finally got around to debugging my problem with Duplicate Directory
names and files.  The issue is not neccessarily with TOutline or
TStringList, the problem is with a for loop of mine, here is the problematic
for loop:

         For I := 0 TO Fils.Count - 1 Do
         Begin
           Outline.AddChild(Level, Fils[I]);
           Outline.Items[Outline.GetTextItem(Fils[I])].Data := TData.Create;
           TData(Outline.Items[Outline.GetTextItem(Fils[I])].
             Data).IsLast := I = Fils.Count - 1;
           TData(Outline.Items[Outline.GetTextItem(Fils[I])].
             Data).HasGlyph := False;
         end;

Now, as you may have guessed I created a data object which contains various
information for each node as I need the information other places in the
code.

The problem is with the method GetTextItem, as the help file states this
method returns the first matching result it finds.  Now when I come across
the second instance of the same folder in the outline, the first one is
returned and if the data structure is already created then I will receive my
GPF when trying to create the Data Structure again.

I have not given a lot of thought to the resolution of this problem yet, the
only thing I can figure is track which nodes already have the data structure
and only create the data structure if it does not already exist.

This leaves one problem though, how can I find the real Outline node I need
in this situation, GetTextItem will return the same index no matter what in
this case.  So I was wondering if anyone has any ideas how to overcome this
situation?  I Think I will need to create a function of my own to do this,
but still need to figure out a way to find the proper index item.

If anyone has any thoughts or suggestions I would greatly appreciate your
input.

TIA,

-John-



To unsubscribe, send a message to programming-request@xxxxxxxxxxxxx with the 
words "unsubscribe"  (without quotes) in the subject feild.  OR visit 
http://freelists.org/

Other related posts: