[Lazarus] How to make TBitButton set the ModalResult properly and close the form?
bo.berglund at gmail.com
Sat Feb 11 21:15:25 CET 2023
I am porting a Windows application from Delphi2007 to Lazarus/Fpc and have run
into problems with the dialog forms used in the app.
They are all provided with two TBitButton buttons, one for OK and the other for
But unlike how it works on Delphi when I use any of these when running the
ported app nothing at all happens! Luckily I have kept the close button on the
form border so it can be closed that way.
But then I cannot get any confirmation back to the main application...
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..
I have a queue of utilities I need to port so it would be good not having to
deal with all of these dialogs...
Developer in Sweden
More information about the lazarus