A Alex_197 Well-Known Member Licensed User Longtime User Jun 1, 2020 #1 Hi all. I have a question - is there any way other then manually to replace MsgBox and MsgBox2 that already in my code? I know that I can replace them with MsgBoxAsync and MsgBoxAsync2 but I want MsgBoxAsync to do the same as MsgBox does. I understand a difference between them and I know that I can add Wait For next to MsgBoxAsync line. But doing so in many places in my code will take a lot of time. So my question is - is there any way to do something similar to Code: Copy Public Sub MsgBox(str As String,strTitle As String) MsgboxAsync(str,strTitle) Wait For Msgbox_Result (Result As Int) If Result = DialogResponse.POSITIVE Then Log("BBB " & DateTime.Now) End If End Sub I tried to do so in static module - got an error that msgbox is not valid identifier. Well, tried to change it to Code: Copy Public Sub MsgBoxNew(str As String,strTitle As String) MsgboxAsync(str,strTitle) Wait For Msgbox_Result (Result As Int) If Result = DialogResponse.POSITIVE Then Log("BBB " & DateTime.Now) End If End Sub and then replace all lines with MsgBox to MsgBoxNew. Didn't work either - static module can't handle events. It does work in class but it will require me to add a reference to this class in every activity and in static modules. Thanks
Hi all. I have a question - is there any way other then manually to replace MsgBox and MsgBox2 that already in my code? I know that I can replace them with MsgBoxAsync and MsgBoxAsync2 but I want MsgBoxAsync to do the same as MsgBox does. I understand a difference between them and I know that I can add Wait For next to MsgBoxAsync line. But doing so in many places in my code will take a lot of time. So my question is - is there any way to do something similar to Code: Copy Public Sub MsgBox(str As String,strTitle As String) MsgboxAsync(str,strTitle) Wait For Msgbox_Result (Result As Int) If Result = DialogResponse.POSITIVE Then Log("BBB " & DateTime.Now) End If End Sub I tried to do so in static module - got an error that msgbox is not valid identifier. Well, tried to change it to Code: Copy Public Sub MsgBoxNew(str As String,strTitle As String) MsgboxAsync(str,strTitle) Wait For Msgbox_Result (Result As Int) If Result = DialogResponse.POSITIVE Then Log("BBB " & DateTime.Now) End If End Sub and then replace all lines with MsgBox to MsgBoxNew. Didn't work either - static module can't handle events. It does work in class but it will require me to add a reference to this class in every activity and in static modules. Thanks
Erel B4X founder Staff member Licensed User Longtime User Jun 1, 2020 #2 Your code cannot work at all. It doesn't do anything useful. Watch the resumable subs video tutorial and you will understand. Upvote 0
Your code cannot work at all. It doesn't do anything useful. Watch the resumable subs video tutorial and you will understand.