[lazarus] Did something change in KEYPRESS for TComboBox?

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Oct 6 16:46:28 EDT 2002


On Sun, 6 Oct 2002 14:37:42 -0500
"Tony Maro" <TonyM at nlisc.com> wrote:

> I was happily doing autocomplete from within the KEYPRESS event of the TComboBox and just realized it has quit working.
> 
> I had been using selstart and sellength and changing the text of the box to modify what it said.  Now it's not doing that anymore... in fact it won't change the contents of the text property while in that routine.
> 
> So, I tried moving my code to the KEYUP event...
> 
> That almost worked, but I still can't do SELSTART and SELLENGTH to set the selection.

The keypress event was probably handled by the gtk combo after your changes.
Because the gtk combo reacts automatically to nearly all keys you must stop the signal. Do this, by changing the 'key' variable (For example to #0) in OnKeyPress.

This had worked before, because I have completed the OnKeyDown event. But it broke the OnKeyPress event. (evil workarounds! But slowly but steadily we are getting rid of them ... )
It didn't work for OnKeyPress, because there was a missing stop signal in the gtk-interface. Fixed.

But there is still a bug, which can be seen in the TComboBox of the find dialog. Sometimes the keys for TComboBox are not sent to the gtk-interface, but directly to the gtk combo. Strange.
Has anyone an idea why/how this happens?


Mattias






More information about the Lazarus mailing list