I am using Ada together with the Gtk library. I would like to read the user's keyboard input and react individually on it, depending which keys he/she pressed. How can I access the keyboard input from the user?
Asked
Active
Viewed 240 times
1 Answers
1
I'm not sure what you're looking for: 1) keystrokes or 2) editable text.
The game
LinXtris
handles main windowkey_press_event
signals in the procedureOn_Main_Window_Key_Pressed
, which passes eachGdk.Event.Gdk_Event_Key
on to theGame_Engine
.The
Interaction
demo cited here has aGtk.Editable
that handlesSignal_Insert_Text
in the procedureOn_Insert_Text
. The advantage is that the handler is called for single keystrokes, as well as pasted text.