rhinoscriptsyntax.MessageBox() default button argument doesn't work

The default (highlighted) button should be settable via the bit flag in the second argument. But no matter what is set for that argument, the first button is always highlighted.

I used the following script to test:
(try uncommenting the line with the argument to test and commenting out the others)

import rhinoscriptsyntax as rs

"""
|              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.
|              5      Display Retry and Cancel buttons.
|              16     Display Critical Message icon.
|              32     Display Warning Query icon.
|              48     Display Warning Message icon.
|              64     Display Information Message icon.
|              0      First button is the default.
|              256    Second button is the default.
|              512    Third button is the default.
|              768    Fourth button is the default.
|              0      Application modal. The user must respond to the message box
|                     before continuing work in the current application.
|              4096   System modal. The user must respond to the message box
|                     before continuing work in any application.
"""

msg="This is a test message.  Please press a button"
choice=rs.MessageBox(msg,3)
#choice=rs.MessageBox(msg,3+256)
#choice=rs.MessageBox(msg,3+512)
if choice==6:
    print ("You pressed Yes")
elif choice==7:
    print ("You pressed No")
else:
    print ("You pressed Cancel or Esc")

It actually looks like this has never worked correctly, it behaves the same in my Rhino V6, 7 and 8. :grimacing:

Logged here
Thanks Mitch!

Hi Alain,

Thanks! I think the Discourse link in the YT item is wrong, it does not link back to this thread, but instead a different Grasshopper Developer related one.

Indeed. Sorry. Thanks!

I mentioned this a long time ago. There might already be a YT entry. I think the last time I saw this working as expected was probably V5…