You might need to reverse your Dictionary entries.
Since you're using the Name of the file as the Key (I think), instead try
using the FolderItem as the Key. Place the Name in the Value.
I've done something similar. Might not be the best way, but seems to work.
I think dropping the Dictionary and using an array of FolderItems might be a
better idea. You can derive the name from the FolderItem very easily,
though Dictionary might end up being faster?
I looped through the dropped items and added them as FolderItems to an array
in a module.
The module also had two properties: inputArray() as FolderItem and
picDictionary as Dictionary.
The module also has a method named ProcessDrop:
Dim picDictionaryTemp as New Dictionary
Dim i As Integer
For i = 0 to Ubound(inputArray)
picDictionaryTemp.Value(inputArray(i).Name) = inputArray(i)
Next
picDictionary = picDictionaryTemp
DropObject of the Canvas:
If obj.FolderItemAvailable then
If picDictionary <> nil then
picDictionary.Clear
End If
Do
picDrop.inputArray.Append obj.FolderItem
Loop Until Not obj.NextItem
End If
picDrop.ProcessDrop
PushButton1 action (for the 'search'):
dim picItem as FolderItem
dim i as Integer
If picDictionary.HasKey(EditField1.Text) then
For i =0 to picDictionary.Count -1
If picDictionary.Key(i) = EditField1.Text then
picItem=picDictionary.Value(picDictionary.Key(i))
Canvas1.Backdrop = picItem.OpenAsPicture
End If
Next
End If
Little error checking has been added, so be careful.
HTH
_______________________________________________
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>