0

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?

T.E.D.
  • 44,016
  • 10
  • 73
  • 134
schrobe
  • 767
  • 2
  • 8
  • 29

1 Answers1

1

I'm not sure what you're looking for: 1) keystrokes or 2) editable text.

  1. The game LinXtris handles main window key_press_event signals in the procedure On_Main_Window_Key_Pressed, which passes each Gdk.Event.Gdk_Event_Key on to the Game_Engine.

  2. The Interaction demo cited here has a Gtk.Editable that handles Signal_Insert_Text in the procedure On_Insert_Text. The advantage is that the handler is called for single keystrokes, as well as pasted text.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045