[Lazarus] Inconsistent results from MessageDlg()

patspiper patspiper at gmail.com
Sun Apr 22 13:35:59 CEST 2012


On 22/04/12 14:09, zeljko wrote:
>
> On Sunday 22 of April 2012 12:28:43 Bart wrote:
>
> > Hi all,
>
> >
>
> > MessageDlg eventually calls WidgetSet.PromptUser()
>
> > This in return either calls and sets up a widgetset specific function
>
> > (like TaskDialogIndirect on Windows Vista/Win7) or if such an
>
> > implementations does not exist it calls
>
> > TPromptDialog.CreateMessageDialog() and the LCL will build it's own
>
> > MessageDialog form with appropriate buttons etc.
>
> >
>
> > I see 3 problems (see http://bugs.freepascal.org/view.php?id=21801 ).
>
> >
>
> > 1.
>
>
>
> > How to handle clicking on X-border-icon?
>
>
> afair, qt and gtk2 have default result for that and escape key (you 
> can set on dialog what is the value of default result for [X] and 
> escape), result should be mrCancel in any case.
>
+1

The current result for Escape and [x] (at least under GTK2) is mrOK 
which is very misleading.

But I have a slightly different suggestion:

1- This should apply to any modal form, not only MessageDlg and 
WidgetSet.PromptUser.

2- Escape key should first check if any button has Cancel=true, and use 
that button's modal result. Otherwise, mrCancel is in order as the user 
is running away from answering the dialog.

3- [x] should either return mrCancel, or mimic the Escape key. The 
latter is the more logical choice, as the programmer has intentionally 
defined the action (by setting a button's Cancel to true) if the user 
wants to run away.

Stephano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120422/4f563c26/attachment-0003.html>


More information about the Lazarus mailing list