Forum > LCL

[SOLVED] TBitBtn On Click not triggered

<< < (7/7)

Thaddy:
OnKeyDown needs to execute as much as possible, because it needs to maintain state.
It is often misused and misunderstood.
Usually it can be replaced with OnKeyUp which is a real single fire event.

So no wonder OnKeyDown has more code... It should have more.....

Not understanding the difference between the two is a very common design flaw.

E.g. with ctrl--<arrow keys> to navigate, OnKeyDown is the option. Otherwise use OnKeyUp.
LCL is literaly littered with that mistake. Even Delphi has a couple of issues, but far less so.

Handoko:

--- Quote from: wp on June 22, 2022, 09:27:59 am ---
--- Quote from: incendio on June 22, 2022, 09:21:44 am ---1. Did you experience the same problem with mine, that OnClick event is not triggered on TBitBtn?
--- End quote ---
Yes.

--- End quote ---

I didn't have that problem, it worked correctly on Linux. Here I created a short video:

https://imgur.com/a/n6qtAPJ

(Because of the limitation of uploaded file size here, I have to use online file sharing service).

dseligo:

--- Quote from: Handoko on June 22, 2022, 05:05:57 pm ---
--- Quote from: wp on June 22, 2022, 09:27:59 am ---
--- Quote from: incendio on June 22, 2022, 09:21:44 am ---1. Did you experience the same problem with mine, that OnClick event is not triggered on TBitBtn?
--- End quote ---
Yes.

--- End quote ---

I didn't have that problem, it worked correctly on Linux. Here I created a short video:

https://imgur.com/a/n6qtAPJ

(Because of the limitation of uploaded file size here, I have to use online file sharing service).

--- End quote ---

Since on Windows works differently than you posted I'd say it's definitely a bug.

dseligo:

--- Quote from: wp on June 22, 2022, 02:07:50 pm ---Well, maybe my description is not correct, it's a very complicated flow of events. Following the keypress with the debugger I saw that further code is executed after the OnKeyDown handler. Probably this should not be done, and I had the idea to "eat" the RETURN key by inserting "Key := 0" after "Qry.Append" - now the OnClick events of the Button and BitBtn are fired correctly.

--- End quote ---

This is interesting. But why some controls (TEdit and TBCButtonFocus, e.g.) works without it, and others needs 'Key := 0'?

incendio:

--- Quote from: wp on June 22, 2022, 02:07:50 pm ---Well, maybe my description is not correct, it's a very complicated flow of events. Following the keypress with the debugger I saw that further code is executed after the OnKeyDown handler. Probably this should not be done, and I had the idea to "eat" the RETURN key by inserting "Key := 0" after "Qry.Append" - now the OnClick events of the Button and BitBtn are fired correctly.

--- End quote ---

I choose this method to solve the problem  :D


--- Quote from: dseligo on June 22, 2022, 09:32:11 pm ---Since on Windows works differently than you posted I'd say it's definitely a bug.

--- End quote ---

Agreed. I will make a bug report.

Navigation

[0] Message Index

[*] Previous page

Go to full version