检查是否“控制”在lablgtk2中按下
我在 lablgtk2 中的 test_modifier 方法上遇到了很多麻烦。我可以测试 Shift,但这对我的目的来说不是很有用。每当我测试是否按下控制键和另一个键时,什么也没有发生。我也尝试过这个:
view#event#connect#key_press ~callback:(fun ev ->
let m = GdkEvent.Key.state ev in
let k = GdkEvent.Key.keyval ev in
if (m = [`CONTROL] && k = _F) then
...
它工作了一段时间,然后就停止了。上面的代码有什么问题,它不会做任何事情?如何在 lablgtk2 中正确测试 Control 键按下?
I'm having a lot of trouble with the test_modifier method in lablgtk2. I can test for Shift, but that isn't very useful for my purposes. Whenever I test if control and another key is pressed nothing happens. I've also tried this:
view#event#connect#key_press ~callback:(fun ev ->
let m = GdkEvent.Key.state ev in
let k = GdkEvent.Key.keyval ev in
if (m = [`CONTROL] && k = _F) then
...
It worked for awhile and then it stopped. What is wrong with the above code that it wouldn't do anything? How can I properly test for a Control key press in lablgtk2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一次可以有多个修饰符,因此与 [`CONTROL] 进行比较是无效的。
There can be several modifiers at once so comparing to [`CONTROL] is not valid.