Code: Select all
void SimpleMenu::Ontwo(wxCommandEvent & event)
{
wxFrame* frame = new twosplit(NULL); //change four to three or two to change layout
}
Code: Select all
void SimpleMenu::Ontwo(wxCommandEvent & event)
{
wxFrame* frame = new twosplit(NULL); //change four to three or two to change layout
}
Code: Select all
SetTopWindow(frame);
frame -> show(true);
Code: Select all
Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(SimpleMenu::OnQuit));
Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(SimpleMenu::Ontwo));
Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(SimpleMenu::Onthree));
Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(SimpleMenu::Onfour));
splits are window splits oops, I created functions called On two and so on to call for a frame that has a split-screen. splits is the nickname i gave it i guess sorry
Please put a minimal code describig what you are doing. We can't peep on your machine to see what you are doing!
The advice was not for solving this issue. Avoid connect and event tables. Always use Bind
Code: Select all
Bind(wxEVT_COMMAND_MENU_SELECTED, &SimpleMenu::OnQuit, this);
Bind(wxEVT_COMMAND_MENU_SELECTED, &SimpleMenu::Ontwo, this);
Code: Select all
menubar = new wxMenuBar;
file = new wxMenu;
file->Append(wxID_EXIT, wxT("&Quit"));
file->Append(wxID_ANY, wxT("&two Screen Split"));
file->Append(wxID_ANY, wxT("&three Screen Split"));
file->Append(wxID_ANY, wxT("&four Screen Split"));
menubar->Append(file, wxT("&File"));
SetMenuBar(menubar);
Code: Select all
void SimpleMenu::Ontwo(wxCommandEvent & event)
{
wxFrame* frame = new twosplit(NULL); //change four to three or two to change layout
frame->Show(true);
}
You should create a unique IDs, yes.bandali99 wrote: ↑Fri Aug 02, 2019 6:41 pm Awesome the code runs with no error, however, when I click two split, three or four the program opens only the 4 split no matter the option...
this is how I connected them- am I suppose to create new IDs for each command or is there something else going wrong?Code: Select all
Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleMenu::OnQuit)); Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleMenu::Ontwo)); Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleMenu::Onthree)); Connect(wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SimpleMenu::Onfour));
Code: Select all
enum
{
Minimal_Quit = wxID_EXIT,
Minimal_About = wxID_ABOUT
};
helpMenu->Append(Minimal_About, "&About\tF1", "Show about dialog");
fileMenu->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
Code: Select all
Bind(wxEVT_MENU, &MyFrame::OnAbout, this, Minimal_About );
Bind(wxEVT_MENU, &MyFrame::OnQuit, this, Minimal_Quit );