[Lazarus] TBitBtn with Kid=bkClose and ModalResult
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Sun Apr 22 11:29:04 CEST 2012
Bart schrieb:
> On 4/21/12, Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
>
>> I'd suggest that an explicitly set ModalResult should be checked, before
>> actions are invoked that are incompatible with modal forms. But Delphi
>> also checks Kind *before* ModalResult, so this is a compatibility issue.
>
> If you have a recent Delphi version can you test what the ModalResult
> is when you close a Modal form by clicking on a TBitButton with Kind =
> bkClose and Modalresult = mrClose (just put a TBitBtn on this form and
> in OI set Kind = bkClose) ?
It will be the default result, when the ModalResult property is never
changed in code. I.e. the same as when the dialog is closed using ALT-F4
or the border icons. I assume that ModalResult is initialized during
ShowModal, else the result from the *previous* ShowModal would be returned.
From Delphi help:
mrNone 0 None. Used as a default value before the user exits.
> (My Delphi (3) does have bkClose as a valid choice for TBitBtnKind,
> but it does not have mrClose as a valid choice for TModalResult, so it
> obviously will not return mrClose.)
From D7 help:
>>
TModalResult represents the value returned by a modal dialog. An
application can use any integer value as a modal result value.
<<
I.e. one can define mrClose and assign it to the close button's
ModalResult. But this won't help, when the button logic doesn't use the
ModalResult when Kind=bkClose.
DoDi
More information about the Lazarus
mailing list