Hi guys,
So, I have a very good looking button that when clicked shows a DirectoryChooser...
The Goal is to List all files and folders starting from what is chosen in the DirectoryChooser, and it works very well, except if I try to select "C:\" as a starting point...
No errors to log, it just freezes and becomes unresponsive.
As I came to understand it, it just take much much time to list it all...
ISo, tried to implement some kind of "busy" indication, but it either blocks the "busy" animation, or the sub just takes way more time to complete..
Here is my sub:
How would you suggest I implement this "busy" visual indicator?
(I have tried @Star-Dust Loading indicators, but they either freeze or don't even show)
So, I have a very good looking button that when clicked shows a DirectoryChooser...
The Goal is to List all files and folders starting from what is chosen in the DirectoryChooser, and it works very well, except if I try to select "C:\" as a starting point...
No errors to log, it just freezes and becomes unresponsive.
As I came to understand it, it just take much much time to list it all...
ISo, tried to implement some kind of "busy" indication, but it either blocks the "busy" animation, or the sub just takes way more time to complete..
Here is my sub:
B4X:
Private Sub Button1_Click
TreeTableView1.Root.Children.Clear
Dim dc As DirectoryChooser
dc.Initialize
dc.Title = "Sélectionner un dossier"
'open Last path
Dim pSaved As String
If File.Exists(File.DirApp,"path.txt") Then
pSaved = File.ReadString(File.DirApp, "path.txt")
dc.InitialDirectory = pSaved
End If
rootDir = dc.Show(Main.MainForm)
If rootDir = "" Then
Return
Else
AddFolder(TreeTableView1.Root, rootDir)
'Save the current Path
File.WriteString(File.DirApp, "path.txt", rootDir)
End If
End Sub
Sub AddFolder(Parent As TreeTableItem, Folder As String)
If File.ListFiles(Folder).IsInitialized = False Then
Return
Else
PathLabel1.Text = " " & Folder
End If
For Each f As String In File.ListFiles(Folder)
Dim tti As TreeTableItem
Dim Name As String = f
Dim Size As String = $"$1.0{File.Size(Folder, f) / 1024} KB"$
Dim Date As String = $"$DateTime{File.LastModified(Folder, f)}"$
tti.Initialize("tti", Array(Name, Size, Date))
Parent.Children.Add(tti)
If File.IsDirectory(Folder, f) Then
AddFolder(tti, File.Combine(Folder, f))
tti.Expanded = False
End If
Next
End Sub
How would you suggest I implement this "busy" visual indicator?
(I have tried @Star-Dust Loading indicators, but they either freeze or don't even show)
Last edited: