Android Question Msgbox ???

SoyEli

Active Member
Licensed User
Longtime User
I'm having a bit of a problem understanding how to re-wright "msgbox("Msg","")
I tried;
Globals
Dim Id As CustomDialog


Dim sf As Object = Id.ShowAsync("", "Enter your name", "Ok", "", "Cancel", Null, False)
Wait For (sf) Dialog_Result(Result As Int)
If Id.Result = DialogResponse.POSITIVE Then
Log(Id.Input)
End If

doesn't work,
I'm doing something wrong.
I'm getting warnings "Main - 233: Msgbox and other modal dialogs are deprecated. Use the async methods instead. (warning #34)"
with the old "Msgbox("Msg","")

some help would be greatly appreciated!

Thank you,

C
 

Peter Simpson

Expert
Licensed User
Longtime User
@SoyEli you've been a member of this community longer than I have, why are you not using code tags?

B4X:
MsgboxAsync("Message", "Title")
    Wait For MsgBox_Result (Result As Int)
    If Result = DialogResponse.POSITIVE Then <DO WHATEVER>
 
Last edited:
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
@SoyEli you've been a member of this community longer than I have, why are you not using code tags?

B4X:
MsgboxAsync("Message", "Title")
    Wait For MsgBox_Result (Result As Int)
    If Result = DialogResponse.POSITIVE Then <DO WHATEVER>

Errr - that would be Msgbox2Async... :)

But in this case, I think a B4XDialog from XUI Views would be required, as it appears from the OP example that some kind of user input is required.


- Colin.
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
some help would be greatly appreciated
To follow up on Colin and Peter's advice, here is a complete example code. You need the XUI Views library checked.
B4X:
Sub Globals
    Private Dialog As B4XDialog   'need XUI Views lib checked
    Private XUI As XUI
    Private InputTemplate As B4XInputTemplate
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Dialog.Initialize (Activity)
    InputTemplate.Initialize
    InputTemplate.lblTitle.Text = "Enter you name"
    InputTemplate.mBase.Color=XUI.Color_Red
    Wait For (Dialog.ShowTemplate(InputTemplate, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        Log(InputTemplate.Text)  'displays what you entered in the box
    End If
End Sub
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
To follow up on Colin and Peter's advice, here is a complete example code. You need the XUI Views library checked.
B4X:
Sub Globals
    Private Dialog As B4XDialog   'need XUI Views lib checked
    Private XUI As XUI
    Private InputTemplate As B4XInputTemplate
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Dialog.Initialize (Activity)
    InputTemplate.Initialize
    InputTemplate.lblTitle.Text = "Enter you name"
    InputTemplate.mBase.Color=XUI.Color_Red
    Wait For (Dialog.ShowTemplate(InputTemplate, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        Log(InputTemplate.Text)  'displays what you entered in the box
    End If
End Sub

Mahares,
Thanks, a great answer before I even knew I needed a question. :)
Regards Roger
 
Upvote 0
Top