Android Question How to prevent msgbox from closing when clicked outside of it?

Ralfs

New Member
Licensed User
Longtime User
Just a few days ago I bought Basic4Android and I am already in love with it, however, today I encountered a problem I could not find a solution anywhere.

How can I prevent msgbox/msgbox2/ProgressDialogShow from closing when clicked outside of the objects?

I mean, I have a msgbox2 being displayed with 2 options for the user to choose, but if user taps anywhere else on the screen other than the msgbox itself, it automatically disappears.
 
Last edited:

Ralfs

New Member
Licensed User
Longtime User
Thank you very much for the answer, however, the solution in post #4 does not seem to do anything.

Here's what I used:
B4X:
Sub Panel_Touch (Action As Int, X As Float, Y As Float) As Boolean 'Return True to consume the event
Return True
End Sub

I guess I will just use panels to re-enable the msgbox2 until they choose one of the options.
 
Upvote 0

qsrtech

Active Member
Licensed User
Longtime User
I have another solution if you don't need the "cancel" button
B4X:
            Dim AResponse As Int=-3
            Do While AResponse=-3
                AResponse=Msgbox2("A Message","A Title","Yes","","No",Null)
                Select Case AResponse
                    Case DialogResponse.POSITIVE
                        something=True
                    Case DialogResponse.NEGATIVE
                        something=False
                End Select
            Loop
 
Upvote 0

Ralfs

New Member
Licensed User
Longtime User
I have another solution if you don't need the "cancel" button
B4X:
            Dim AResponse As Int=-3
            Do While AResponse=-3
                AResponse=Msgbox2("A Message","A Title","Yes","","No",Null)
                Select Case AResponse
                    Case DialogResponse.POSITIVE
                        something=True
                    Case DialogResponse.NEGATIVE
                        something=False
                End Select
            Loop
Thank you very much, yours works perfectly!
By the way, do you have a similar solution for ProgressDialogShow? Nevertheless, I am happy now that I managed to make it work with the msgbox!
 
Last edited:
Upvote 0
Top