Hi,
I'm using Lazarus 2.2.4 on Win11.
I have a form with a tstringgrid to show statusmessages of certain actions. The grid should not receive focus. For using the Tab key that is easy, set property TabStop = False.
But that is no solution for a mouseclick. Of course, I can set the property Enabled = False but that changes the colorsettings.
So I tried a OnEnter method to check the LastActiveControl and giving back the focus. But in all my tests, ActiveControl and LastActiveControl are always the stringgrid.
Thus, I tried the DefocusControl method. That works, the stringgrid doesn't noticiabbly receive the focus. But the focus always goes back to the first control in the form and not to the control that had the focus before the stringgrid.
Therefor I have a few questions:
1. Can anyone explain why ActiveControl and LastActiveControl are always the same?
2. Is the method OnEnter the right place to use DefocusControl?
3. Is there anything else I can try to prevent an enabled control to receive the focus by mouseclick?
4. How can I set the colors of an enabeld control as if it is not enabled?
Thx