Monday, 1 November 2010

No Yes/No/Cancel, Please

Filed under: Programming — Jan Goyvaerts @ 14:01

Sometimes it’s the little features that make a software product much more usable. For as long as I can remember, closing Delphi, recompiling the application, or opening another project while your app was still running has always made Delphi ask: “Debug session in progress. Terminate?” You could click OK to terminate your app, or click Cancel to stay where you were.

Delphi XE has a new prompt with over 5 times as many words: “This current debug session must end before the requested operation can complete. Please indicate how you would like to end the debug session.” Though the long statement is not much friendlier that the old short question, the buttons are. The button that terminates your app is now labeled Terminate instead of OK. But the highlight is the brand new Detach button. If you click it, Delphi stops debugging your app, while your app continues to run. Delphi then does whatever you asked it to do that caused the prompt to appear. It’s a very handy option. I’ve used it many times already, even though I’ve been using Delphi XE for only a few weeks. After I came to appreciate the Detach button, I found the Detach from Program item in the Run menu. It stops debugging the app while letting it run, without doing anything else.

But this post isn’t about detaching your debugger from your app. Today’s lesson is that for an app to be user-friendly, features must be presented in the context where they are useful. You see, Delphi 2010 also has the Detach from Program item in the Project menu. I never used it, because I never noticed it, because I never looked for it, because Delphi 2010 continued to use the same old “Terminate?” question.

Don’t use the standard OK/Cancel or Yes/No/Cancel message boxes. Present a message that clearly explains what is going on. Use custom buttons that clearly represent their consequences. Give me “Save Changes” and “Lose Changes” buttons, not “Yes” and “No” buttons that may make me click “No! Don’t do that!” which your app interprets as “No! I don’t want to keep all my hard work.” Once you’re free of the canned Yes/No/Cancel buttons, you can offer more than 3 choices if your application can do more than 2 things besides doing nothing, so people will actually use the options you worked so hard on.