B4J Question Force refresh

ziomorgan

Active Member
Licensed User
Longtime User
B4X:
Sub SearchFolder(FolderPath As String, sTMPFileName As String)
   Try
     ' force refresh
     lblStatus.Text = "ELABORO <" & FolderPath & ">"
     If File.Exists(FolderPath, "") = True Then
       If File.IsDirectory("", FolderPath) Then
         lFolderChecked = lFolderChecked + 1
         Dim FilesFound As List = File.ListFiles(FolderPath)
         If FilesFound.IsInitialized = True Then
           If FilesFound.Size > 0 Then
             For i = 0 To FilesFound.Size - 1
               ' force refresh
               lblStatus.Text = "ELABORO <" & FilesFound.Get(i) & ">"
               If File.IsDirectory(FolderPath, FilesFound.Get(i)) = True Then
                 lFolderChecked = lFolderChecked + 1
                 Dim sFileFolderName As String = FilesFound.Get(i)
                 If sFileFolderName.ToUpperCase.StartsWith(sTMPFileName) AND _
                  sFileFolderName.ToUpperCase.EndsWith(".RDC") Then
                     ExtractEDL(sFileFolderName, sTMPFileName)
                 Else
                   SearchFolder(FolderPath & "/" & sFileFolderName, sTMPFileName)
                 End If
               Else
                 lFileChecked = lFileChecked + 1
               End If
             Next
           End If
         End If
       Else
         lFileChecked = lFileChecked + 1
       End If
     End If
   Catch
   End Try
End Sub

This is the code, below the "force refresh" comment the line where i want force refresh of label
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I recommend you to break this code into multiple subs. It will be more readable / maintainable.

Updating the label in this loop will not work very good as it will probably be updated too fast for the user to be able to see it.

However what you can try is to take all the code after the 'force refresh comment and put it in another sub. Now use CallSubDelayed to call this sub.
 
Upvote 0
Top