Jump to content

Do we prefer to have a cancelled output or an ok output?


Recommended Posts

Depends a bit on your dialog. For example, if your dialog allows you to close the window (using the typical X) in addition to having Cancel and OK buttons, I would return the OK status, so that it's clear that closing the dialog and hitting the Cancel button both have the same effect.

Link to comment

If the dialog has only "Cancel" button (e.g. processing something with possibility to abort), I'd go with Cancelled output, because that's really the only action the user can do.

If it has "Cancel" and "OK" buttons, I'd go with OK output - positive logic is generally easier to grasp when you analyze the code.

However, this really depends on the context. And you can also ouput enum with "Cancel" and "OK" elements.

Link to comment
On 12/13/2016 at 3:40 AM, Neil Pate said:

I have flip-flopped with this issue for like forever.

Say I have a simple dialogue that can be cancelled by the user, is it more sensible to return the cancelled status or the ok status?

I have always done it by returning a Cancelled status, I am just curious as to what others think is sensible.

You could also return an error 43!

:(

The way I see it is that (a) positive logic is good and (b) there is only ever 1 good path (user enters values and presses OK) and depending on your dialog 1->N bad paths (cancel, hitting close, the dialog talks to something else and actually genuinely had an error, etc).*

Edited by smithd
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.