[Lazarus] Inconsistent results from MessageDlg()

patspiper patspiper at gmail.com
Wed Apr 25 19:07:41 CEST 2012


On 25/04/12 19:19, Bart wrote:
> Hi,
>
> I have created a patch which behaves like this:
> (see: http://bugs.freepascal.org/view.php?id=21801#attachments , file:
> msgdlg.diff)
>
>
> If the widgetset has a (native) PromptUser function, then the
> behaviour of the dialog is as follows:
> - Escape and [X]-bordericon will return mrCancel
>
> If no widgetset specific PromptDialog is set up, then eventually
> TPromptDialog.CreateMessageDialog() is called.
> I have changed it's behaviour to be compatible with Delphi:
> - [X]-bordericon will return mrCancel
> - Escape will only close the dialog if mbOk, mbNo or mbCancel is in Buttons,
>    in this case it will return mrCancel, mrNo or mrOk (in that order)
>    It does so by setting the Cancel property of the appropriate Button
>    (as long as TBitBtn.Cancel works across widgetsets, this should
> work, but I can only test this on windows myself)
I suggest TPromptDialog.CreateMessageDialog() behave the same as the 
widgetset's PromptDialog (both Escape and [X]-bordericon return 
mrCancel). That would be more consistent.

> This behaviour is consistent with both older Delphi's and newer ones
> using the new Vista-dialogs (as does Lazarus).
>
> To properly resond to mbClose, the proposed patch from
> http://bugs.freepascal.org/view.php?id=0021844 should also be applied.
As for TBitBtn, I suggest Lazarus respects the button's modalresult and 
acts accordingly.

Stephano




More information about the Lazarus mailing list