Connect(createid, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainFrame::CreatePart),NULL,create);
doesn't activate the function CreatePart(). I've tried it with the last argument as "this", and without the last two arguments at all. I couldn't think of anything to research for because I don't know what's wrong. Can someone tell me what I should've looked for and why the program doesn't work. Anything is helpful.
Code: Select all
#include"wx/wxprec.h"
#ifndef WX_PRECOMP
#include"wx/wx.h"
#endif
#include"wx/wxprec.h"
#include<iostream>
#ifndef WX_PRECOMP
#include"wx/wx.h"
#endif
#define playid 404
#define createid 666
class CreateFrame : public wxFrame
{
};
class MainFrame : public wxFrame
{
public:
MainFrame();
void CreatePart(wxCommandEvent& event);
};
///////////////////////////////////////////////
MainFrame::MainFrame()
:wxFrame(NULL, wxID_ANY, "Word Timer", wxDefaultPosition, wxDefaultSize)
{
this->SetSizeHints(wxSize(200,330), wxSize(200,330));
wxBoxSizer *mainpanelholder=new wxBoxSizer(wxVERTICAL);
wxPanel *mainpanel=new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
wxGridSizer *buttonbox=new wxGridSizer(2,1,0,0);
wxButton *create, *play;
create=new wxButton(mainpanel, createid, wxT("Create a timing"));
play =new wxButton(mainpanel, playid, wxT("Play a timing") );
buttonbox->Add(play,1,wxEXPAND|wxALL,5);
buttonbox->Add(create,1,wxEXPAND|wxALL,5);
mainpanel->SetSizer(buttonbox);
mainpanelholder->Add(mainpanel,1,wxALL|wxEXPAND, 25);
SetSizer(mainpanelholder);
//this->Centre();
//Connect(ctoqbuttonclick_ID, wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(MyFrame::Onctoqclick),NULL,this);
Connect(createid, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MainFrame::CreatePart),NULL,create);
}
//////////////////////////////////////////////
void MainFrame::CreatePart(wxCommandEvent& event)
{
std::cout<<"oeirtfoienasrtoiensrta";
//wxFileDialog *openfile=new wxFileDialog(this,wxT("Select the file to read"),wxT(""),wxT(""),wxOPEN|wxFILE_MUST_EXIST,wxDefaultPosition);
}
//////////////////////////////////////////////////
class Lyrics : public wxApp
{
virtual bool OnInit();
};
IMPLEMENT_APP(Lyrics)
bool Lyrics::OnInit()
{
MainFrame *blah=new MainFrame();
blah->Show(true);
}