Why not use GameViewHelper as Erel said? it is easy to use.
B4X:
Private gvh As GameViewHelper
gvh.AddKeyListener("GVH", MainForm)
Sub GVH_KeyPressed (KeyCode As String) As Boolean
Log(KeyCode)
Return True
End Sub
Sub GVH_KeyReleased (KeyCode As String) As Boolean
Log(KeyCode)
Return True
End Sub
Why not use GameViewHelper as Erel said? it is easy to use.
B4X:
Private gvh As GameViewHelper
gvh.AddKeyListener("GVH", MainForm)
Sub GVH_KeyPressed (KeyCode As String) As Boolean
Log(KeyCode)
Return True
End Sub
Sub GVH_KeyReleased (KeyCode As String) As Boolean
Log(KeyCode)
Return True
End Sub
I guess what you want to capture is closeRequest event, if it is ture, the below code maybe help you.
B4X:
Private Sub B4XPage_CloseRequest As ResumableSub
Dim sf As Object = xui.Msgbox2Async("Close?", "Title", "Yes", "Cancel", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
Return True
End If
Return False
End Sub
I guess what you want to capture is closeRequest event, if it is ture, the below code maybe help you.
B4X:
Private Sub B4XPage_CloseRequest As ResumableSub
Dim sf As Object = xui.Msgbox2Async("Close?", "Title", "Yes", "Cancel", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
Return True
End If
Return False
End Sub