[Lazarus] Lazarus 1.6 and QuestionDLG

Ondrej Pokorny lazarus at kluug.net
Sun Dec 20 08:06:49 CET 2015


On 19.12.2015 16:34, Mattias Gaertner wrote:
> On Sat, 19 Dec 2015 11:17:26 +0100
> Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:
>
>> Am 2015-12-13 um 16:52 schrieb Ondrej Pokorny:
>>   > The escape key selects mrCancel now (this was changed) -
>>
>> I am not sure I understand this right.
>> Does it mean, mrCancel needs to be
>> checked too in a case statement like this?
>>
>> case QuestionDlg('COPYING',
>>                    'Abort?',
>>                    mtConfirmation,
>>                    [mrNo, '&No','IsDefault',
>>                    mrYes,'&Yes'],0) of
>>      mrYes : ...
>>      mrNo : ...
>>      end; // of case
>>
>> Can the result be mcCancel even when it's not part
>> of the parameter list of the QuestionDlg function?
> Yes. Many widgetsets support an Escape key and/or have a close button.
> That's why there is the 'IsCancel' option to redirect the cancel
> to a button of your choice.

Mattias is completely right here. I just add that you had to care for 
mrCancel before as well (if default dialog was shown). It was returned 
when the dialog was closed with the system close button in the window 
caption. So the test code you sent isn't good for 1.4 either.
Now the behavior should be consequent:
no 'iscancel' button defined: mrCancel is returned on ESC/close.
'iscancel' defined: its modal result is always returned on ESC/close.

Ondrej




More information about the Lazarus mailing list