B4J Question Sleep and CallSubDelayed (is it a limitation or a bug?)

Cableguy

Expert
Licensed User
Longtime User
I have somewhere in my code a CallSubDelayed line... It all works as expected, unless I put, in the called sub, a sleep statement...
Then, the called sub becomes resumable and the CallSubDelayed errors stating something about a "void" value...
In the warnings I get the line complaining about a "possible coding error" and that it will be converted to string...

So, this is a limitation with resumable subs, or a bug?
 

Cableguy

Expert
Licensed User
Longtime User
I will do so later today...
But just try it, a simple CallSubDelayed (Me, "mysub")
And in my sub, try a Sleep (500)...
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
This works as expected:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
   
    CallSubDelayed(Me,"Sub1")
End Sub

Private Sub Sub1
    Log("Here")
    Sleep(500)
    Log("awake")
   
End Sub
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
In b4j, any statement after mainform.show is not executed, or am I wrong?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Ok, but have you tried to place it before the main form show method?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I have now, it still works OK. The main form is very light (just one button), but the callsubdelayed call will cause sub1 not to be called until the AppStart sub has finished, wherever it is placed.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
strangely, I am unable to reproduce it either, so, I guess EREL should Close this thread
 
Upvote 0
Top