Ok Cancel

By Shamus Posted Wednesday Dec 12, 2012

Filed under: Programming 160 comments


Microsoft’s operating system has many advantages, but “beauty and grace” are not among them. Gates figured out early that compatibility and ubiquity trumped looks, grace, security, stability and efficiency, which made him a billionaire. I complain about it, but he’s a billionaire and I’m using Windows, so… hm.

I understand that Microsoft does not have a company culture that fosters a lot of ease-of-use minded development. And that’s fine, I guess. I don’t expect high class at Wal-Mart, I don’t expect heartfelt and bittersweet indie Gen-Y character studies from Lucasfilm, and I don’t demand photorealistic graphics from Telltale Games. Companies all have their strengths and weaknesses, and they usually do well to stick with what they know rather than mimicking what their differently-designed competitors might be doing.

But sometimes the ugliness of Microsoft seems almost willful. Many years ago – back in the 90’s, actually – I ran into an article that revealed Apple’s approach to dialog boxes: If you’re going to throw a show-stopping question in the user’s face, then there are a whole bunch of rules and guidelines for what sort of information should be available and how it should be presented. The most important guideline was that buttons should contain verbs, or actions.

The classic Microsoft dialog is a popup window that says, “The files you are installing are older than the ones already installed. Do you want to keep these files?” This box would have Yes / No buttons, and maybe a Cancel button if the programmer was feeling really generous.

The user reads the box and still has no idea what “keep THESE files” means. Keep the old ones? The new ones? You can read the whole dialog twice and still not be 100% certain what will happen if you hit “yes”. Even if it was worded less stupidly, there’s still a chance that the user might read “Do you want to keep the newer files?” as “Do you want to REPLACE the newer files?”, thus inverting the question. Yes, it’s their fault for skimming, but part of designing a good UI is minimizing and mitigating destructive user mistakes.

According to the Apple document I read, a better design would be to replace Yes/No with “Install Older Files” and “Keep existing Files”, or something along those lines. Even if the user misunderstands the description, the buttons make it clear what will happen when pressed.

(Another pet peeve: Popups should always identify themselves. A foolish programmer is likely to title the dialog something like, “Installer”, not realizing that this can lead to chaos when someone has the installer running in the background, or run automatically, or is auto-run when putting in a disk. The user will see this dialog pop up and have no idea which program is asking this question or why. Is this drivers? Windows? An update for a game I installed eighteen months ago and haven’t played since?)

To be fair, I don’t use Apple products and I have no idea how faithfully they follow the ideas I read. I tend to admire Apple from a distance.

I’ve always wanted to follow this advice myself, but even after all these years, Microsoft is still mired in the interface design the 1980’s. That is not an exaggeration. They are stuck in the stone ages. They keep mucking about glossy semitransparent window titles with drop shadows, but they haven’t even lurched into this century when it comes to interacting with the user. (Nitpick shield: I’m talking about desktops. I don’t have any experience with their mobile offerings.)

The reason for this rant is that I wanted to create a little three option popup:

“Hey, you’re trying to delete this collection of objects. Do you also want to delete all the children objects?”

The buttons would be something along the lines of “Delete just this one”, “Delete this & all children”, and “Oops. Don’t delete anything.” Or whatever. You get the idea. The point is, the buttons should describe the actions being taken. But when I read the Microsoft docs I see they haven’t changed how popups work. You can create popups with fixed combinations of buttons. “Ok, Cancel”. “Abort, Retry, Cancel”. Or just plain-Jane “Ok”. But as far as I can tell, if you want to break from this behavior you have to go all the way to the foundation. You have to create your own window, buttons, text field, and arrange all the elements manually. We’re talking about a hundred or so of lines of code.

Rather than sink a bunch of time into that, I just stuck with the built-in “Yes, No, Cancel” dialog. Sure, it’s stupid and it sucks, but it’s one line of code and if I wanted to spend all day coding interface features that ought to be built into the OS then I’d send Microsoft my resume.

And thus the problem is perpetuated.

This always induces a certain degree of coding paranoia. Back in 1984 or so, some young pup of a coder was throwing code together, trying to get the Windows 1.0 project off the ground. The young man couldn’t see that the interface paradigm decisions he was making would still be shaping the way people used computers over a quarter century later. Of course, his decisions could have been modified or overruled later, but they never were. The interface design lingered into the age of 32-bit computing, into the internet age, into the age of Web 2.0, and now into the age of smartphones. The whole world is changed, and yet we’ve still got int WINAPI MessageBox() sitting there under the hood, shaping our software.

We coders never know just how long our code will last. I’ve had projects where I spent more time coding an application than was spent using it. I’ve had other situations where a quick two-hour utility would end up lingering for years.

Writing code is a dangerous act. If you’re not careful, the stuff you write might end up making a difference, for good or for ill.


From The Archives:

