Android Question Hide Display Screen Behind MsgboxAsync

Mahares

Expert
Licensed User
Longtime User
Using a SignatureTemplate I populate 2 edittext views with random numbers and the user fills in the math answer in the 3rd edittext. After he confirms the answer, he gets the congratulatory message with MsgboxAsync and a new set of random values fill in the edittext views again to start all over.
I would like not to show the next set of numbers until he clicks ok, in other words hide the display behind the message box.
Thank you
 

Attachments

  • Congratulation.png
    Congratulation.png
    15 KB · Views: 139

LucaMs

Expert
Licensed User
Longtime User
Stupid answer? Create a panel over the other views and set its visibility as your need.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I added a panel, but no matter where I placed it in the code with a change in its visibility, it did not seem to hide the edittext boxes behind the message. So here is what I did:
After this below line:
B4X:
MsgboxAsync($"${num(0)} + ${num(1)} = ${num(2)} ${TAB} ${TAB} is the correct addition answer"$, csCongrat)
I added this code:
B4X:
Wait For MsgBox_Result (Res As Int)
                If Res= XUI.DialogResponse_Positive Then
which succeeded in hiding the edittext views that were showing behind the Msgbox, but when the edittext views reappeared after clicking 'Ok', I could not get the focus or the keyboard to show on the 3rd edittext box, unless I clicked on the 3rd edittext box to input the result, despite inserting this
B4X:
B4Xedt.RequestFocus
    IME.ShowKeyboard(B4Xedt)
:
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
ialog.OverlayColor = xui.Color_Black
Where do you place the above line in the code and have it hide the dialog screen behind the message box. I tried just about everywhere there is a hole in the code, but no effect at all. Here is part of the code:
B4X:
Dim rs As ResumableSub = Dialog.ShowTemplate(SignatureTemplate, Chr(0xF00C),"", Chr(0xF12D))   'Chr(0xF12D) is eraser
'    Dialog.OverlayColor=XUI.Color_Black
    Dialog.GetButton(XUI.DialogResponse_Positive).TextColor = XUI. Color_Green
    Dialog.GetButton(XUI.DialogResponse_Cancel).TextColor = XUI.Color_Red
    Draw   'sub to create random numbers
    Wait For (rs) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        Dim num(3) As Int
        num(0)=B4Xlbl(0).text :num(1)=B4Xlbl(1).text :num(2)=B4Xedt.text    
        If num(0)+num(1)=num(2) Then
'            Dialog.OverlayColor=XUI.Color_Black
            MsgboxAsync($"${num(0)} + ${num(1)} = ${num(2)} ${TAB} ${TAB} is the correct addition answer"$, "Congratulations")
'            Wait For MsgBox_Result (Res As Int)
'                If Res= XUI.DialogResponse_Positive Then
'                Dialog.OverlayColor=XUI.Color_Black
                btnSignature_Click
'                End If
        Else
            level=0
            MsgboxAsync($"${num(0)} + ${num(1)} = ${num(2)} ${TAB} ${TAB} is the wrong addition answer"$, "Sorry")
            Return
        End If
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I've meant that you can use B4XDialog instead of MsgboxAsync:
Still not kosher.
When the line below Dialog(Show is btnSignature_Click, it does not stop for the Ok to be clicked and the message does not show. But, when the line below DIalog(Show is Return, it does stop and the message is displayed. Please see code below:
B4X:
Wait For (rs) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        Dim num(3) As Int
        num(0)=B4Xlbl(0).text :num(1)=B4Xlbl(1).text :num(2)=B4Xedt.text  
        If num(0)+num(1)=num(2) Then
            Dialog.OverlayColor = 0xFF109419
            Dialog.Title = "Congratulations"
            Dialog.Show($"${num(0)} + ${num(1)} = ${num(2)} ${TAB} ${TAB} is the correct addition answer"$, "Ok", "", "")
            'Here it does not wait for the Ok button to be clicked. Does not display the message. BAD
            btnSignature_Click
        Else
            level=0
            Dialog.OverlayColor = XUI.Color_Red
            Dialog.Title = "Sorry"
            Dialog.Show($"${num(0)} + ${num(1)} = ${num(2)} ${TAB} ${TAB} is the wrong addition answer"$, "Ok", "", "")
            'Here it waits for the Ok button to be clicked. GOOD
            Return
        End If
    End If
 
Last edited:
Upvote 0
Top