Question My OK button is a little too much to the right

357mag

Well-known member
Joined
Mar 31, 2023
Messages
58
Programming Experience
3-5
I have a program that shows a message box and I noticed that the OK button is a little too much to the right. I did some looking around and it seems like you can't change that, unless you were to write code for your own message box:
 

Attachments

  • Message Box.jpg
    Message Box.jpg
    168.7 KB · Views: 24
The button is not center-aligned, is it anchored bottom-right:
1681771832046.png


and the dialog has a minimum size:

1681771952273.png


1681772021432.png
 
Not without using a custom dialog box. The system message box is supposed to be a quick and easy Windows UI guidelines compliant dialog box that handles the 80% case of showing a message with the most common icons and buttons. It's not meant to be infinitely customizable.
 
Is there a way to get the dialog box to a bigger size?

The dialogue will be automatically sized to the text it displays. If you wanted to get really dodgy then you may be able to add some leading and/or trailing whitespace to your short text, but I'm not even sure that it won't be automatically trimmed. It's about 5-10 minutes work to create your own form for this though, so it's not an onerous task.
 
Or, because there are bigger problems to solve, you just let it go; it's a fact that users will ignore anything you write into a messagebox anyway.

Use them sparingly; users can't read and even if they could, they wouldn't want to.

Developers are forever seeking ways to put more and more text and info and notifications into programs because detail and information is what they like; this is the exact opposite of what regular users want. Users hate computers and want the least friction way of getting their tasks done with them as possible. Throwing more blockers in their way and things that drag their focus away from what they're trying to achieve, to perform some trivial task (like disabling the whole program until they click OK on a messagebox), just makes them hate computers even more

(To give an example for this particular context; the windows calculator does not use a messagebox to show you the answer, nor does your phone, nor any pocket calculator you ever used. Any time you want to use a message box your first thought should be "how can I design things so that I don't use a message box?")
 
It takes some time to get from the console UI mentality over into a GUI mentality. It also takes practice, and observation. Try things out, but also see what others have done.
 
Back
Top Bottom