| Did you know ... | Search Documentation: |
| text->typed |
|event_idtext does not provide default
event-handling, but editable text
objects are easily created by forwarding keyboard-events to this method:
:- pce_global(@edit_text_recogniser,
new(handler(keyboard,
message(@receiver,
typed,
@arg1)))).
text_make_editable(T) :-
send(T, recogniser, @edit_text_recogniser).
This method uses the key_binding
object called text from @key_bindings
to map the typed keys on selectors and then invokes methods on class text.
With the above, if the user types control-U to the text the following
happens:
->typed
using
@edit_text_recogniser.<-id
is processed by the text key_binding
object and mapped on the selector clear. text->clear
does not require arguments and the key_binding
object just invokes text->clear.->clear erases all characters from
the text.
Diagnostics: Fails if the keyboard event could not be handled.
->show_caret ->caret <-pointed .key_binding <-key_binding