Android Question MSGBOX with options

Intelemarketing

Active Member
Licensed User
Longtime User
I have been hunting for hours for a Message Box which performs like a VB6 Message Box - ie, Has Options Cancel, Yes, No etc
My last discovery is this

Dim res As Int = fx.Msgbox2(MainForm, "Do you want to save changes?", "Save", _
"Yes", "Cancel", "No", fx.MSGBOX_WARNING)
If res = fx.DialogResponse.POSITIVE Then
Log("Saving changes...")
End If

What is fx please ? (How is it defined)
Is this the best one to use or is there something as simple as the VB6 Message Box ?
 

mangojack

Well-Known Member
Licensed User
Longtime User
MsgBoxAsync2
Capture.PNG



might be of interest , example with WaitFor.
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
The MsgBox2 you mentioned is from B4J and it looks like you want to use it because it includes built-in bitmap images like VB6 had.

Unfortunately, B4A does not include built-in icons, so you will have to find an image you like (or use fontawsome/material) characters and convert to BMP and load them into the dialog:

B4X:
Dim Result As Int
Msgbox2Async("Do you want to save changes?", "Dialog Title", "Yes", "Cancel", "No", [bitmap Or Null] , True)
Wait For MsgBox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
    Log("Saving changes...")
End If
 
Last edited:
Upvote 0

Intelemarketing

Active Member
Licensed User
Longtime User
Out of interest, I have 3 Message Boxes - One after the other
3 message boxes in a row:
    MsgboxAsync("Scale = " & MyScale &  Chr(13) & Chr(10) & "Height = " & MyHeight & Chr(13) & Chr(10) &  "Width = " & MyWidth ,"Result")
    
    PhoneNo = Phone.GetPhoneType
    MsgboxAsync("Phone = " & PhoneNo, "phone type")
    
    xui.Msgbox2Async("Question?", "Title", "Yes", "Cancel", "No", Null)

They are in a Button Click event - I am just playing around with the different Message Boxes I have found

Why would the last one (xui.Msgbox2Async) display first, followed by the second one (MsgboxAsync), then finally the first one (MsgboxAsync) displays last ie, In reverse order

Is this correct ?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Out of interest, I have 3 Message Boxes - One after the other
3 message boxes in a row:
    MsgboxAsync("Scale = " & MyScale &  Chr(13) & Chr(10) & "Height = " & MyHeight & Chr(13) & Chr(10) &  "Width = " & MyWidth ,"Result")
  
    PhoneNo = Phone.GetPhoneType
    MsgboxAsync("Phone = " & PhoneNo, "phone type")
  
    xui.Msgbox2Async("Question?", "Title", "Yes", "Cancel", "No", Null)

They are in a Button Click event - I am just playing around with the different Message Boxes I have found

Why would the last one (xui.Msgbox2Async) display first, followed by the second one (MsgboxAsync), then finally the first one (MsgboxAsync) displays last ie, In reverse order

Is this correct ?
My Bad, when using the Async MsgBox' you need to use "Wait For".

I updated my post #6 to reflect this.
 
Last edited:
Upvote 0

Intelemarketing

Active Member
Licensed User
Longtime User
Got it right now - the "Wait For" makes all the difference
Thank you all for your valuable lesson on Message Boxes
 
Upvote 0
Top