Hi, Joe--

Thanks.

I am actually using the CellTag now, for another part of the code.

What I'm doing is comparing two folders and checking each for discrepancies
(files which exist in one folder but not in the other). The method has been
to add everything to two dictionaries, then add all files found in each
folder to a listbox. I then compare the two dictionaries for the entire list
of each folder, and see if each dictionary contains the same files. If one
doesn't, I call that up and add it to the listbox for the folder missing the
file, and mark it as missing.

The problem is that the paths to the files in the dictionaries, as you
suggested, are completely wrong. I'm getting the correct missing filenames
allright, and that is found by the index but when using the code below, the
Path comes out wrong.

I'm not sure I understand why this happening. The relevant code is:

 If not TargetDictionary.HasKey(SourceDictionary.Key(j)) then
        TargetList.AddRow SourceDictionary.Key(j)
        f=SourceDictionary.Value(SourceDictionary.Key(j))

where SourceDictionary.Key(j) is the name of the file, and f is the
folderitem  which I earlier assign to that key's value. In that case,
shouldn't

TargetList.Cell(TargetList.LastIndex,1)=f.absolutepath

give me the absolutepath of the folderitem for that key?

All My Best,
Jeffrey


on 3/19/06 10:28 AM, Joe Huber at [EMAIL PROTECTED] wrote:

> Sure that's fine with me.
> 
> BTW I wasn't following this thread, but it seems that you want to
> associate some kind of data with each row in a listbox. Is that right?
> 
> You might consider the CellTag property. It lets you store any kind
> of data along with each cell of a listbox. Might that help you better
> keep an association of listbox rows with your other data?
> 
> Regards,
> Joe Huber
> 
> 
>> Um.
>> 
>> Looks like you were entirely correct.
>> 
>> Now that I'm able to examine the Path to each item, they appear to be
>> completely wrong.
>> 
>> Here's the code I'm using:
>> 
>>   //Find missing files in the Dictionaries
>>   If SourceDictionary.Count > 0 then
>>     sourceDictCnt = SourceDictionary.Count - 1
>>    
>>     For j = 0 to sourceDictCnt
>>       If not TargetDictionary.HasKey(SourceDictionary.Key(j)) then
>>         TargetList.AddRow SourceDictionary.Key(j)
>>         f=SourceDictionary.Value(SourceDictionary.Key(j))
>>                 
>> TargetList.Cell(TargetList.LastIndex,1)=ReplaceAll(f.absolutepath,":","/")
>>         TargetList.Cell(TargetList.LastIndex,2)=getPermissions(f)
>>         TargetList.cellTag(TargetList.lastIndex,0)=1
>>         TargetList.cellTag(TargetList.lastIndex,1)=1
>>         TargetList.cellTag(TargetList.lastIndex,2)=1
>>         missing=missing+1
>>       End If
>>     Next
>>   End If
>> 
>> I earlier place the folderitem into the dictionary as a value, using the
>> filename as the key.
>> 
>> Also -- I appreciate very much you're helping me with this by email. But I
>> think this actually might be of benefit to others as well. With your
>> permission, I'd like to post this to the list (I'll wait to hear from you to
>> post it).
>> 
>> All My Best,
>> Jeffrey
>> 
>> 
>> on 3/19/06 9:14 AM, Joe Huber at [EMAIL PROTECTED] wrote:
>> 
>>>>  It *seemed* to be working so far. But I obviously need to check.
>>> 
>>>  Yes, it's very likely to keep the same order, but not guaranteed to do so.
>>> 
>>>  Arrays are ordered lists, but dictionaries are associative lists
>>>  without any particular order. The main reason the dictionary has an
>>>  index is so that you can readout all the values (in whatever order
>>>  they come out) to store them somewhere.
>>> 
>>>>  Do you know how to get a cell to be editable when double-clicked?
>>> 
>>>  Set Listbox.ColumnType or Listbox.CellType to 3, which means editable.
>>> 
>>>  Regards,
>>>  Joe Huber
> 


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to