E Eng. Nizar Member Jan 7, 2024 #1 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
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 Jan 8, 2024 #2 Eng. Nizar said: error: Static code modules cannot handle events. How to use it in my code module? Click to expand... you can NOT use waitfor in a code module. Add the code to a class or an activity/b4xpage Upvote 0
Eng. Nizar said: error: Static code modules cannot handle events. How to use it in my code module? Click to expand... you can NOT use waitfor in a code module. Add the code to a class or an activity/b4xpage
josejad Expert Licensed User Longtime User Jan 8, 2024 #5 Maybe this one you get using the search box Msgbox2Async why doesn't it wait In a class I have this: Sub ShowMsg(strPrompt As String, _ strTitle As String, _ iTitleColour As Int, _ iPromptColour As Int, _ csPrompt As CSBuilder, _ bmpIcon As Bitmap, _ bCancelable As Boolean, _ bWait As Boolean) Dim csTitle... www.b4x.com Upvote 0
Maybe this one you get using the search box Msgbox2Async why doesn't it wait In a class I have this: Sub ShowMsg(strPrompt As String, _ strTitle As String, _ iTitleColour As Int, _ iPromptColour As Int, _ csPrompt As CSBuilder, _ bmpIcon As Bitmap, _ bCancelable As Boolean, _ bWait As Boolean) Dim csTitle... www.b4x.com
B Brian Dean Well-Known Member Licensed User Longtime User Jan 8, 2024 #6 is there an example please Click to expand... If you want a simple example of using Msgbox2Async then look at this ... Attachments MsgBox.zip MsgBox.zip 9.1 KB · Views: 393 Upvote 0
is there an example please Click to expand... If you want a simple example of using Msgbox2Async then look at this ...
E Eng. Nizar Member Jan 9, 2024 #7 Thank you, Sorry, it seems My aim was in my mind only...! But i ask for another Problem [CODE lang="b4x" title="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[/CODE] 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: Jan 9, 2024 Upvote 0
Thank you, Sorry, it seems My aim was in my mind only...! But i ask for another Problem [CODE lang="b4x" title="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[/CODE] So I want (get_YNCmsg) to Do it in Code Module (my Aim to replace Mesgbox2 with Msgbox2Async . Note: In Mesgbox2 is OK
E Eng. Nizar Member Jan 9, 2024 #8 mistake in line 20 : getit =Nc.msgtest(Msg) instead of getit =Nc.msgtest("Y, C or N") Upvote 0