From: Steve K. <ha...@ya...> - 2006-05-30 21:21:12
|
Thanks for your reply. Just abit of adamant, why the following code in c++ works as expected? #include "wx/wx.h" #include "wx/frame.h" class test: public wxFrame { DECLARE_CLASS( test ) DECLARE_EVENT_TABLE() public: test( wxWindow* parent, wxWindowID id = -1, const wxString& caption = _("Test")); void OnLeaveWindow( wxMouseEvent& event ); }; IMPLEMENT_CLASS( test, wxFrame ) // Is the following equivalent to frame:ConnectEvent(wx.wxEVT_LEAVE_WINDOW, OnLeaveWindow) ? BEGIN_EVENT_TABLE( test, wxFrame ) EVT_LEAVE_WINDOW( test::OnLeaveWindow ) END_EVENT_TABLE() test::test( wxWindow* parent, wxWindowID id, const wxString& caption ): wxFrame( parent, id, caption){} void test::OnLeaveWindow( wxMouseEvent& event ){ wxMessageBox(_("Leave window in c++; works")); } class ClGUIApp: public wxApp { DECLARE_CLASS( ClGUIApp ) DECLARE_EVENT_TABLE() public: ClGUIApp(); virtual bool OnInit(); virtual int OnExit(); }; DECLARE_APP(ClGUIApp) IMPLEMENT_APP( ClGUIApp ) IMPLEMENT_CLASS( ClGUIApp, wxApp ) BEGIN_EVENT_TABLE( ClGUIApp, wxApp ) END_EVENT_TABLE() ClGUIApp::ClGUIApp(){} bool ClGUIApp::OnInit() { test* mainWindow = new test( NULL, -1 ); mainWindow->SetSize(400,300); mainWindow->Show(true); return true; } int ClGUIApp::OnExit(){ return wxApp::OnExit(); } Cheers, S.KIEU --------------------------------- On Yahoo!7 Socceroos Central: Latest news, schedule, blogs and videos. |