Event Control.KeyPress (gb.qt4)
Event KeyPress ( )
Raised when a key is pressed while the control has the focus.
You get information about the pressed key with the
Key class.
After the KeyPress routine has finished, the Text inside a
TextBox
is edited by Gambas, according to the key. So it makes no sense to write
back into the Text property any information from the KeyPress event
handler, nor from any of the subroutines and functions it calls.
Rather use the
Change event, which comes after updating the content.
Example
[gb.markdown].Markup.ProcessCode.1104: Cannot load component 'gb.highlight': cannot find component
Event Cancellation
If you stop the event with
STOP EVENT, the control won't see the keyboard event at all.
Warning, Care should be taken as some controls will swallow the keypress event.
This depends both on the control and the toolkit being used.