From: <pha...@us...> - 2007-08-02 07:40:08
|
Revision: 45 http://chessdrills.svn.sourceforge.net/chessdrills/?rev=45&view=rev Author: phantomfive Date: 2007-08-02 00:40:05 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Finally figured out that problem. Can now select a drill and the constructor will get called. Modified Paths: -------------- gui/MainWindow.cpp gui/MainWindow.h Modified: gui/MainWindow.cpp =================================================================== --- gui/MainWindow.cpp 2007-07-20 21:08:09 UTC (rev 44) +++ gui/MainWindow.cpp 2007-08-02 07:40:05 UTC (rev 45) @@ -19,7 +19,16 @@ BEGIN_EVENT_TABLE(MainWindow, wxFrame) EVT_MENU(ID_Quit, MainWindow::OnQuit) -EVT_MENU(ID_SelectDrill, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill1, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill2, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill3, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill4, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill5, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill6, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill7, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill8, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill9, MainWindow::OnSelectDrill) +EVT_MENU(ID_SelectDrill10, MainWindow::OnSelectDrill) EVT_PAINT(MainWindow::Redraw) END_EVENT_TABLE() @@ -59,8 +68,8 @@ wxMenu *menuFile = new wxMenu; wxMenuBar *menuBar = new wxMenuBar; const char ** menuList = ctl.GetDrillList(); - for(int i=0;menuList[i]!=NULL;i++){ - menuFile->Append( ID_SelectDrill,menuList[i]); + for(int i=0, j=(int)ID_SelectDrill1;menuList[i]!=NULL;i++,j++){ + menuFile->Append( j, menuList[i] ); } menuFile->AppendSeparator(); menuFile->Append( ID_Quit, "&Exit" ); @@ -166,6 +175,11 @@ void MainWindow::OnSelectDrill(wxCommandEvent& event) { - wxMenuItem *item = (wxMenuItem *)event.GetObject(); - printf("drill selected: %s\n",item->GetText()); + int id = event.GetId() - ID_SelectDrill1; + const char ** menuList = ctl.GetDrillList(); + printf("in select drill\n"); + + printf("drill selected: %s\n",menuList[id]); + ctl.SwitchToDrill( menuList[id] ); + } Modified: gui/MainWindow.h =================================================================== --- gui/MainWindow.h 2007-07-20 21:08:09 UTC (rev 44) +++ gui/MainWindow.h 2007-08-02 07:40:05 UTC (rev 45) @@ -24,6 +24,7 @@ MainWindow(const wxString &title, const wxPoint &pos, const wxSize &size); void OnQuit(wxCommandEvent &event); void Redraw(wxPaintEvent &event); + void OnSelectDrill(wxCommandEvent& event); DECLARE_EVENT_TABLE() //PUBLIC METHODS @@ -68,7 +69,17 @@ }; enum{ - ID_Quit = 1 + ID_Quit = 1, + ID_SelectDrill1, + ID_SelectDrill2, + ID_SelectDrill3, + ID_SelectDrill4, + ID_SelectDrill5, + ID_SelectDrill6, + ID_SelectDrill7, + ID_SelectDrill8, + ID_SelectDrill9, + ID_SelectDrill10 }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |