Android Question Wait for

Cenny

Active Member
Licensed User
Longtime User
Hi,

I would like to enable btNext1 after the scan has finished.
But the button is enabled while the scan is still running.
Can I solve this with Wait For?
Any idea?

Cenny


B4X:
Sub btPrepare1_Click
    If Check_Values Then
        btPrepare1.Enabled=False
        StartScan
        btNext1.Enabled=True
    End If
End Sub


B4X:
Sub StartScan

    If Check_Values=True Then
                    
        For i = StartAt To EndAt Step Stap
            Module1.SendTrimValue(i)
            servosetting=i
            lblServoSettings.Text=i
            Sleep(interval*1000)
            Decalage=sf.Left(lblDecalages.Text,lblDecalages.Text.Length-1)
            Module1.SQL1.ExecnonQuery2(strSQL2,Array As String(Module1.ModelID,Decalage,servosetting))

        Next

    End If
    
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
yes, make startscan a resumeable sub.

 
Last edited:
Upvote 0

Cenny

Active Member
Licensed User
Longtime User
yes, make startscan a resumeable sub.

yes, make startscan a resumeable sub.



Thanks for the valuable reaction.
I changed the declaration to Sub StartScan as ResumableSub and gave it a return value null.
It works fine.

B4X:
Sub btPrepare1_Click
    If Check_Values Then
        btPrepare1.Enabled=False
        Wait For(StartScan) Complete (Result As Object)
        btNext1.Enabled=True
    End If
End Sub
 
Upvote 0
Top