Reading Keyboard Input using AdaGtk

戏子无情 提交于 2019-12-11 18:48:56

问题


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?


回答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.



来源:https://stackoverflow.com/questions/13534497/reading-keyboard-input-using-adagtk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!