Application Paused

stu14t

Active Member
Licensed User
Longtime User
How do I stop the user closing (or pausing the application) before saving all data gathered, or at least giving the choice and reminder to do that?

Here is the code i'm attempting to convert from VB.Net. I understand that message boxes can't be used in the Application_Paused event.
B4X:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        Dim msg


        If Unsaved And TestPoint > 2 = True Then
            msg = "The Current Data Has Not Been Saved. Do You Want to Exit?"
        Else
            msg = "Do you Wish to Close the Application?"
        End If

        If MsgBox(msg, MsgBoxStyle.YesNo + MsgBoxStyle.Question, "DCP Data") = MsgBoxResult.No Then e.Cancel = True

    End Sub

Is it as easy as calling a sub from the Application_Paused event and handling it there or is there a more elegant way?

Thanks
 

mc73

Well-Known Member
Licensed User
Longtime User
You should trap the 'cancel' in activity_keypress event, then let user choose from your options. Have a look at this post.
 
Upvote 0
Top