JesseW Active Member Licensed User Longtime User Oct 11, 2021 #1 Erel says: Call B4XPages.ClosePage(Me) instead of Activity.Finish. Click to expand... this doesn't work. to demonstrate, I opened a brand new b4xpages project from b4a 11.0 and changed the button click event from B4X: Private Sub Button1_Click xui.MsgboxAsync("Hello world!", "B4X") End Sub to B4X: Private Sub Button1_Click wait for (xui.MsgboxAsync("Hello world!", "B4X")) complete (o As Object) B4XPages.ClosePage(Me) End Sub and when you touch the button, the dialog disappears and goes back to the mainpage with the button. nothing closes. I've been trying to find a way to close a b4xpages app so it can be restarted by the user to reload all the data from scratch. A more elegant solution would be to restart a page, but as far as I can tell, only an activity can be restarted, and I can't see how to do that from within a b4xpage. thanks in advance!
Erel says: Call B4XPages.ClosePage(Me) instead of Activity.Finish. Click to expand... this doesn't work. to demonstrate, I opened a brand new b4xpages project from b4a 11.0 and changed the button click event from B4X: Private Sub Button1_Click xui.MsgboxAsync("Hello world!", "B4X") End Sub to B4X: Private Sub Button1_Click wait for (xui.MsgboxAsync("Hello world!", "B4X")) complete (o As Object) B4XPages.ClosePage(Me) End Sub and when you touch the button, the dialog disappears and goes back to the mainpage with the button. nothing closes. I've been trying to find a way to close a b4xpages app so it can be restarted by the user to reload all the data from scratch. A more elegant solution would be to restart a page, but as far as I can tell, only an activity can be restarted, and I can't see how to do that from within a b4xpage. thanks in advance!
angel_ Well-Known Member Licensed User Longtime User Oct 11, 2021 #2 It works for me, upload an example Upvote 0
JesseW Active Member Licensed User Longtime User Oct 11, 2021 #3 angel_ said: It works for me, upload an example Click to expand... an example isn't really needed because only a single line was changed, and one line added. but here ya go. thx Attachments b4a example.zip b4a example.zip 13.9 KB · Views: 415 Upvote 0
angel_ said: It works for me, upload an example Click to expand... an example isn't really needed because only a single line was changed, and one line added. but here ya go. thx
angel_ Well-Known Member Licensed User Longtime User Oct 11, 2021 #4 Try this: B4X: Private Sub Button1_Click xui.Msgbox2Async("Close?", "", "Yes", "", "No", Null) Wait For Msgbox_Result (Result As Int) If Result = xui.DialogResponse_Positive Then B4XPages.ClosePage(Me) End If End Sub Upvote 0
Try this: B4X: Private Sub Button1_Click xui.Msgbox2Async("Close?", "", "Yes", "", "No", Null) Wait For Msgbox_Result (Result As Int) If Result = xui.DialogResponse_Positive Then B4XPages.ClosePage(Me) End If End Sub
JesseW Active Member Licensed User Longtime User Oct 11, 2021 #5 that works, thank you! I am at awe over the power b4x has, but I can find very little information on how to use the Wait For command. I searched for almost an hour before I ran across Erel's b4j thread explaining resumable subs, and all I could get from it is an event name was to follow the Wait For statement. @angel_ , How did you know to use MsgBox_Result after your Wait For? what am I missing??? Upvote 0
that works, thank you! I am at awe over the power b4x has, but I can find very little information on how to use the Wait For command. I searched for almost an hour before I ran across Erel's b4j thread explaining resumable subs, and all I could get from it is an event name was to follow the Wait For statement. @angel_ , How did you know to use MsgBox_Result after your Wait For? what am I missing???
JesseW Active Member Licensed User Longtime User Oct 11, 2021 #6 I just figured out that you can write it like this as well... B4X: Private Sub Button1_Click Wait For (xui.Msgbox2Async("Close?", "", "Yes", "", "No", Null)) Msgbox_Result(Result As Int) If Result = xui.DialogResponse_Positive Then B4XPages.ClosePage(Me) End If End Sub encapsulating the asynchronous call in parenthesis followed by the event name with its return parameters. The return parameters are optional, by the way, if you don't need to know which button was pressed. Upvote 0
I just figured out that you can write it like this as well... B4X: Private Sub Button1_Click Wait For (xui.Msgbox2Async("Close?", "", "Yes", "", "No", Null)) Msgbox_Result(Result As Int) If Result = xui.DialogResponse_Positive Then B4XPages.ClosePage(Me) End If End Sub encapsulating the asynchronous call in parenthesis followed by the event name with its return parameters. The return parameters are optional, by the way, if you don't need to know which button was pressed.
klaus Expert Licensed User Longtime User Oct 11, 2021 #7 JesseW said: I searched for almost an hour before I ran across Erel's b4j thread explaining resumable subs Click to expand... Did you have a look at chapter 5.7 Resumable Subs in the B4X Basic Language booklet ? Upvote 0
JesseW said: I searched for almost an hour before I ran across Erel's b4j thread explaining resumable subs Click to expand... Did you have a look at chapter 5.7 Resumable Subs in the B4X Basic Language booklet ?
JesseW Active Member Licensed User Longtime User Oct 11, 2021 #8 klaus said: Did you have a look at chapter 5.7 Resumable Subs in the B4X Basic Language booklet ? Click to expand... sorry, I didn't know to look there. I was looking for Wait For. I'll definitely have a look. It sounds very intriguing. thanks klaus!!! Upvote 0
klaus said: Did you have a look at chapter 5.7 Resumable Subs in the B4X Basic Language booklet ? Click to expand... sorry, I didn't know to look there. I was looking for Wait For. I'll definitely have a look. It sounds very intriguing. thanks klaus!!!