使用AdaGtk读取键盘输入 [英] Reading Keyboard Input using AdaGtk

查看:230
本文介绍了使用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.


  1. 游戏 LinXtris 处理主窗口 key_press_event 信号程序 On_Main_Window_Key_Pressed ,它将每个 Gdk.Event.Gdk_Event_Key 传递给 Game_Engine code>。

  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.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