使用AdaGtk读取键盘输入 [英] Reading Keyboard Input using AdaGtk
问题描述
我正在使用Ada和Gtk库。
我想读取用户的键盘输入并单独作出反应,具体取决于他/她所按的键。我怎样才能访问用户的键盘输入?
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)击键或2)可编辑文本。
I'm not sure what you're looking for: 1) keystrokes or 2) editable text.
-
游戏
LinXtris
处理主窗口key_press_event
信号程序On_Main_Window_Key_Pressed
,它将每个Gdk.Event.Gdk_Event_Key
传递给Game_Engine code>。
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
.
INTERAC
示例引用此处有一个 Gtk.Editable ,它处理
On_Insert_Text
过程中的 Signal_Insert_Text
。优点是处理程序只需要一次按键和粘贴文本。
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.
这篇关于使用AdaGtk读取键盘输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!