[Lazarus] Cannot close Windows 10 application with a bkClose TBitBtn button...

Bo Berglund bo.berglund at gmail.com
Mon Nov 16 11:43:09 CET 2020

Lazarus 2.0.10 FPC 3.2.0 on Windows 10

I create a new application and place a TBitBtn on a panel at the
bottom of the main form. I set the Kind property to bkClose.

Now I expect the application to close when I click this button, like
it does on Delphi for the same type of button.

But when I run this test application it does not react to the click on
this button at all!
The only way to close the program is to click the X at the upper right
corner of the application window.

I even tried adding this to the OnClick event:

Close; //Does not work.
frmMain.Close;  //Does not work either

If I put a breakpoint at the OnClick event it does not even get there
when debugging...

What have I missed?

I am testing methods to use transparent (see-through) forms and this
test is done using code from this webpage:

My form is made transparent via the background color but on it there
is a non-transparent panel at the bottom (it does not inherit the
parent color) and this is where the button is placed.
Does the form's transparency block mouse clicks from non-transparent
components placed on the form?

Bo Berglund
Developer in Sweden

More information about the lazarus mailing list