In the Xojo documentation, it’s written an example :
Dim dir As FolderItem = SpecialFolder.Desktop
Dim dirCount As Integer = dir.Count
For itemIdx As Integer = 1 To dirCount
Dim item As FolderItem = dir.TrueItem(itemIdx)
If item <> Nil Then
ListBox1.Addrow(item.Name)
End If
Next
I don’t understand how item can be Nil.
But it’s not the only things which is strange.
I have a folder in which I create subfolder, and I take all those subfolders to make a menu.
If A do :
Fin_iNbre = MyParentFolder.Count ' Folder in which I create my subfolder
For iNbre = 1 to Fin_iNbre
MySubFolder = MyParentFolder.TrueItem(iNbre)
If not(MySubFolder = Nil) Then MyMenu.Addrow MySubFolder.Name
Next iNbre
The subfolder I just created is not there, even if I launch this in a Timer after have created my SubFolder.
But if I do :
Fin_iNbre = Min(MyParentFolder.Count, 2) ' Folder in which I create my subfolder
For iNbre = 1 to Fin_iNbre ' I do not need to loop in all items, just 1 or 2 (I loop 2)
MySubFolder = MyParentFolder.TrueItem(iNbre) ' I don't do anything, just call a item in my ParentFolder
Next iNbre
Fin_iNbre = MyParentFolder.Count ' Folder in which I create my subfolder
For iNbre = 1 to Fin_iNbre
MySubFolder = MyParentFolder.TrueItem(iNbre)
If not(MySubFolder = Nil) Then MyMenu.Addrow MySubFolder.Name
Next iNbre
It’s ok, I have the folder I juste created and I do not need to launch it in a timer, I can do that just after create my SubFolder.
I just wonder why it works. I don’t like when my application doesn’t work and I don’t know why, but I always finish to find the problem. I dislike when I application work and I never know why.
Edit : I forget to mention I’m under Mac OS X El Capitan.