Android Question An error : Msgbox2Async + Wait for

Hi,
When I use : Msgbox2Async + Wait for message_Result (Result As Int)
in my code module
error: Static code modules cannot handle events.
How to use it in my code module?
thanks
 

DonManfred

Expert
Licensed User
Longtime User
error: Static code modules cannot handle events.
How to use it in my code module?
you can NOT use waitfor in a code module.

Add the code to a class or an activity/b4xpage
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Maybe this one you get using the search box

 
Upvote 0
Thank you,
Sorry, it seems My aim was in my mind only...!
But i ask for another Problem

Problem is ::
'  in Class Module (Class1):
Sub msgtest(msg As String) As ResumableSub ' Can't be String
    Private xui As XUI
    xui.Msgbox2Async(msg, "Test Me", "Yes", "Cancel", "No", Null)
    Wait For Msgbox_Result(result As Int)
    If result = xui.DialogResponse_Positive Then
        Return "Y"
    else If result = xui.DialogResponse_Negative Then
        Return "N"
    Else
        Return "C"
    End If
End Sub

'  in Code Module (test):
Sub get_YNCmsg(Msg As String) As String
    Dim Nc As class1
    Nc.Initialize
    Dim getit As String
    getit =Nc.msgtest("Y, C or N")
'Error is in getit:
'test - 20..: Cannot cast Type: {Type=ResumableSub,Rank=0, RemoteObject=True} To: {Type=String,Rank=0, RemoteObject=True}
'test - 20..: Object converted To String. This Is probably a programming mistake. (warning #7)
    Return getit
End Sub

'  I want to Use:
dim what as string = get_YNCmsg ("test it") 'Result : Y, N or C

So I want (get_YNCmsg) to Do it in Code Module (my Aim to replace Mesgbox2 with Msgbox2Async .
Note: In Mesgbox2 is OK
 
Last edited:
Upvote 0
Top