160 thoughts on “Ok Cancel

  1. I get that feeling all the time. Several “temporary” utilities I’ve written have ended up supporting business critical code a few months down the line.

    Many many of my tools suffer from the the Yes/No Cancel dialog box problem, its difficult to word them in a way which avoids ambiguity and i’m a programmer not a wordsmith dammit.

    1. Clockwork says:

      In cases where a simple yes/no answer is not enough to provide clarity, such as in Shamus’ example of installing old files over existing files, would it suitable to specify in the dialog that clicking ‘yes’ will install the old files over the exiting ones and clicking ‘no’ will cancel the installation, leaving the existing files in place? If it were written in the text of the dialog box it could clear up what clicking ‘yes’ or ‘no’ would do without the need to change the coding behind those buttons. This is more of a work around really, but do you think this would be sufficient, or would it potentially make the pop-up message longer than you would prefer?

      1. ima420r says:

        This is the first thing I thought of. Add two lines, one says what clicking YES/OK/CONTINUE does and one says what clicking NO/CANCEL/STOP does.

        1. EmmEnnEff says:

          And then we end up with a simple dialog containing 5 lines of text that people are far more likely to tl;dr.

  2. Trithne says:

    While good old MessageBox() certainly does suck, your example there is actually one where Yes/No/Cancel isn’t inappropriate. Sometimes that really is enough.

    Personally, I’d take the time to make the custom messagebox that takes and returns whatever I need, and then I’ve got a hundred or so lines of code that I can reuse – basically a better MessageBox().

    If you want something done right…

    1. Steve Johnstone says:

      +1 to write your own. You could have done so quicker than writing this blog post :D Or at least you could if you were writing C#.net code. I don’t know how long it’d take in C\C++\Hammer and Chisel.

      1. Jabrwock says:

        The point is, he shouldn’t HAVE to. The OS API is supposed to make the programmers’ job easier to communicate effectively with the user.

        Why after all these years doesn’t MS include code that has obviously been coded by everyone and their dog to get around a lacking feature in MS’s API?

        1. Leonardo Herrera says:

          Windows Vista introduced Task Dialogs. These are great, but don’t scale back to XP. Luckily, I use Delphi so somebody already did that for me.

          1. Ian says:

            I have to second on this.

            There are huge sections of code I have to maintain that could be far simpler if I could drop XP support.

            Also I find OSX to be grossly unintuitive, not being able to resize a window from and border or corner was a nasty shock.

            While Apple may or may not follow their own guidelines there is little forcing others to do so.

  3. Mike C says:

    I stick to using the basic dialogs (hey, I get my feedback from the user in one line of code!), but I do make sure I ask a question that can as clearly as possible be answered as a Yes/No, or provide a warning with a single Okay button.

    Part of the issue is internationalization. It’s a lot easier to have standard button text translated to 200+ languages than it is to customize the button text for each dialog box, and then have to translate them all. At least with standard buttons, only the prompt text itself needs translation.

    1. Rili says:

      It actually sounds more error prone to just translate the prompt text and keep the yes/no cancel buttons. You take care to word your prompt as clearly as possible, but will the translator do the same? Will that person even be aware of the pitfalls of ambiguous questions answered by yes/no buttons?

      1. Eruanno says:

        This reminds me of a lovely mistranslation by the Adobe updater-thingamacguffin. I’m Swedish, so therefore the application decided that it should be in Swedish. Right? Right.

        So it had a button to close the thing, and it was supposed to say “Close Download Manager”, but instead some buffoon at Adobe had decided to simply use Google Translate for this.

        The message read “Nära Nedladdningschef” which if translated back into English means “Proximity Download Boss”. What?

        I think the reasoning goes:
        Close = proximity (being close to something)
        Download = Yeah okay, you know this
        Manager = A person in charge of something, a boss

        So “Close Download Manager” = “Proximity Download Boss”


        1. Sem says:

          And another one here. A scanning utility I installed, decided to show itself in Dutch (I’m a Belgian). The ‘Scan’ button was translated as ‘Zoek’ which means ‘Search’ in Dutch.

          I always use programs in English anyway. If it gives me an error message, it is much easier to google it then the equivalent dutch translation.

    2. X2Eliah says:

      Random note: I hate the popups that only have an “Okay” option.
      What was the point of that, mister smug popup? Can I change what you are going to do in any meaningful way? No. Can I influence what you are going to do? No. Is my input in any way needed? No. Then get the hell out of my face and do whatever you want to do in the background and don’t bug me with this BS “jumpscare! now pres OK like a trained monkey” routine, you piece of software bastard.

      Seriously. I don’t like the single-option popups and I don’t like being bothered by meaningless popups. I guess they are fine for debugging and monitoring execution flow as a programmer/developer, but why the hell does the user have to deal with that?

      1. pneuma08 says:

        Basically, they exist to communicate errors. As a user, I would rather get a message like:

        “(Program) has encountered a critical error and must close.”

        as opposed to having the program just unexpectedly stop execution. You can argue about the existence of a “retry” button, perhaps, but that may not be a viable option, depending on the error.

      2. Zak McKracken says:

        I’m with pneuma08 on this one, with one exception: I’ve seen windows programs who will open such a box and refuse to continue unless you click okay. Halfway during installation. In the background. That is evil.

        But then, that’s not the fault of the one-button-box, it is just being misused.

        KDE has a nice notification system where a message that would use a one-button box in Windows pops up briefly in the lower right corner, and a list of those messages is available from a small icon in the task tray, together with progress bars of file operations currently running and other such background stuff that would otherwise interrupt what you’re doing in the foreground.

  4. kikito says:

    Do they have an issue tracker where one can report this sort of thing? If not, that’d be plain rude.

    1. MrGuy says:

      Yes. They call it the internet.

      This comment optimized for Internet Explorer

  5. Aldowyn says:

    So I was installing (and having trouble with) a bunch of mods for Skyrim yesterday, and the prompts seemed pretty reasonable. Let me see…

    ‘this destination already has a folder named blah. If any files have the same name, you will be asked if you want to replace them. Do you still want to merge this folder (info) with this folder? (info)’ Buttons saying ‘yes’ and ‘no’.

    Seems simple enough to me if you know how files and folders work, which is not at ALL guaranteed. Although it shouldn’t come up unless you’re doing SOMETHING. Okay, Yes. Let’s continue

    Oh look, identical files. ‘copy and replace’, ‘don’t copy’, and ‘keep both files’. Buttons that tell you exactly what they do!

    BTW, I’m running windows 7. So it’s not as bad as you’re implying, I guess. At least not all the time.

    (I was installing a bunch of Skyrim mods yesterday and having some issues, so this was on my mind)

    1. Shamus says:

      As far as I can tell, the “copy and replace” vs. “don’t copy” buttons were done the hard way. (i.e. with a hundred or so lines of code.) If there’s a cleaner solution, it’s buried deep and well hidden in the docs.

      I wasn’t implying that ALL dialogs were bad. I was more making a point that the current 1985 design makes it troublesome to do things right and easy to do things that CAN lead to confusion.

      1. Shamus says:

        Another thing I should add:

        When you’re writing a really huge application (like say, Windows Explorer) then that hundred or so lines of code is less of an issue. In fact, it’s probably idea to make your own generalized code for those special-buttons cases. Explorer (not to be confused with INTERNET Explorer) probably has hundreds of potential popups. Making a block of code for all of them is just good design.

        But in small applications where you only have one or two potential popups, the economics of a hundred lines of code vs. one line of code can seem very different.

        1. It still amazes me that Windows has both “Explorer” (sometimes named “File Explorer” or “Windows Explorer”) and “Internet Explorer.” That kind of naming confusion is irritating. Especially since “Explorer” was once named “File Manager.” Microsoft changed the name intentionally, directly causing the confusion (vs it merely being a legacy name when Internet Explorer came around).

          1. Correct me if I’m wrong, but isn’t the “File Explorer” also pretty much Internet Explorer? The last time I used IE (which was some time ago), I could keep the same window open and hop from Google to my C: drive and back again.

            I’m using FireFox now mostly because I’m too lazy to port all of my bookmarks, etc. over to the improved (so I’m told) I.E. or Chrome. I’m getting royally sick of FF’s tendency to consume all of my RAM even after years of promises that Mozilla has fixed all the memory leaks…

            I got a little sidetracked, there. What was I saying?

      2. echoon says:

        Here is a screenshot of such a dialog for those not using Windows 7:

        These dialogs are called “Task Dialogs”, and there is an API for creating them. Although I don’t know if they can be created with less than 100 lines. The reason nobody uses them is probably that they don’t work on any Windows below 7.

        1. Shamus says:

          Those are really nice. I think it’s the right design choice.

          Yeah, not working at ALL on earlier versions is a bit of a problem. I wonder what happens if you try? I’ve never investigated the fallback mechanisms. If they use a new library, then I’d assume your entire application might fail to run on XP. Which is probably a deal-breaker for anything commercial, although it means that this problem will fade over time.

          I give MS a hard time about their API here because it’s SO OLD, but an advantage of their approach is that they have amazing backwards compatibility. According to Wikipedia, you could take a 1985 Windows 1.0 application and compile it today with only “minimal” changes. (Probably a bunch of fussy casting issues, I’d bet. Back in those days it was socially acceptable to go passing around handles as void*, which is now just barely less shameful than using GOTO.)

          That’s some amazing longevity. It would be like finding out that parts for a Model T will fit and operate properly on a modern-day Ford Focus.

          1. Dragomok says:

            Again with car analogies…

          2. Dave Anderson says:

            According to Wikipedia, you could take a 1985 Windows 1.0 application and compile it today with only “minimal” changes.

            Just a complete “out of curiosity” question, is the opposite of this true as well?

            BTW, I have no programming knowledge at all, so please be gentle with the Face Palms, OMG’s, and WTF’s in response to this question. ;-)

            1. X2Eliah says:

              Very probably not. Unless you hand-select all parts of the code to only rely on the small subset of functions available from 1.0, without touching any of the fixes, improvements, additions etc.

            2. 4th Dimension says:

              backward compatibility means that new versions of software support features of old software. That can be done if you review your old software and take note of what you need to support. Forward compatibility would require some heavy duty predicting which way will the market go, or actual precognitive abilities. Like predicting while you were writing Microsoft Office Word 2003 (in year 2002 probably) what would future MS Word format (*docx) look like five years in future.
              And here we are talking of decades of development that would have to be predicted in early 90s. The task is basically impossible, or financially unfeasible.

              I hope I was gentle.

              1. Psithief says:

                I’m assuming all the precognitive power owners have used their precognitive powers to realise that letting the world know they have precognitive powers is a bad idea. ;)

            3. Amarsir says:

              Think of it like this: you take everything in 1.0, and then add more stuff around it to get 2.0. Then do the same with 2.0 for subsequent versions. That’s not literally what happened, but it’s close enough to help you understand how backward compatability works.

          3. Kdansky says:

            If you try the following happens:

            When you compile your MFC code and have a Task Dialog somewhere, you have to compile it for vista (Win v6.0) and up. The classic work-around is to write your own TaskDialog, which at runtime checks WinVer, and if it’s below 6.0 (xp is 5.x), then it will display something else, like normal, oversized buttons with the same text. And if it v6.0 or 6.1 (Windows 7’s internal version is 6.1), then you can use the new styles. In the code, you have to write out the WS_STYLE without using the macro (and just put the plain number there instead, making the code a bitch to understand for the next maintainer), because that would not compile otherwise. I know because I did that for work just a few months back.

            Also, Microsoft has a UI guideline document somewhere that’s 800 pages or so, and it’s actually very good. When you follow it to the letter, you get a decent UI which fits very well in the Windows eco-system. It explicitly mentions that you should not use YES/NO-dialogs if you can avoid it.

          4. Kyte says:

            What’s more amazing is that in many cases you don’t even need to recompile. Even if they were made for DOS 5.0.

          5. Peter H. Coffin says:

            Just to bring things back around again, because I think the discussion is nifty and want to drag it on for days, here’s a video about the search for the first car that had what could be considered now the standard “user interface”:


            It’s NOT the Model T…

        2. Lck says:

          Yup, was about to post the same thing. The point is: writing good UI code is really hard. There are hundreds of special cases (line breaking of text, accessibility, localization, keyboard shortcuts, etc.) which must be considered to have a “good messagebox implementation” and not just a “basic replacement” which works for your case but breaks in many others. Therefore, relying on the Windows API to do such things is actually a good thing.

          Windows Vista introduced Task Dialogs and they work very well. They have a more complete API (in fact, they might have even too many options), look very nice and solve almost every UI issue Shamus was talking about. However, the real problem is that many many Windows users are still stuck with Windows XP unfortunately.

          Also, shameless plug, if you need to use Task Dialogs from .NET code (further reducing the amount of code you have to write for “nice” message boxes) you can use the WindowsFormsAero library. :)

        3. Katesickle says:

          Did anybody else just try to close that picture by clicking on the ‘cancel’ button? …No? Just me? …OK then.

        1. Shamus says:

          Waaait. I’m OUTDATED because I’m not up-to-speed on an operating system that’s less than three months old?

          And as I’ve said elsewhere, it’s one thing to have great stuff built into the file manager, it’s quite another to have it available to third-party developers via handy API calls. (And still another to get to the point where you can think about using those API calls because so many people are still using XP, Vista, and Win 7.)

          The fact that the new dialogs are better (and they do indeed look look far better) does not at all undercut my point about how design choices lingered for a quarter century.

          1. Tse says:

            And besides, Windows 8 is terrible for a desktop PC. Yea, you can use an app for a somewhat proper interface, but your classic control panel and start menu are gone, replaced with clunky touch-based versions of themselves.

        2. Aldowyn says:

          That article SPECIFICALLY says that the EXACT thing I was doing and talking about (copying files and folders with the same name) is ‘cluttered and confusing’, when my original post was specifically saying that it was pretty clear and easy :/

          I have no idea what that means, but I figured I should point it out.

          *continues reading* … gah. That’s WORSE. It shows LESS information, and makes it less clear what you’re actually doing, by having you answer the question for more than one specific file at once, instead of the handy ‘do this for all conflicts’ button 7 has. >.> Why would you show multiple at a time?

          I liked the consolidating multiple file transfers into one window, though. All those floating windows DID get annoying.

          1. WJS says:

            That filename collision dialog is truly horrible compared to the old Win7 one! And I note that they still don’t have any way to specify multiple files other than by folder. If I want to always keep the newer of the two files, I have to do each and every one individually, sine the only mass select option they have is by location. A good interface would be able to select “Always pick newer” or “Always pick larger”, two cases that come up fairly frequently.

    2. Daemian Lucifer says:

      Windows 7 doesnt count,its an aberration.

      1. Deadfast says:

        You sure you didn’t get your Windows numbers mixed up?

        1. Zukhramm says:

          It’s an aberration in that it’s actually alright.

      2. X2Eliah says:

        Wow. There’s some great quality comment material. I’m surprised you didn’t also include a paragraph of praise for linux/win95 there.

      3. Daemian Lucifer says:

        People,please,I said aberration for a reason,and not abomination(that would be windows me).I actually like 7.

        1. Kyte says:

          The problem’s the implication that all the previous Windows are horrible instead of simply the product of continuous work and a shift of priorities within the company itself.

          1. Daemian Lucifer says:

            They arent all horrible.Only most of them.

            1. Kdansky says:

              At least they all know that a period is followed by a space.

    3. Zak McKracken says:

      You can solve pretty much any scenario with “yes/no/cancel”, but then one Program will ask a question one way, and the next one inverts it, and then the user, used to always klick “yes” in certain scenarios, gets it all wrong.

  6. miroz says:

    If you have buttons “Delete just this one”, “Delete this & all children”, and “Oops. Don't delete anything”, then you actually do not need a question part. You can only explain what happened: “Hey, you're trying to delete this collection of objects” and buttons speak for themselves.

    1. MrGuy says:

      Hey. It looks like you’re trying to delete a collection of objects. Would you like help with that?

      1. anaphysik says:

        “MURDER CLIPPY.”

      2. Zagzag says:

        Am I the only person who actually didn’t hate the office assistant?

        1. Deoxy says:


          And if we just kill you, maybe they’ll never try that again! GET HIM!

  7. Dave Anderson says:

    You’re a writer as well as a programmer. If you’re stuck with “Yes”, “No”, and “Cancel” then why not explain what those options will do within the dialog of the pop-up window?

    “The files you are installing are older than the ones already installed. Do you want to keep these files? Click “YES” to keep the newer files already installed on your conputer. Click “NO” to overwrite the newer already installed files with the older versions of these files on this disc. Click “CANCEL” to stop the installation process.”

    Granted, that would only take care of the people that actually read them.

    1. Jabrwock says:

      Blah blah blah are you sure Y/N?

      The Apple guidelines were there because they knew the buttons would get the attention whereas the dialog text likely would not.

      1. krellen says:

        Apple’s real innovation has always been its “Computers for Dummies” design philosophy. Microsoft never fully bought into it, but has been forced to fake it to stay dominant.

        1. I’d call it a “marketing philosophy.” Apple products throw up baffling error messages that look like a random collection of license plate numbers, too.

          1. Alan says:

            When Apple’s software works, it’s far more usable than Microsoft’s software. When it fails, may Steve Jobs’ ghost help you, because the software isn’t going to help you. That’s an area that Microsoft is, if not perfect, at least better at.

            1. Deoxy says:

              This. So very this.

              I like to draw the learning curve for the different systems to make my point:

              -Linux goes straight up for a LONG way… then it goes flat, pretty much forever.

              -Apple stays EXTREMELY low for a long time, then skyrockets… pretty much forever.

              -Windows is a nice, straight line going up at about 45 degrees.

              So, in Linux, to do bloody anything requires a lot of knowledge, but once you get there, you can do SO SO SO much.

              Apple allows you to do a LOT without knowing much… but seriously, getting beyond that is insane.

              This leads to not enough users for Linux and not enough software and support for Apple. Hence the mass appeal of Windows.

              (Of course, vicious and in some cases admittedly illegal* business practices to achieve and maintain enormous market share also help. *As in, admitted by Microsoft – yes, they happened.)

        2. Aldowyn says:

          Which is why I’d rather stick with Microsoft, because I don’t want that extra layer of obfuscation in the name of simplicity.

    2. Deadfast says:

      Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue

      That’s the tile of a dialog triggered by .NET’s System.Diagnostics.Debug.Assert() failing. Yes, even Microsoft couldn’t be bothered.

      1. Kdansky says:

        You can actually write your own dialog to be displayed instead. Well spent time, even if it takes a while. We have that at work, that’s why I know.

        1. WJS says:

          Is this comment actually supposed to be a reply? It doesn’t follow the one above at all.

    3. Zak McKracken says:

      That would still require the user to read a lot more text and pay a lot more attention, because what you did there was essentially removing the text from the buttons, painting them in colours and explaining the meaning of the colours elsewhere. I’ve seen this type of dialogue box (Win95? Don’t remember), and it is definitely suboptimal. That’s mostly a relic from the lazy days of “what is a GUI?”, where you would sometimes need the user to press a specific key on the keyboard in order to make a choice. This is better than requiring them to type in commands, but is is not better then simply clicking on the thing you want to be done.

  8. Deadfast says:

    There is a much bigger issue with Windows’ modal dialogs that wasn’t mentioned.

    They steal focus.

    This is the single most idiotic design decision I have ever seen. At any point of me writing this rant, some sort of a dialog could pop up, steal the focus from my web browser and consume all the keyboard input that it wasn’t supposed to receive. Should the keyboard input consist of me pressing return, or even better, space, I will unintentionally select whichever option of the dialog is the default. Mind you, while it did only happen a handful of times, each occurrence could have been a disaster. It is made even better by the fact that to this date I cannot tell you what any of the dialogs asked me. Considering my computer hasn’t exploded yet, I guess it was nothing important.

    1. Thomas says:

      I never thought this was possible and then had it happen multiple times in the last month. It’s really really stupid, surely typing is something that any person is fairly likely to be doing at moment in time?

      1. postinternetsyndrome says:

        I sometimes see dialogs with a timer of a few seconds before the buttons become clickable. That should be standard.

        1. Canthros says:

          No, actually, it shouldn’t. If I’m not doing anything else, I don’t want to wait until the application has decided I’m read to click the button. You could patch over this farther by having it check to see what you stole focus from, but the simple and clean solution is … to not steal focus.

          1. Thomas says:

            Could you stick a micropause in (without the need for a timer) if it’s important enough to steal focus, it should be something people at least skim before clicking on, so you can have a one second delay before you hit enter. Or if you answer it with the keyboard you need to press left or right before pressing enter (Mass Effects eventual solution to this problem =D )

            1. Deadfast says:

              I can’t think of a single dialog important enough to steal focus. Sure, make the icon flash through the entire color spectrum and start a klaxon if you really have to get my attention, but leave the decision of when to switch to me.

              1. Zukhramm says:

                “Your computer is on fire!


                1. WJS says:

                  I don’t think that case steals focus.

        2. Pete says:

          Right, but then theres a dialog you expect to pop up and you spend the next three seconds clicking OK furiously.

          1. WJS says:

            The obvious solution seems to be to delay keyboard input but not mouse, although that’s going to be quite a bit more complex (requiring a new button class, I expect). You could also look for less impatient users; let me know how that works out for you. ;)

    2. Kyte says:

      Er, that’s the point of modal dialogs. Where else would you put the focus? The parent window’s frozen. No focus there.

      The problem’s in that many applications fail to follow design guidelines (which there are!) and choose to go modal instead of better mechanisms such as notification balloons or whatnot.

      1. Deadfast says:

        That’s all fine as long as I’m actually working with the parent window that creates the modal dialog. What I’m complaining about are modal dialogs created by out-of-focus applications that assume direct control no matter what I’m currently doing at the time. Since these dialogs are handled by the operating system it makes it its responsibility to present them in a manner that isn’t full-on retarded.

      2. Peter H. Coffin says:

        But stealing focus while actually putting up the dialog BEHIND OTHER WINDOWS? That’s just dumb. Compounding the dumb is when they also set the attention to the “ok/dismiss” control so that if you happen to be typing along near the end of a paragraph, not only does the hidden modal dialog eat the last couple of keystrokes, it also intercepts the Enter press, and Goes Away until the user starts wondering what’s up with the installer that was running in the background….

        1. Deadfast says:

          If only enter. Space also counts…

    3. ClearWater says:

      I’ve had this happen many times and I don’t know either what I agreed to or even if I agreed to anything.

  9. RTBones says:

    For the coders reading this – there is some simplification here, for the benefit of those that dont.

    In a previous life, I worked in a simulation house – high fidelity real-time flight simultators, of the quality pilots train on. We had FORTRAN models passed through C wrappers and run by ADA executives (a requirement we couldnt get around). The purpose of the wrapper is to “bind” the FORTRAN models together and allow some portability.

    As time went on, many newer models were written in C/C++. This made simple things in FORTRAN like common blocks for global memory become more and more difficult as code became more object oriented. (For those that dont code – most modern programmers simply dont ‘do’ global memory, as it doesnt fold into the object-oriented philosophy.) Further, in a real-time environment, you have multiple execs running at different SPEEDS – and timing is everything. Before anyone asks why not just rehost the old code, understand that in any modern sim, you have MILLIONS of lines of code. You not only have a HUGE undertaking, you have a COSTLY one, so you rehost as unintrusively (sp?) as you can. This is why code sometimes lives forever.

    In the end, what happens is you end up asking yourself if the model works. If it does, you leave it alone. If it doesnt, you patch it until you can convince someone to pay for a rewrite or you get a requirement that demands it.

  10. Vipermagi says:

    “The user reads the box and still has no idea what “keep THESE files” means.”

    “Keep these files” implies the files were already there before, doesn’t it? It would be odd to refer to new files in this way, to me.
    Regardless, I can see it being confusing for a too-large amount of people.

    1. Aldowyn says:

      why say these, though, instead of ‘keep old files’ or ‘keep new files’? Either of which makes perfect sense to me?

  11. daemon23 says:

    From what I’ve read, there is another very, very big reason for Apple’s style: internationalization, at very least to Japanese. You can’t simply have a button labelled “No” or “Cancel” in Japanese, it’s nonsense there. If you use Yes/No/OK/Cancel buttons, chances are pretty good that you’re going to be reusing those strings in your i18n assets, and then you get to Japanese and realize you *can’t* just use the same item, and wind up rebuilding all your templates, introducing exciting new bugs, etc.

    1. Shamus says:

      Interesting. I can’t wrap my head around how yes/no couldn’t have any equivalent in Japanese. Permit / deny? Do / Don’t do? I assume they have a fine-grain breakdown of the word that can’t be merged into a single meaning, but I’m curious how it works.

      Would you be willing to elaborate?

      1. StashAugustine says:

        As far as I remember, Latin doesn’t have strict yes/no words either. YOu can kinda make do with “it is so” and “it is not”, but the meaning’s not quite right.

        1. Tuck says:

          Yeah but how many people use a Latin desktop? :P

          1. StashAugustine says:

            The Imperial Guard? I was just pointing out that it is possible to have a language without yes and no.

        2. Ellery says:

          Chinese also does not have yes/no.

          They have a word showing that you heard someone without any connotation of agreement or disagreement: they just say å•Š “ah”

          They have “correct” and “incorrect” 对 and 不对

          They have a word for “there is” 是

          but no words for yes and no.

          I have heard people here using yes and no among each other occasionally though… I guess people that learn English find them handy to throw in the ol’ language toolbox… but you don’t HAVE to have them :-D

        3. Loonyyy says:

          “Make it so.”

          Now I know why Picard spoke the way he did.

      2. Thomas says:

        Technically, even in Welsh the correct word for yes and no, depends on the sentence it’s being used with rather than a word that defines the concept.

        It doesn’t even come up on a search here

        The two for yes that you’d use most commonly in answers to questions Ydy and Oes which translate more literally as ‘It is’ and ‘there is’. But I think Welsh has stop gap words for situations where you haven’t been presented with a verb.

        According to wikipedia

        Oes and Nag oes are used to answer questions regarding a quantity or existance of an object (i.e. the 3 sg. present indicative of the existential verb).
        Ydy and Nag ydy are the 3 sg. present indicative of the substantive verb ‘to be’ used, e.g., where the sentence involves a predicate.
        Ydw and Nag ydw are the 1 sg. present indicative of the substantive verb, used either existentially or in the case of predicates.

        But I can’t pretend I actually understand what that means =D

        EDIT: I’d just like to stop to appreciate the awesomeness of a language where ‘ydy’ and ‘ydw’ are entirely pronouncable words. I wish I was fluent

        1. some random dood says:

          This truly is an international site – did not expect to see Welsh discussed here (and I don’t get what the “sg.” stands for in the above).
          Well, not only is “ydw” pronounceable, but so is Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch. (Though I don’t know of anyone who would want to, except to win a bet.)

          1. Thomas says:

            Memorising that used to be a point of honour at school =D

            It also contains all the Welsh formations I really like ‘Llan’ because ll(which in a welsh crossword, only takes up one letters space) and you can’t trip over without stumbling into a place starting with Llan, pwll because the w sound is awesome in Welsh and then you follow it with the ll, and wyn

            1. Aldowyn says:

              random note: when I made my name I was going for tolkien-esque, and tolkien based at least one of his elven languages on welsh (I didn’t know that at the time), so I ended up with a -wyn name. I emulated Tolkien so well I ended up emulating what he was emulating instead :/

          2. Shamus says:

            That’s not a word it’s a paragraph with no spaces!

            Additionally: Thanks, that was really interesting.

            1. krellen says:

              What I think it actually is is a demonstration that a very large number of place names are, in fact, just “description of place” in a foreign language most people don’t know.

              1. Thomas says:

                The dark secret is it’s actually just cheating, Welsh place names are descriptive and they’re compound so one day Llanfairpwll decided that they’d just exploit it to deliberately make the longest place name in Britain. It’s fairly poetic though

          3. Deadfast says:

            There is also the hill on New Zealand called Taumatawhakatangihangakoauauotamateaturipukaka-
            (had to break it up to two lines for compatability reasons).
            At 85 letters it is listed as the longest official placename in the Guinness World Records.
            Luckily, it can be shortened to Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu which is only 57 letters long.

            1. Indy says:

              That is lucky. That 57 letter version is far more convenient.

      3. Kdansky says:

        As someone who is fluent in Japanese (and has a wife with a Japanese installation of MacOS X), I can elaborate too.

        Japanese doesn’t have a word that means the same as “Yes”. It has the word はい which is generally translated as “yes”, even though it’s meaning is much closer to “acknowledged”. You can make a sentence that goes “Yes, I don’t want any more desert.” because in reality, what you literally say is “I acknowledge your question. I do not require more desert.”

        As an aside: Japanese has many other very strange (and very rare) concepts, such as the absence of a typical Subject-Verb-Object structure as a basis for sentences. “I love cats” [俺は、猫が好き。] literally becomes “When we’re talking about myself, cats are much liked” (and for shits and giggles, that’s not a passive form in Japanese, but the language offers a passive for other purposes!). Bonus are transitive verbs (you can distinguish between “stopping a car”, and “a stopping car”), which means you can make sentences like “the window just slammed itself shut by means of wind”. It’s a highly interesting language.

        What Microsoft (and Apple too) did, however, was just the literal (bad) translation (and most dialogs just offer はい and いいえ). Strictly speaking, it’s bad style. On the other hand, Japanese is a language very high on context, and when your only choices are はい and いいえ, then it’s completely obvious from the context what those choices mean. Ironically, it only works well because the dialogs don’t offer any other choices.

        I’ve also seen dialogs use the words イエス and ノー. These are phonetic rewritings of the English words “yes” and “no”, and not at all Japanese words. Cancel suffered the same: カンゼル. This issue doesn’t come up with all typical options: There is a word for “continue”, for example [つづく].

        What’s way worse than problems like this, however, are assumptions about names. There are a significant number of services that require you to specify a first and a last name, and both have to be at least n letters. Sometimes, n is 3. “Li Fu” is a really common name, but it doesn’t work.

    2. DrMcCoy says:

      Reminds me a bit of the German translation of Simon the Sorcerer.
      The original uses the same string and sound resource for “What’s that” for two different meanings: As a “What is this object here” and as an answer to questions like “Are you pondering what I’m pondering” (i.e. as a request for further explanation). The German version of the game translates this with “Was ist das”, which works for the first case, but kinda not really for the second one. You of course get the general meaning but it sounds really awkward.

  12. Nick says:

    For the record: Developers on OSX stick to the conventions pretty well. Mac users are quite spoiled when it comes to the UI, and tend to react *really* badly to bad UI.

  13. Steve-O says:

    On a side note, the site seems faster again which is good!

  14. Scott M says:

    For the record — and without disagreeing with Shamus’s post above — I’ll say that many employees at Microsoft do care very much about the user experience (both the end user and developers). I’m one of them, and most of the people I work with fall into the same camp. Obviously it’s a big company, big enough that this sort of culture varies widely across it, and I can’t always account for the decisions of upper management. But the fact is, creating a good UX, let alone an API that allows other people to create a good UX, is really hard, for all the reasons that people have mentioned above. You’re hobbled by the need to make things backward compatible, secure, internationalizable, performant, and you’re trying to satisfy the needs and preferences of literally millions of people, each with their own slightly different way of doing things.

  15. Chris says:

    Come now, Shamus. You can’t complain about Microsoft being stuck in the 1980 interface design if you don’t actually play with their modern interfaces (nitpick shield not accepted). If this trend continued with Windows 8 and Windows Phone then you’d have more to stand on. And I’d expect (and enjoy) a full rant from you.

    MessageBox is the old school option you were looking for, so it’s the thing you found. I think you actually want a Task Dialog: http://www.developerfusion.com/article/71793/windows-7-task-dialogs/
    If you’ve noticed over the years from Vista and especially Win7 more of the prompts coming from the core operating system use the style with vertical buttons that contain more text describing the actions. That’s intentional, for many of the reasons you listed.

    But there is one legitimate reason that developers have historically trended towards Ok|Cancel style in their classic MessageBoxes: localization. In English these short verbs in buttons work just fine as dialog buttons. In many other languages the translation is lengthier and more nuanced (making it dangerous to share strings). It’s easier (not better, _easier_) to put more words into the body of the message box and leave the buttons themselves as the free (if flawed) defaults.

    1. Shamus says:

      The fact that there are places they’re not using it does not negate the fact that it IS being used. Your nitpick fails.

      And Task dialogs require Windows 7. Using them means cutting off a LOT of users or writing two solutions, thus leading right back to the central problem.

      1. X2Eliah says:

        You have to have a cutoff of old users at *some* point. 5 years is not a sufficient cutoff? Are you supporting people on 98? 95? 3.1? 1.0? Where do you draw the line, and where will you draw the line in, say, 2016?

        Also – People keep using old OSes partly because developers keep writing new programs that work with them. If there were more software exclusive (and better because of it) to 7/vista/+, then the rate of transition to 7 would be faster, and you would be able to stop whining about having to use the old API so much faster.

        1. X2Eliah says:

          Also, the bold paragraph is somewhat mean. Overly so, in fact. Sorry. But I do think that the “we must support those ramheaded users who don’t upgrade for decades” is harming the transition rate and, ultimately, developers themselves. Corporate cases excluded, of course – I am talking about end-user-consumer oriented applications.
          End of the day, the logic still stands – less support of, say, xp -> less people stay on xp -> more transition to vista/7/+ -> less reason to worry about not supporting xp next time -> better api messagebox stuff etc.

          1. Tse says:

            Which leads to cases of huge companies not upgrading their software even longer. Both Microsoft and the developer of the software the company uses lose several hundred/thousand sells each time this happens.

          2. Uristqwerty says:

            Less support for XP -> More people contemplating switching to something other than Windows. Or “we would have used your software, because it has that neat feature, but since it was only available for windows 8 we decided to go with this alternative created by your biggest competitor. It might not be quite as shiny, but it works without needing us to upgrade half of our computers”.

            Windows XP may be 11 years old, but Windows 7 is only 3 years old, and the only thing in between is vista. Also, Wikipedia has some interesting pages on “List of features removed in Windows “. Any item on one of those pages could be keeping a lot of people from upgrading, and the lists for vista and 7 are rather long.

            1. Tse says:

              A company I did some freelance work for still uses Inventor 11 (made in 2006), which is incompatible with Vista/7. I had to install XP on my Win 7 machine to run it. I have to restart my machine whenever I start/stop working for this particular company.

              1. Kdansky says:

                If you have a Win7 professional, you can run a Windows XP in a VM, and you don’t even have to pay any licensing to MS for doing so, and in fact, they offer all of that software for free.

                Check this: http://www.microsoft.com/windows/virtual-pc/

                It’s so much easier than rebooting.

                1. xKiv says:

                  Unfortunately, that didn’t work for my particular combination of notebook, cryptokey usb dongle, and other stuff. I had to up/downgrade to XP to get working VPN access :(
                  And now I keep XP out of momentum (installing 7 + reinstalling everything I need for work would take too much time).

                2. Tse says:

                  Inventor gets quite heavy with more complicated assemblies. And I tried XP mode. IT STUTTERS ON PINBALL!!! Even if I give it 3 gigs of memory.

          3. Shamus says:

            It’s always been part of my design philosophy: Aim for as much backwards compatibility as I can get.

            Part of it was working for 15 years at a company with a very, very niche appeal. We needed to reach everyone we possibly could because our userbase was less than a hundred thousand and trended towards old computers. (Towards the end of my time there, that flexibility became a key selling point that kept us viable even after Second Life began eating up a lot of the market. A lot of our customers were companies, and those people are even worse about upgrades than home users.)

            That sort of thinking just seeps into your pores. For me, it’s just one aspect of making good software: Make clean, stable, fast compatible code. It’s hard to let go of that last one, even when I’m writing something that likely is just a prototype for my own use. (Although again, you never know.)

            Getting deeper into it: If this program was an actual commercial endeavor and I expected to have a userbase, then I would have simply built my own general-use popup system. That sort of distraction sucks when you’re prototyping, but it’s invaluable for ongoing projects.

            Even on this prototype project I feel this strange guilt for hard-coding strings. Part of my brain keeps yelling at me, “WHAT ABOUT INTERNATIONALIZATION?!?”

            It really is hard to overcome long-held coding practices. Probably moreso if there is a non-zero dollar value attached, even if that value is trivially small.

            1. NihilCredo says:

              Here’s the problem, Shamus. You wrote this paragraph:

              I've always wanted to follow this advice myself, but even after all these years, Microsoft is still mired in the interface design the 1980″²s. That is not an exaggeration. They are stuck in the stone ages. They keep mucking about glossy semitransparent window titles with drop shadows, but they haven't even lurched into this century when it comes to interacting with the user. (Nitpick shield: I'm talking about desktops. I don't have any experience with their mobile offerings.)

              If the issue you raise has been fixed since Windows 7 (or possibly even Vista?) then this j’accuse you wrote is both massively unfair and factually wrong. Because the modern, better-designed dialog boxes are there, you just chose not to avail yourself of that option for the sake of XP users.

              MS is not at fault here, unless one expects them to back-port the new feature to their operating system from over a decade ago.

              1. Shamus says:

                I suppose it would be “factually wrong” is these popups were the ONLY thing wrong with Windows. That was a single example, and that ONE example led into the main discussion. Are you really suggesting that Microsoft interfaces aren’t famous for odd, nonsensical behavior and gimmickry? Other examples, if you really need to be pedantic: Task wizards, the bloody ages it took them to get around to adding tabbed browsing, the way important features are hidden, and the fact that even today, you STILL push the START button to shut down the machine.

                There are pages of gripes like this. Maybe you agree, maybe you don’t, but this discussion is a real thing and not something I made up.

                I began with a broad acknowledgement: Microsoft has this problem with interfaces. Then I moved onto the specific problem I’d encountered. I was not being unfair. I was framing a discussion. If I’d left that out then I’d have somebody ELSE gnawing on my ankles because why am I talking about popups and not this OTHER more serious interface problem? Or why do I expect Microsoft to change? Or calling me a hypocrite for using Windows when I obviously “hate” it so bad.

                1. NihilCredo says:

                  Shamus, right after the paragraph I quoted you wrote “the reason for this rant is that I wanted to create a little three option popup”. The post starts talking about dialog boxes, ends talking about dialog boxes, it uses dialog boxes as your case study in Stupid Problems with Coding for Win32.

                  I don’t think I’m being pedantic for pointing out that, of all the “legacy” albatrosses hanging around Windows’s neck you could have written a rant about, you wrote about one that was addressed 3 to 5 years ago as well as one could possibly expect. Or that a layman who read your post would get the impression that Windows 8 is still stuck on Yes/No/Cancel.

                  Not the most perfect analogy, but it’s a bit like if someone today wrote a long post complaining that there are no gay / bisexual humans in Mass Effect, and framed it in the larger context of Bioware’s romances being poorly-written fanservice. Yeah, the larger point may well be correct, but would it really be “pedantic” to bring up in the comments that ME3 went and tackled that issue? Especially if the post had made no mention of ME3 at all?

                  1. Shamus says:

                    A glossy semitransparent window with a stone-age yes / no button. Like I said.

                    That’s Windows 7. My computer.

                    My point was that interface decisions made 25 years ago are shaping the way we use computers now. And it’s true. The presence of the alternate dialog method doesn’t change that.

                    Incidentally, the MS docs do not link that new stuff from the old. I did many Google searches for what I wanted, and I didn’t find the new API features. So these new features aren’t made obvious, developers are not guided towards them, and even Microsoft themselves seem a bit shaky on using them.

                    In your analogy in the last paragraph? Make it so the bisexual character is hidden in a side-mission and none of the other characters ever talk about them. So yeah, it does seem to me like you’re splitting hairs over something that isn’t really germane to the point I was making, and taking a disproportionate amount of offense over it as well.

                2. Simon Buchan says:

                  This is a bit late: but it sounds like you should be reading (more of?) the excellent blog The Old New Thing which has an excellent explanation.

                  Also, if your particular today includes Windows 8, then you *don’t* – they took shutdown off the start menu screen, it’s now one of the settings “charm” (uugh) options. Which is way worse. Swipe, click click click, rather than just click click. At least you don’t have to do that too often, right? Though apparently you can just wait another year (or 4 months or so if you are on MSDN or Technet, I guess) for Windows 9 for them to fix that!

        2. RTBones says:

          While I do agree that at some point, you DO have to make the jump – it isnt as easy as it sounds. This is particularly true in large engineering houses, where many software tools are unique. The tool isnt end product of the job, its just a means to do it – and if your tools work to make you efficient in the current (old) OS, but wont work in the new OS, you will resist change because you cant get your job done as effectively. Your customers are not going to pay you to develop new tools if they can get the same engineering job done elsewhere in less time and for less money. Companies also stay with OSes largely because of stability. Stable and proven XP, or less than stable and not quite proven Vista…even if the hardware can make the jump, its a no-brainer.

    2. Kdansky says:

      I agree. It’s unfair to complain about ancient interfaces in ancient products, when the developer has released a better product five years ago.

      To go with car analogies: That’s like complaining that a Mustang from 1980 doesn’t have an airbag. Yeah, those weren’t invented yet, and you can’t even buy a new car without one!

      1. Shamus says:

        “Unfair”? You’re talking about stuff the operating system is doing, and I’m talking about API features exposed to developers. Completely different.

        1. Kdansky says:

          I’m talking about API. TaskDialogs have been in the API since Vista, which was released nearly six years ago. Developers have the option to use them, but they’d rather ignore them in favour of XP support, which only increases the problem of people not upgrading their OS to a current one.

          How old is XP?
          It doesn’t come with USB support without a service pack.
          You can’t share files over LAN with XP.
          It doesn’t come with support for displaying any movie files.
          Only 32bit, only 3.2 GB of RAM and no SSD support.
          Bill Clinton was president.
          Some girls who were born when it was released are now teenage mothers.

          1. Peter H. Coffin says:

            If you’re going to rant, be correct.

            XP came out in summer of 2001. Which makes not even 12.

            The service pack comes as part of the auto updates. Someone has to intentionally not allow those to not have USB support.

            You can turn on SFS (Simple File Sharing) if you’re not part of a domain. If you’re part of a domain, odds are that you have a file server someplace to share the files on.

            It can too play movie files, but only comes with codec for a couple of simple formats. Windows Movie Maker came as part of Windows ME, skipped 2000, and came back as part of XP.

            32bit isn’t an intrinsic lack because 3.2 GB is still more memory than most people can use and back in the day, SSDs were called “ramdisks” and they didn’t need special support because they looked like … disks. The first standalone ramdisk device I used had a Centronics SCSI port on it and held about 120 MB. The first-first one turned an Apple 16k memory card into a disk, in 1980, and they kept doing that with bigger and bigger cards until you could get a megabyte or two of ramdisk in an Apple //e in 1988. On a machine that typically had 300-400kb of attached disk storage.

            George Bush became President seven months before XP came out, and while it’s possible for an 11-year-old to become pregnant, she is not a teen mom, because she is not a teen.

          2. PhotoRob says:

            >>How old is XP?
            11 years (Released August 2001)

            >>It doesn't come with USB support without a service pack.
            Yes, it does.

            >>You can't share files over LAN with XP.
            Yes, you can.

            >>It doesn't come with support for displaying any movie files.
            Yes, it does.

            >>Only 32bit, only 3.2 GB of RAM and no SSD support.
            Correct on the 2nd point, wrong on the others.

            >>Bill Clinton was president.
            First: Huh??
            Second: No, he wasn’t. Bill Clinton left office in January 2001.

            >>Some girls who were born when it was released are now teenage mothers.
            Ummm… what? Did somebody change the rules of math recently?

            I’m pretty sure you’re thinking of Windows 98 (or possibly even 95).

            1. Tse says:

              USB support isn’t on the first versions of XP. It’s been added by a service pack. 64bit XP is shit, but it does support larger amounts of RAM. Oh, and while they are not teenage mothers, some girls do get pregnant at 11. It’s very rare, though.
              I think Kdansky just has a very old XP disk. And lack of USB support on disk can make installing the damn thing impossible if you don’t have a PS/2 keyboard. Same thing with SDDs. You can get it after you install XP, but how do you install without it?

              1. Kdansky says:

                Pretty much this.

                Sure, one can downplay the problems, but I’d rather have a system that works when I install it and doesn’t require me to hunt around for a few GB of patches so I can use my keyboard and share a file.

                Windows 7 is a really good system, XP is a really old system.

        2. Aldowyn says:

          I think his point was it’s kind of pointless to talk about a problem that’s been fixed already.

          I’m not sure if it HAS, because I don’t know enough about how the development process uses these things, but I think that was the idea.

  16. Rick C says:

    I haven’t read all the comments yet, but why would you look at programmatically creating a dialog box in memory, when you could just draw one up in Visual Studio, and write maybe a dozen lines of code?

    Message boxes are for quick yes/no operations. If you want to do anything beyond that, yeah, you have to make up your own dialog, but it’s not nearly as complex as what you see on the “Using Dialog Boxes” page.

    1. Deadfast says:

      why would you look at programmatically creating a dialog box in memory, when you could just draw one up in Visual Studio

      Shamus is a C++ programmer so the C++/CLI or C# feature Visual Studio offers is useless to him.

      Also, what to do mean by “creating in memory”?

      1. Rick C says:

        “Shamus is a C++ programmer so the C++/CLI or C# feature Visual Studio offers is useless to him.”

        I wasn’t talking about .Net stuff. Visual Studio’s resource editor has a dialog builder. All you’d need to do for this is drop three buttons and some text on a box, and make it return a different value for each button.

        “Also, what to do mean by “creating in memory”?”

        Did you follow his link? It was to a page on building a dialog-box template in memory, which is a lot more code. There’s no good reason to do that for basic dialogs.

        1. Kdansky says:

          Building them in memory is only sensible when you are writing library code where you don’t have access to the resource dll. In all other cases, you either create it with the editor or if you prefer to write it as code, it looks like this:

          Scroll to the first yellow box.

        2. Deadfast says:

          Ah, right, sorry. I wasn’t aware of the resource editor.

          1. Rick C says:

            “I wasn't aware of the resource editor.”

            No big, but it HAS been there since 16-bit Windows days. Admittedly, it isn’t there for Visual Studio Express, which is annoying. (You get the forms designer for .Net, but the resource editor for Win32 programs is missing, which is annoying.)

            1. Shamus says:

              This is a bit of a problem for me. Some of my really old projects were done while I still worked at Activeworlds and was using the company copy of Visual Studio. When I left, I gave that up for the Express edition. Now I can’t really work on those old projects (I don’t think I can even compile them, if I remember correctly) because of their dependence on .rc files.

              1. Kdansky says:

                The resource editor results in non-scaling dialogs anyway, which is suboptimal. I do the following: Write the dialogs in resource files to get all the things on them that are required. Edit the .rc files just like text files, even notepad will do (but VS has a “view as code” right-click option). Just slam the controls in the correct order for tabstops, and put the correct window styles there, but ignore size and position.

                Then write a function that overwrites onSize() and does the complete layout, through a list of GetDlgItem(ID_MY_RESOURCE_ID_THINGY).SetWindowPos(x,y,w,d,…) calls, or better, use member controls bound through data-exchange. Only caveat: The function can be called before OnInit() has completed, so you need to check whether your components are initialized already, and if not, just leave without doing anything. Since you’re doing layout in C++-code, you can get the current size, and scale stuff correctly.

                It gives you the flexibility of C++ code with the convenience of resource files. Create a data-exchange function for everything else, and shit’s easy!

                Am I the only one around here who knows how to properly write MFC code, despite only doing that for a year now?

                If wanted, I can copy-paste an easy example.

  17. Steve C says:

    All I could think about after reading half of this was “Won’t someone please think of the children!?!

    On a more serious note, this page touches on UI boxes and bad programming habits including how it translates. Japanese uses “correct” (hai) and “incorrect” (iie) rather than yes and no. But “you” is much more complex.

    I can imagine Shamus’ example (if translated into Japanese) to become the declarative statement, “Big brother wishes to kill children. Correct/Incorrect.”

  18. Chris says:

    I have realized over the last couple decades that code written in the moment to band aid fix a production problem using a development server will live on in the system for years only to be discovered when a server is taken down and something in production is no longer working, but a project that has a lot of time and effort may be abandoned within a year of being placed in production.

  19. Shamus, I would have designed it this way (if I was a Windows dev): “The files you are installing are older than the ones already installed.” “Continue | Abort”

    If Abort and Continue is not possible buttons then:
    “The files you are installing are older than the ones already installed. Continue?” “Yes | No”

    In both cases, “Continue” is the key focus here, after all the user most likely wanted to install/overwrite the files. And if they do not, then continuing is just weird in my opinion.

    Also, you gotta applaud MicroSoft for backwards compatibility.
    But they are making it stupidly convoluted.

    In one of my projects I’m targeting Windows 5.0 and up (This means I can always use Unicode compile which gives a small speed up and simplifies things. Only The old Windows 9x/Me range does not support unicode or not fully and need to be ANSI.
    This allows me to support the entire “modern” range of Windows OS (5.x and 6.x) people use.
    The program must run (and not crash, etc.) on Windows 5.0 (Windows 2000),
    take advantage of Windows 5.1 (Windows XP), 6.0 (Vista), 6.1 (Windows 7) features when detected/possible, and works on Windows 6.2 (Windows 8) and later hopefully. This is over a decade wide compatibility window. Mac OS is nowhere near that, nor even Linux. (correct me if I’m wrong, and we’re talking binary executables here and not packages that is built on the OS during install)

    The target OS is Vista/Windows 7 (with some bias towards Win7), and on Windows 2000 the program has some reduced functionality.
    But for some stupid reason the latest Visual C++ Express edition uses libs/MSVC code that reference some calls that only exist on Windows XP SP3+ if I recall correctly. But my program does not use it, and in fact the code is not used at all.
    But it causes a nasty error on Windows 2000, and even on XP SP1 and 2.
    Right now I have 3 versions of C++ Express installed, PLUS the Win SDK and the Win8 one.

    This is frigging silly. No wonder I like programming in PureBasic so much, at least calling the Windows API with that works nicely.

    On the MSDN site Windows XP (or one of it’s SPs) is now becoming the minimum supported OS for this or that API, even though the API existed on Windows 2000.

    Please note that when I make use of the Win32 API I make sure to follow the MSDN info, so I do not try to do hacks or tricks to make things work. It’s the same stance I take on HTML, CSS and Javascript. If I need a hack to make something work then I do not do it at all.

    I’d rather have my program or site still work OK several years down the road than have it fail stupidly.

    It’s people like me (and Shamus I assume) that API compatibility is intended for, but instead end up trying to make the nasty broken old stuff stay afloat.

    Raymond Chen’s The Old New Thing blog is a treasure trove of this. (he used to be on the Windows compatibility team if I recall correctly), and he often posts explanations on how or why something works they way it does in Windows. (lots of Win32 API stuff) you’ll like it Shamus he’s a smart and funny guy.

    1. Bryan says:

      Binaries built against the first glibc 2.0 releases (which came out in 1997) still work against the newest releases. That’s what symbol versioning gets you.

      The system call interface is stable all the way back to linux-0.0.1, as well — statically-linked binaries from that time still run today. (They may not be able to *do* much, mind you.)

    2. PhotoRob says:

      Shamus, I would have designed it this way (if I was a Windows dev): “The files you are installing are older than the ones already installed.” “Continue | Abort”

      If Abort and Continue is not possible buttons then:
      “The files you are installing are older than the ones already installed. Continue?” “Yes | No”

      In both cases, “Continue” is the key focus here, after all the user most likely wanted to install/overwrite the files. And if they do not, then continuing is just weird in my opinion.

      What do I do if I want to continue with the installation but *not* overwrite a newer version of a DLL with the older version included with the installer?

      Yes, I have encountered this a lot, especially when installing older (Win98 era) programs that work just fine on WinXP/Vista/7 but have a now ancient version of a DLL that has been long-since updated.

  20. Paul Spooner says:

    Good to hear you’re experimenting with code again! I hope this doesn’t mean that your authorial attempts have ceased… but we all know how this goes.

    Children eh? Perhaps logical subdivisions, some nested tree systems, a hierarchy or two? Do hope we get to see the result some time.

    Yeah, it does seem like a “generic button window” would be nice. Something that takes inputs of “title” “message text” “number of buttons” “button text 1” “button text 2” etc, and then returns 0 if the window is closed, and 1, 2, etc depending on which button was pressed. Doesn’t seem hard to implement… in fact, it seems like someone would have written a module to do this. Those hundred lines of code should be really portable! Goes back to the whole “object oriented” rant though.

  21. Since I mentioned Raymond Chen’s blog in my other comment, I’ll mention another. http://virtualdub.org/blog/ This is the blog of the guy behind VirtualDub, and he knows a lot about video and audio and rending issues on Windows and often posts about it.

    If you dig around his old posts/archive you’ll find some damn interesting stuff about getting accurate framerate timing/loop timing and what works or what messes up under certain conditions.

  22. BlackBloc says:

    >>>I understand that Microsoft does not have a company culture that fosters a lot of ease-of-use minded development.

    Actually, Microsoft has an entire R&D think tank that is ONLY devoted to software usability. They hire A LOT of people, to the point where out of the usability experts I’ve met in my life (our head of UI design and the UI teacher I had in university), all of them worked for Microsoft in that think tank.

    The problem is that they tend to mostly come up with the sci-fi stuff like Microsoft BOB, Clippy, the completely unusable UI from the last Office (based on a Kool Aid overdose with regard to the concept of roles-based UI) and Microsoft Surface, instead of, you know, coming up with a nice way to do the small everyday things.

  23. “Dear Fox News,

    Today I read on a webspot for heathenistic video games full of unhealthy notions (like shooting people and saying inappropriate words to lady-folk) the most heinous thing I’ve seen since my last letter. The proprietor of this interpage sitezone, one Shamus the Younger, has advocated the deleting of children! I suggest you have one of your news helicopters follow him around for a while and see what else he’s up to!

    P.S. I am not a crackpot.”

  24. Neko says:

    Something something Dark Side something something QMessageBox

      QMessageBox msgBox;
      msgBox.setText(tr("Hey, you're trying to delete this collection of objects."));
      msgBox.setInformativeText(tr("Do you also want to delete all the children?"));
      msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::YesToAll
                               | QMessageBox::Cancel);
      msgBox.button(QMessageBox::Yes)->setText(tr("Delete just &this child"));
      msgBox.button(QMessageBox::YesToAll)->setText(tr("Delete this && &all children"));
      msgBox.button(QMessageBox::Cancel)->setText(tr("&Oops. Don't delete anyone"));
      int ret = msgBox.exec();

    Sorry; I know we’ve been down this road before and you have good reasons to use Windows’ APIs over an external toolkit. I don’t want to come off as a screaming fanboy. I just wanted to say, well, it doesn’t have to be so hard.

    P.S. Ideally you’d make that msgBox on the heap and give it a parent of one’s parent Qt window, since then it a) takes care of memory for you and b) pops up centered on top of the parent window. Another pet UI peeve of mine (aside from the “Yes/No/Uncancel the Abort” problem) is apps that pop these things up centered on the screen despite their main window being a tiny thing that I have tucked in the corner of my second monitor.

  25. Mephane says:

    Are you sure you want to cancel the operation?

    OK | Cancel

    Once I saw something like this for real.

    1. Kdansky says:

      I have a piece of software here that says: “Calibration data not found! YES / CANCEL”

      YES: It will start regardless, and not work.
      CANCEL: It will show you a select screen for calibration data.

  26. Zak McKracken says:

    I can be quite the UI gourmet at times, and (also given that Heather doesn’t seem to like Unity) — I’d love to know your thoughts on KDE. (Just ask Heather to install Kubuntu, or install KDE in addition to gnome/Unity, then you can switch back and forth).
    Me, I’m an old KDE user, so my view may be skewed, but I’m totally in love with
    1: Mouse buffer (Linux thing: you select a text and you can paste it wherever you want with a center mouse click)
    2: empty adress lines with one click (cool if you want to insert the mouse buffer somewhere without selecting and deleting the current contents)
    3: windows will stick to each other or desktop margins, right-click on maximize button maximizes horizontally, middle-click vertically, left-click completely
    4: yes: Buttons with text on them :)
    5: the tree view in the file manager goes wherever you go in the main window
    6: ahh, a bunch of stuff
    7: only gripe: they got the “Kickoff menu” (AKA start menu) all wrong, and the older version is actually better, except they removed the excellent search option from that)

    1. Neko says:

      I recently tried out all the *ubuntus on a little netbook I bought; Unity was unsurprisingly slow (it’s nice in theory, just needs a better implementation), KDE was… strange, I think it saw my small display resolution and tried to set up a more “netbooky” desktop, which didn’t quite work out. LXDE was a bit too light for my tastes, but XFCE from xubuntu was just right. I really recommend it, it’s got all the convenience of a modern desktop environment without all the inconvenience of a “modern!!1” desktop environment.

      I’d load it up as my main desktop too, but I’ve got some old gnome and possibly xfce config cruft in my homedir that I need to clear out first; it’s picking up on that and just doesn’t look as good as the default from my clean xubuntu install.

      1. Asimech says:

        Heather is using Mint right now, and I recommend at most making LiveCDs. No point in installing OSes just to check out dialogue boxes. (@Zak)

        I used to have Xubuntu installed, but a HDD crash prompted me to try Lubuntu. I’m still using it mainly out of sloth.

        1. Zak McKracken says:

          You’re right about Live CDs having an advantage over installing.
          Except if you have the OS plus software plus all data and stuff already in place, then you can get it via package manager, use it for whatever you wanted to do anyway and switch back if you didn’t like it.

          I’m on SuSe with KDE here, and both our laptops run Kubuntu and Win7, with no problems. Although it may probably not be the best thing for a small netbook (actually, that may be what Gnome3/Unity was made for). I always spend some time on a new install to reconfigure it so I can fit more content/pixel on my screen. After that it’s more compact than most other desktop environments.

  27. lettucemode says:

    There are tools for this exact problem in Visual Studio. Maybe the reason they haven’t updated the API is because they want to encourage developers to use them. The problem you describe in the article – making a dialog box, getting the buttons and text lined up just right – takes less than 5 minutes with Visual Studio and a Windows Forms project. It has a nice WYSIWYG designer where you just click-and-drag buttons, text, and whatever else to where you want it to go, then double-click on the buttons to create an event handler for the click event. These hundreds of lines of code you complain about are all auto-generated for you.

    It has to be a C# project, but if you prefer C++ it’s not difficult to access a .DLL from inside the Windows Forms application, OR if you don’t want to have the C# as your main app, compile your new dialog box class into a .DLL and access that from your C++ code. It compiles to any version of .NET so you don’t have to worry about backwards compatibility. Sounds like you could have saved yourself some grief if you were aware of the dev tools Windows offers.

    EDIT: Unless you can’t use the DLLs that C# creates from your C++ code for some reason, such as cross-platform compatibility. In any event it’s clear that Microsoft wants devs to use VS and C# when making Windows desktop applications, so they make that the easiest way to do it. I don’t see anything wrong with that.

  28. Tse says:

    By the way, has anyone checked if Windows Vista/7 acknowledges a previously installed Windows 7/8. Because I friggin’ hate it when I have to install an older OS and muck about restoring my newer Windows’ ability to boot.

    1. Rick C says:

      Generally, older versions’ of Windows bootloaders don’t recognize newer versions’. If you want to dual-boot, you should install the older OS first. Then you’ve got to make sure to never do anything to edit the bootloader from the older OS, or it will wipe out the newer one, although that’s fixable.

      1. Tse says:

        So they haven’t fixed that yet. Oh well, good thing there are free programs to repair my boot after I install the older version of Windows. I usually use just 1 version, but when I’m forced to install an older OS for compatibility reasons I don’t want to muck about reinstalling my original OS.

  29. SG says:

    The worst part about windows is file selection in some software. That tiny window where you have to click every folder with mouse to open them.

    No idea why some file selectors use other explorer where you have favorite folders and can type folder path, but other programs use that tiny window. Like installing VST plugins of some companies.

    Why microsoft even designed it that way in 90’s? They could’ve see it’s bad. Why it’s still here in 2021 is other question.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply

Your email address will not be published.