Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-10

Did something change in KEYPRESS for TComboBox?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Maro

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.

-Tony

Reply by email

Mattias Gaertner
to Tony Maro
Show quoted text 7 lines
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

Reply by email