Greetings,
I have found that if the user or another app changes a folder's
contents after the built RB app launches, the first time the folder is
accessed, the contents [folderitem.item(n)] are incorrectly reported,
with nil folderitems for the removed files.
This only occurs if the file structure is changed outside of the RB-
built application. This can lead to unexpected behavior, especially if
an application watches a folder for changes.
To reproduce this, access a folderitem via RB code, then change the
folderitem's contents in the Finder. Then access the folderitem via
folderitem.item(n) and note that it returns incorrect values the first
time. This is documented and illustrated in the sample project
attached to:
<https://realsoftware.fogbugz.com/default.asp?4378_gm5u4lsa>
The simple workaround is to simply loop through the folderItem's items
before you really need them. I have added a method called
UpdateFolderItemCache that only does this:
Sub UpdateFolderItemCache(f as folderitem)
if f = nil or not f.Exists then return
dim ff as FolderItem
dim i as Integer
for i = f.Count downto 1
ff = f.Item(i)
next
End Sub
....and then folderitem.item(n) will work correctly (until the next
time the folderitem changes).
Best wishes,
Steve
=========================================================
== Stephen E. Hutson, AquilaDigital Partnership ==
== http://www.aquiladigital.us ==
=========================================================
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|