Android Question B4XDialog statement and question

Harris

Expert
Licensed User
Longtime User
With regards to the class of haB4XMsgBox....

https://www.b4x.com/android/forum/threads/b4x-xui-hab4xmsgbox-based-on-b4xdialog.101521/


I also find interesting in this example class, is the stacking of Wait For. No less than 3 calls here...

The first call: (any) Activity call for MsgBox...
Code:
Dim msgContent As String = "Please select your intention...."
Wait For (Dialog.Show(Chr(0xF0E7)&" Get FREE Stuff!",msgContent,Chr(0xF046), "PERHAPS LATER", "NO THANKS") ) Complete (Result As Int)
Second Wait in MsgBox class:
Code:
Public Sub Show....
Wait For (ShowCustom(p, Yes, No, Cancel)) Complete (Result As Int)
Third Wait in MsgBox class:
Code:
Public Sub ShowCustom....
Wait For CloseMessage (Result As Int) ' wait for any button press
Nice... wait, wait, wait.

BUT, what is really perplexing (interesting) is this:
Code:
Public Sub Close (Result As Int) As Boolean
If getVisible Then
CallSubDelayed2(Me, "CloseMessage", Result) ' don't know where this sub resides....
Return True
End If
Return False
End Sub
A formal declared "CloseMessage" SUB does not exist in this class???
The only reference is contained in the Sub ShowCustom... [ Wait For CloseMessage (Result As Int) ]

WT-Heck? Does the statement: [ Wait For CloseMessage (Result As Int) ] "create" a sudo-sub that CallSubDelayed2(Me,"CloseMessage", Result) can call?

Mr. @Erel , "Tear Down This Wall!" - (for my lack of comprehension).

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Please use [code]code here...[/code] tags when posting code.

2.
Does the statement: [ Wait For CloseMessage (Result As Int) ] "create" a sudo-sub that CallSubDelayed2(Me,"CloseMessage", Result) can call?
It is very similar to:
B4X:
Dim j As HttpJob
'...
Wait For JobDone (j As HttpJob)
There is no JobDone sub.

The Wait For calls intercept the events before they reach the event sub (if such sub exists).
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Thanks, now I understand. Very good explanation.

What tripped me was "there used to be" a JobDone event that we used.
 
Upvote 0
Top