[Lazarus] MessageDlg() return type

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 12 23:21:28 CEST 2012


On Wed, 12 Sep 2012 17:09:39 +0200
Giuliano Colla <giuliano.colla at fastwebnet.it> wrote:

> Il 12/09/2012 16:44, Graeme Geldenhuys ha scritto:
> >
> >
> > At runtime I click on the "Abort" button and the console output is 3 
> > ????  I'm using LCL-GTK2.
> >
> > So what is 3? It's not the enum value of mbAbort, it is also not the 
> > set value of mbAbort in the button set I passed to MessageDlg(). Sets 
> > start from value zero correct?  So where does the value 3 come from?
> >
> >
> 
> TmodalResult is just a set of Integers.

a range of integer.

 
>  From the Forms Unit: TModalResult = low(Integer)..high(Integer);
> 
> That way it allows you to define any custom Modal Result for your own 
> purposes in modal forms, besides the first predefined 12 values.
> 
>  From the unit Controls of Lazarus LCL:
> 
> const
>    mrNone = 0;
>    mrOK = mrNone + 1;
>    mrCancel = mrNone + 2;
>    mrAbort = mrNone + 3;
>    mrRetry = mrNone + 4;
>    mrIgnore = mrNone + 5;
>    mrYes = mrNone + 6;
>    mrNo = mrNone + 7;
>    mrAll = mrNone + 8;
>    mrNoToAll = mrNone + 9;
>    mrYesToAll = mrNone + 10;
>    mrClose = mrNone + 11;
>    mrLast = mrClose;
> 
> mrAbort is a modal result which may derive from a dialog, but also from 
> a custom modal form. It has nothing to do with mbAbort, which is a just 
> an enumerated Button type for a Message dialog.
> bkAbort is a TBitBtn Kind, which is different from both mbAbort and mrAbort.
> 
> I believe that this has to do with Delphi compatibility, but it makes 
> sense nonetheless.

Yes

Mattias




More information about the Lazarus mailing list