【问题标题】:how to handle mouse events of parent window in wxwidgetswxwidgets中如何处理父窗口的鼠标事件
【发布时间】:2014-03-20 23:39:13
【问题描述】:

我有一个父窗口,上面有一个子窗口,如何处理从子窗口到父窗口的鼠标事件。

这是我的代码:

   //parent class
   IMPLEMENT_DYNAMIC_CLASS(MWParent, wxPanel)
    BEGIN_EVENT_TABLE(MWParent, wxPanel) 
    EVT_LEFT_DCLICK(MWParent::OnMouseLeftDClick)
    EVT_RIGHT_DOWN(MWParent::OnMouseRightclick)
    END_EVENT_TABLE()

    MWParent::MWParent()
    {
    }
    MWParent::~MWParent()
    {

    }
    MWParent::MWParent( wxWindow *win , long id ):wxPanel( win , id ){
            MWChild *obj = new MWChild(this);
    }

   //child class

    IMPLEMENT_DYNAMIC_CLASS(MWChild, wxPanel)
    BEGIN_EVENT_TABLE(MWChild, wxPanel) 
    END_EVENT_TABLE()

    MWChild::MWChild()
    {
    }
    MWChild::~MWChild()
    {

    }
    MWChild::MWChild( wxWindow *win , long id ):wxPanel( win , id ){


}

【问题讨论】:

    标签: c++ visual-c++ wxwidgets


    【解决方案1】:

    使用Bind() 将子事件连接到任何其他窗口(可能是父窗口)中的处理程序。

    更多信息请参见the event handling overview

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多