[Lazarus] TBitBtn with Kid=bkClose and ModalResult

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Apr 23 21:46:27 CEST 2012


Bart schrieb:
> On 4/22/12, Bart <bartjunk64 at gmail.com> wrote:
> 
>> If you have a modern Delphi (as in higher then D3) could you please test
>> this.
>> Put a TBitBtn on a form.
>> Set Kind = bkClose (in OI)
>> Set Modalresult = mrClose (in OI)
>> ShowModal this form
>> Click on this TBitBtn
>> What is the value Modalresult: mrCancel or mrClose?
>>
>> Bart
>>
> 
> I had someone with Delphi XE test this for me. Delphi returns mrClose
> in this case, so I think this is LCL bug.

Here it returns mrCancel by default. When the ModalResult of the button 
is specified, this value is returned. On close with "X" the result is 
always mrCancel.

Not worth to mimic this inconsistent behaviour in the LCL, IMO.
Older Delphi code also will be fooled when mrClose is returned, which 
has been introduced only after D7.

DoDi





More information about the Lazarus mailing list