[Lazarus] How to make TBitButton set the ModalResult properly and close the form?
bo.berglund at gmail.com
Sun Feb 12 14:11:47 CET 2023
On Sat, 11 Feb 2023 21:15:25 +0100, Bo Berglund via lazarus
<lazarus at lists.lazarus-ide.org> wrote:
>So in order to fix this on the first form I have had to implement the OnClick
>event and code the following into them:
>ModalResult := mrOk
>(or mrCancel) as needed.
>This causes the wanted behaviour.
>But this was not how the Delphi TBitButton operated, why has it changed?
>And is there some way I can restore this functionality without having to add
>OnClick event handlers to all of these buttons?
>Some special $MODE setting perhaps?
>The Delphi converter I used in Lazarus to port the application put
>into most units..
It might be the converter that does this...
It made a new lfm file from the dfm that Delphi had made and maybe it did not
transfer the button kind properly so that the modalresult was not set as it
would be when the kind was selected...
Anyway by going over the forms and changing ModalResult to the proper value
depending on the Kind property value made it work as expected. No OnClick event
Now working properly.
Developer in Sweden
More information about the lazarus