MESSAGE statement (windows) and the "X", is there

Posted by Stefan Marquardt on 10-May-2019 12:45

The customer raised the error that sometimes the message box has no "X" (close window) with option "YES-NO"

I ran some tests with this template:

-------------------------------------------------------------

DEF VAR RESULT AS LOGICAL INIT YES.

message "Are you sure ?"
    view-as alert-box question BUTTONS {OPTIONS} update RESULT .

MESSAGE RESULT
   VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.

-------------------------------------------------------------

{OPTIONS}

YES-NO: X = (not avail), Yes = yes, No = no
YES-NO-CANCEL: X = ?, Yes = yes, No = no, Cancel = ?
OK: X = yes, OK = yes
OK-CANCEL: X = no, OK = yes, Cancel = no
RETRY-CANCEL : X = no, RETRY = yes, Cancel = no

Suspicious results:

1.) Having no X with YES-NO 
2,) X is sometimes ? or No
3:) Cancel is sometimes ? or no

Never noticed and thought about that since I got a defect by test management today.

All Replies

Posted by Matt Gilarde on 10-May-2019 13:36

The YES-NO option having no "X" (close window) button is standard Windows behavior. When you ask a Yes/No question the user has to pick one of the choices. Users expect the safer thing to happen when they hit Escape or use the close button but we don't know what the safer thing is when the only choices are Yes and No. What if the question is "Undo Thanos's snap from the last movie? Yes or No?" and you hit Escape? That was our one chance.

I also find the fact that Cancel sometimes returns NO and sometimes returns ? inconsistent but this is the documented behavior and changing it now would break existing applications.

From the documentation for the MESSAGE statement: "If the alert box has two buttons, they represent the values TRUE and FALSE, respectively. If the alert box has three buttons, they represent the values TRUE, FALSE, and the Unknown value (?), respectively."

Posted by Simon L. Prinsloo on 10-May-2019 13:50

Hi Stephan

The results you saw is exactly what I would expect.

If there is only one option, the result will always be positive (Yes), regardless of how you close the box.

If there is two options, one will be naturally positive and the other naturally negative. I would always expect X to match the negative option, because it sort of signals to me that the user don't want to answer the question.

If there are three options (YES-NO-CANCEL) it is (vaguely) documented that Cancel will be ?, to signal that the user did not exercise a decision. It makes sense that X matches Cancel in this case, because the user closed the box without making a decision.

I do however believe that the fact that the box is not consistently presented is a defect.

In my opinion a message box should never have a X. I am telling the user something and need him to acknowledge it, or I am asking a question and I expects an answer. The presence of the X is misleading and creates the impression that the user can ignore me and something else will happen. But what?

Alternatively, if X matches Cancel for OK-CANCEL, it can just as well match NO for YES-NO, so if it must be there, let it always be there.

Posted by Simon L. Prinsloo on 10-May-2019 13:50

Hi Stephan

The results you saw is exactly what I would expect.

If there is only one option, the result will always be positive (Yes), regardless of how you close the box.

If there is two options, one will be naturally positive and the other naturally negative. I would always expect X to match the negative option, because it sort of signals to me that the user don't want to answer the question.

If there are three options (YES-NO-CANCEL) it is (vaguely) documented that Cancel will be ?, to signal that the user did not exercise a decision. It makes sense that X matches Cancel in this case, because the user closed the box without making a decision.

I do however believe that the fact that the box is not consistently presented is a defect.

In my opinion a message box should never have a X. I am telling the user something and need him to acknowledge it, or I am asking a question and I expects an answer. The presence of the X is misleading and creates the impression that the user can ignore me and something else will happen. But what?

Alternatively, if X matches Cancel for OK-CANCEL, it can just as well match NO for YES-NO, so if it must be there, let it always be there.

Posted by Stefan Marquardt on 10-May-2019 14:42

Thanks for your valuable comments, my problem is that I rarely read docs and expect a logical consistent option. :-)

But that message boxes with YES/NO have no X because it's a windows standard isn't true every time, opposite example by Microsoft itself: File delete confirmation in the file explorer. :-)

stackoverflow.com/.../yesno-messagebox-not-closing-when-x-button-clicked

Posted by Matt Gilarde on 10-May-2019 14:50

The Delete File confirmation uses a different type of dialog than the one we use in OpenEdge for the MESSAGE statement. You're right that it's not consistent behavior in Windows but in the Delete File case Microsoft knows what the question is so they can declare that closing the box without answering is safe. We can't do that in OpenEdge since the question could be anything.

This thread is closed