Delay

joneden

Active Member
Licensed User
Longtime User
Hi All,

Is there a delay command available? I need to implement a blocking delay of about 1/2 a second or longer...

Regards,

Jon
 

joneden

Active Member
Licensed User
Longtime User
Thanks for that - the delay works a treat but doesn't solve my issue sadly.

After a customdialog closes I try to initiate a progressbardialog and normally it works, however after it I then check the username/password. The dialog doesn't appear.

When debugging if I put a breakpoint in before the show ProgressDialogShow2 command it works.. So I wondered if the delay was needed to allow the displog time to show or something....

Really odd :(

Regards,

Jon
 
Upvote 0

joneden

Active Member
Licensed User
Longtime User
Hi Guys,

I'd already tried the DoEvents command and no luck there :(

I've pasted the code below - I've removed some code that was irrelevant. The ShowLoginScreen shows the customdialog then returns the relevant button press. The loop can then carry on till the user abandons the logon or enters the correct details.

Regards,

Jon


B4X:
Dim returnValue As Int
Dim objBCrypt As BCrypt 
   returnValue = ShowLoginScreen(False)
   Dim okToMoveOn As Boolean : okToMoveOn = False   
   Do While Not(okToMoveOn)
      If returnValue = DialogResponse.POSITIVE Then
         ShowProgress
         DoEvents 
         If objBCrypt.checkpw(passwordToCheck,passwordHashString) Then
         'Some irrelevant code but okToMoveOn set to true to exit loop
         Else
         'Some irrelevant code
         End If
      Else
         'Some irrelevant code but okToMoveOn set to true to exit loop
      End If
   Loop
 
Upvote 0

joneden

Active Member
Licensed User
Longtime User
Hi Erel,

Many thanks - multiple doevents did the trick!

The code for ShowProgress was copied from your suggestion in another post, not that I added some code to ensure that it is not redisplayed if it's already displayed...

Thanks for your help!

Jon

B4X:
Sub ShowProgress
   Log("Show progress started")
   ' Don't reshow if already running (reshow is a visible switch)
   If ProgressBarVisible = False Then
      ProgressBarVisible = True
      ProgressDialogShow2("Please wait loading...", False)
      DoEvents 
   End If
End Sub
 
Upvote 0
Top