Ask Your Question

How can I customise a message box

asked 2018-03-19 15:37:00 +0100

ptoye gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-19 20:23:03 +0100

Ratslinger gravatar image

updated 2018-03-20 13:57:25 +0100


@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':

image description

EDIT 2018-03-20:

Hopefully this will be clearer as a sample:

image description

Be sure to upvote the answer while you are there.

edit flag offensive delete link 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.

ptoye gravatar imageptoye ( 2018-03-20 10:16:59 +0100 )edit

@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.

Ratslinger gravatar imageRatslinger ( 2018-03-20 13:38:10 +0100 )edit

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 )

librebel gravatar imagelibrebel ( 2018-03-20 18:51:17 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-03-19 15:37:00 +0100

Seen: 118 times

Last updated: Mar 20 '18