[Lazarus] Inconsistent results from MessageDlg()

zeljko zeljko at holobit.net
Sun Apr 22 14:02:44 CEST 2012


On Sunday 22 of April 2012 13:35:59 patspiper wrote:
> 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.

Maybe in case when there's only one button (mbOK). Have you tested with eg. 
mbYes,mbNo or others ?
Also , maybe I didn't spotted that in my applications since i never evaluate 
1. if there's only one button (so thats dialog with information or error, I 
don't care how user closed that dlg)
2.anything except mrResult which should continue (usually mrYes or mrOk).
eg. if MessageDlg(blabla) <> mrYes then
  exit;

zeljko

> 
> 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/b24c449d/attachment-0003.html>


More information about the Lazarus mailing list