是否有可能赶上wxFrame鼠标事件

是否有可能赶上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.