[Lazarus] Inconsistent result from MessageDlg
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Fri Aug 19 16:03:14 CEST 2011
Bart schrieb:
> If you have a MessageDlg (without a mrCancel button) and you click the
> "Close" border-icon of the dialog then the result now depends on your
> OS (on Windows that is)
>
> On Windows Vista (and up) the result will be "EscapeResult" (user
> presses Escape key: the result depends on the actual buttons in the
> dialog: it will be mrNo if you have [mbYes,mbNo] as buttons).
> On lower Windows versions it will be mrCancel always.
Two buttons of an Dialog can have the special properties Default (CR)
and Cancel (Esc).
IMO it's perfectly sufficient to also map Close to the Cancel button,
and to disallow Close when no button has Cancel=True. This will leave it
up to the designer, to specify the intended behaviour and results of the
dialog. Adding more actions and implicit return values, than specified
by the designer, can cause a misinterpretation of these unexpected
results, what is highly undesireable.
DoDi
More information about the Lazarus
mailing list