Hello,
I’m new to Xojo.
I have tried & finished the Desktop QuickStart & Desktop Tutorial.
As an exercise, I want to create an app that listed OS Special Directories inside a list box.
Here’s the code:
[code]ListDirs.ColumnCount = 2
ListDirs.HasHeading = True
ListDirs.Heading(0) = “Key”
ListDirs.Heading(1) = “Value”
Dim dirs() As String
dirs = Array(“ApplicationData”, “Applications”, “Bin”, “Cookies”, “CurrentWorkingDirectory”, “Desktop”, “Documents”, “Etc”, “Extensions”, “Favorites”, “Fonts”, “History”, “Home”, “InternetCache”, “Library”, “Mount”, “Movies”, “Music”, “NetworkPlaces”, “Pictures”, “Preferences”, “Printers”, “RecentItems”, “SBin”, “SendTo”, “SharedApplicationData”, “SharedApplications”, “SharedDesktop”, “SharedDocuments”, “SharedFavorites”, “SharedPreferences”, “SharedStartupItems”, “SharedTemplates”, “StartupItems”, “System”, “Templates”, “Temporary”, “Trash”, “UserBin”, “UserHome”, “UserLibrary”, “UserSBin”, “Var”, “VarLog”, “Windows”)
For Each dir As String In dirs
ListDirs.AddRow dir
Dim name As FolderItem
name = SpecialFolder.dir
If name <> Nil Then
ListDirs.Cell(ListDirs.LastIndex, 1) = name.AbsolutePath
End If
Next[/code]
As you can see, I’m passing the variable dir to SpecialFolder method(?)
Which doesn’t work.
The question, how do you pass variable to SpecialFolder? Or if I’m doing it wrong, what’s the proper way to do this?
Second minor question is: is there a better way to assigning lots of values to an array?
I’m not a fan of the first method as in the examples in Xojo Docs.
But using the second method, Xojo doesn’t seem to allow new line in the middle of the assignment. Even using backslash.
(By the way, how do you wrap code in Xojo editor?)