MsgBox ("", 12) displays?

The LR shows the MsgBox for implies I get for 12 an Okay and Cancel buttons, but I only get an Okay button.

				If 2 = MsgBox ("There ....", 12) Then

I know with a 36 it displays Yes and No. What do I use for an Okay and Cancel buttons?

The MsgBox doc page shows that 1 is used to show OK and Cancel buttons:

Dim result As Integer = MsgBox("There...", 1)

Yes, I know. It only shows on the display an Okay button.

I suspect that value is a bit field, so maybe 0x0C only ORs to the bits for the OK button value.

If so, why does the LR show Integer for both button and return values?
Even so as hex bits, my 12 should work.

What platform?
I just tested all variations of buttons on Msgbox under OSX, and it worked in all cases exactly as the LangRef indictated.

12 is NOT a valid value

Value Description
0 Display OK button only.
1 Display OK and Cancel buttons.
2 Display Abort, Retry, and Ignore buttons.
3 Display Yes, No, and Cancel buttons.
4 Display Yes and No buttons only.
5 Display Retry and Cancel buttons.

One set of values for should be DiSPlAYED, another set for what is RETURNED
since 12 is not a valid DISPLAY value, it defaults to ZERO

I’m not sure what you mean. I just tried Mac, Windows and Linux and my code displays OK and Cancel buttons on all of them.

I don’t see how you’re even coming up with 12 as that doesn’t look like a valid combination.

the only ADDING (OR’ing) of values is to display Icons or Groups… then higher bit values are added to the Button Display value (0-5)
otherwise … DISPLAY is 0 to 5, RETURN is 1 to 7… there is no 12… no matter what you combine

36 display YES/NO AND an ICON… just as the LR says it will 4+32

I’m on Windows 10 current XOJO.
I see, I got confused. I thought the 2nd value for the icon would be separated by a comma. It’s not.
Problem solved. I left a 1 in that spot and got 2 buttons.

I’m still confused though since I had a 12. The 2 results in no icon and only an Okay button. We commonly use 36 and it shows Yes and No buttons and a question mark.

You may find it easier to construct the MessageDialog yourself (I do for the more complex dialogs.)

or use Thomas Showmessage method :

[code]Public Function ShowMessageDialog(w as Window, icon as String, actionTxt as String, cancelTxt as String, altTxt as String, msg as String, explanation as String) as Integer
'System.DebugLog "UITools.ShowMessageDialog “+msg+” – "+explanation
’ public domain by thomas templemann

dim d as new MessageDialog
dim b as MessageDialogButton

if icon = “ask” then
d.Icon = MessageDialog.GraphicQuestion
elseif icon = “note” then
d.Icon = MessageDialog.GraphicNote
elseif icon = “stop” then
d.Icon = MessageDialog.GraphicStop
elseif icon = “caution” then
d.Icon = MessageDialog.GraphicCaution

if Len(actionTxt) > 1 then
d.ActionButton.Caption = actionTxt
d.CancelButton.Visible = cancelTxt <> “”
if Len(cancelTxt) > 1 then
d.CancelButton.Caption = cancelTxt
d.AlternateActionButton.Visible = altTxt <> “”
if Len(altTxt) > 1 then
d.AlternateActionButton.Caption = altTxt
d.Message = msg
d.Explanation = explanation

if w <> nil then
w.Show // bring parent to front

if TargetMacOS and w <> nil then
b = d.ShowModalWithin (w)
b = d.ShowModal () // Windows has problems with the Within() function when the win is not frontmost

select case b
case d.ActionButton
return 1
case d.CancelButton
return 2
case d.AlternateActionButton
return 3
End Function