# How can I customise a message box

I want to give the user a choice of two options, or to cancel the operation. I can use a YES/NO/CANCEL message box for this, but it's not possible to change the text on the buttons. I don't want to have to put text like 'For Option 1 click "Yes", for Option 2 click "No" ' at the top as there's no asymmetry between the options.

I've found a way to simulate this operation using a dialog (and will post it if anyone's interested), but would like to know if there's a way of changing the text and using the Msgbox function.

edit retag close merge delete

Sort by » oldest newest most voted

Hello,

@librebel has provided a routine which already accomplishes what you are looking for - How to change color or font for some part of the text in the msgbox?

Sample using routine & changing button text to 'Hello' from 'OK':

EDIT 2018-03-20:

Hopefully this will be clearer as a sample:

Be sure to upvote the answer while you are there.

more

I'm afraid that @librebel's code changes the attributes of the text part of the message box, but not the text within the buttons. It's the "OK", "Yes", No" part that I want to change. Sorry for not being clearer.

( 2018-03-20 10:16:59 +0100 )edit
2

@ptoye It was clear and understood. However you must have your eyes closed when looking at my answer. The actual text "My name is John Roberts" is NOT what was pointed to in the line proceeding the image. The text on the button itself was changed from "OK" to "Hello" as can be seen in the image - exactly what you were looking for. How to do it is in the comments for the parameters at the beginning the code. It does a great deal more than changing attributes of text.

( 2018-03-20 13:38:10 +0100 )edit
1

hello @ptoye, the twelfth argument passed to the Messagebox() function can be an Array of Strings containing your custom Button Labels. E.g.:

MessageBox( "Hello", 3, "Title", 4, , 170, 50, , , , RGB(154,216,95), Array( "🆗id🆗i", "⛔ Nyet","␛ Canceli" ), , 1.9 )

( 2018-03-20 18:51:17 +0100 )edit