[Lazarus] Default button for QuestionDLG

Jürgen Hestermann juergen.hestermann at gmx.de
Mon Oct 13 16:21:10 CEST 2014


Am 2014-10-13 um 13:58 schrieb Jürgen Hestermann:
>
> Am 2014-10-13 um 13:49 schrieb Jürgen Hestermann:
>>
>> Am 2014-10-12 um 12:57 schrieb Bart:
>>> On 10/12/14, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:
>>>
>>>> How can I specify the default button for QuestionDLG?
>>> function QuestionDlg(const aCaption, aMsg: string; DlgType: TMsgDlgType;
>>>                                      Buttons: array of const; HelpCtx: Longint): TModalResult;
>>>
>>> In the Buttons array of const, add the string  'isdefault' after the
>>> button you want to be the default one.
>>
>> Thanks, it works.
>
> That was too early. It does not work in all cases. In
>
> case QuestionDlg('File overwrite','File exists. Overwrite it?', mtConfirmation,
> [mrNo,'IsDefault',mrYes,mrIgnore,'neVer',mrAll,'All',mrAbort,'Stop '],0) of
>
> it just renames the standard "No" button to "IsDefault".
>

It seems that in this case I must add the (otherwise redundant) default text:

case QuestionDlg('File overwrite','File exists. Overwrite it?', mtConfirmation,
[mrNo,'No','IsDefault',mrYes,mrIgnore,'neVer',mrAll,'All',mrAbort,'Stop '],0) of

A strange behaviour which IMO *must* be documented instead of leaving everybody guessing.
But who knows how it *realy* is supposed to be?





More information about the Lazarus mailing list