Open File dialog - When this dialog first opens, folders have no "+" icon to browse into subfolders until you click around. Then they start to appear but only on folders that you click on.
To illustrate .. when this dialog opens, I get the following screen after clicking the "Storage Card" folder:
.. And it’s only after clicking "Documents and Settings" and then AGAIN on "Storage Card" that I can browse the Storage Card:
How can I make this code better. Code originally created by Erel. I assume it doesn't know if there are sub folders until you click on a folder, hence saving processor time.
However I guess the main problem is when the user first selects a folder nothing happens, you need to click a different folder first.
This only seems to happen on the PPC.
To illustrate .. when this dialog opens, I get the following screen after clicking the "Storage Card" folder:
.. And it’s only after clicking "Documents and Settings" and then AGAIN on "Storage Card" that I can browse the Storage Card:
How can I make this code better. Code originally created by Erel. I assume it doesn't know if there are sub folders until you click on a folder, hence saving processor time.
However I guess the main problem is when the user first selects a folder nothing happens, you need to click a different folder first.
This only seems to happen on the PPC.
B4X:
'FolderChooser is an example of using the TreeView library.
'The folder nodes are added the first time the user presses on a folder.
Sub Globals
Dim root
End Sub
Sub App_Start
If cPPC=True Then root="\" Else root = SubString(AppPath,0,3)
Form1.show
tree.new1("form1",5,5,230,200)
tree.AddImage1(AppPath & "\folder.bmp")
tree.AddImage1(AppPath & "\openFolder.bmp")
tree.ImageMode = True
tree.ImageIndex = 0 'sets all nodes to display the folder icon
tree.SelectedImageIndex = 1 'sets the selcted node (each time) to display the open folder icon
node1.new1
node2.new1
FindFolders("\","tree")
End Sub
Sub FindFolders (path, node) 'Finds all folders in a specific path
WaitCursor(True)
al1.clear
DirSearch(al1,path)
c = StrLength(path)
For I =0 To al1.count - 1
s=al1.item(i)
If node = "tree" Then
tree.AddNewNode(SubString(s,c,StrLength(s)-c))
Else
Control(node,Node).AddNewNode (SubString(s,c,StrLength(s)-c))
End If
Next
If node = "tree" Then
tree.ExpandAll
Else
Control(node,Node).Expand
End If
WaitCursor(False)
End Sub
Sub tree_AfterSelect
If tree.action <> "bymouse" Then Return 'If the event was not raised by the user
'When the user presses on a node, search for all folders inside.
node2.value = tree.selectednode
node1.value = tree.selectednode
Dim s
If node2.count = 0 Then 'If it is not 0 then the it was already opened
Do Until IsNull(node2.Value) = True 'Find the full path of the current node
s = node2.text & "\" & s
node2.value = node2.parent
Loop
FindFolders(root & s,"node1")
End If
End Sub