是否有可能赶上wxFrame鼠标事件 [英] Is it possible to catch mouse events in wxFrame

查看:101
本文介绍了是否有可能赶上wxFrame鼠标事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找的网站,并试图找出是否有可能赶在wxWidgets的实际wxFrame元素的鼠标事件。各种消息来源说,这是不可能的,wxPanels应该用来捕获事件,是真的吗?

I have been searching the web and trying to find out if it is possible to catch mouse events in the actual wxFrame element in wxWidgets. Various sources say it is not possible and wxPanels should be used to capture events,is that true?

感谢

推荐答案

鼠标事件的不可以向上传播窗口层次结构,因此,如果你的框架是由其他窗口完全覆盖,那么它不得到任何鼠标事件摆在首位,因此你不能抓住他们那里。

Mouse events are not propagated upwards the window hierarchy, so if your frame is entirely covered by other windows, then it doesn't get any mouse events in the first place and hence you can't catch them there.

当然,你可以随时处理任何其他窗口中的任何事件的方法 wxFrame 类使用绑定()。例如:

Of course, you can always handle any event from any other window in a method of wxFrame class using Bind(). For example:

MyFrame::MyFrame(...)
    : wxFrame(...)
{
    wxPanel* p = new wxPanel(this);
    p->Bind(wxEVT_MOTION, &MyFrame::OnMouseMotion, this);
}

将允许你处理鼠标移动事件发生在上一帧的方法面板。

would allow you to handle mouse motion events happening over the panel in a frame method.

这篇关于是否有可能赶上wxFrame鼠标事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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