Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / ExternalEventHandler

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. ExternalEventHandler
#6164
Posted by: daesdemon 2005-05-25 01:53:21
Hello alls,

I would like to have a controller control my windows Event
So i do it like this:

class WindowController
{
    WindowController(wxWindow* window)
    {	        
        window->Connect(wxEVT_LEFT_DOWN,(wxObjectEventFunction)&WindowController::OnMouseButtonDown);
        window->Connect(wxEVT_LEFT_UP,(wxObjectEventFunction)&WindowController::OnMouseButtonUp);
        window->Connect(wxEVT_MOTION,(wxObjectEventFunction)&WindowController::OnMouseMove);
    }

    OnMouseButtonUp(wxMouseEvent& event);
    OnMouseButtonDown(wxMouseEvent& event);
    OnMouseMove(wxMouseEvent& event);
}

And a Window Class normal

class MyWindow::public wxWindow
{
    WindowController* mController;
    MyWindow(wxWindow*parent):wxWindow(parent,wxIDAny)
    {
        mController  = new WindowController(this);
    }
}
The problem is when i capture the input in my OnMouseButtonDown Controller Function, it crashs.

My Question is :
Do my Controller Class have to be a wxEvtHandler Derivate to be able to manage that?

Thx in advance.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Mon 2022-8-8  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0