'Back' trap pseudo modal?

enonod

Well-Known Member
Licensed User
Longtime User
I want to trap the Back button using Erel's code, when the app is quit to open a dialog as modal so it can be used before quitting. I have a Panel loaded and using visible to show/hide. I do not want to use CustomDialog2 it is too large.
Is there ANY way to stop the app quitting before the dialog shows and is used?
[EDIT] Or if I used a quit button on screen to call my non-modal, is there a way to simulate the 'Back' button by calling something after my non modal is dismissed??
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 
'return true if you want to consume the event    
   If KeyCode = KeyCodes.KEYCODE_BACK Then        
   '   If Msgbox2("Do you want to close?", "", "Yes", "Cancel", "No", Null) = DialogResponse.POSITIVE Then 
           
   ***mypnl.visible=true, plus your solution, to go in here***
         Return False
      Else            
         Return True        
      End If    
   'End If
End Sub
 
Last edited:

enonod

Well-Known Member
Licensed User
Longtime User
Thank you for your reply.
I am trying to have a dialog for high scores present itself (for long enough to fill in) before the app closes, triggered by the user choice to quit... hence my edit regarding showing my dialog and then when closing it, have a call to trigger 'Back' remotely.
If you can throw further light it will be gratefully received.
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
Thank you Erel, I missed your post.
 
Upvote 0
Top