Code: Select all
void MyFrame::OnChoice5(wxCommandEvent &Event)
{
wxCombo **combo =(wxCombo**)malloc(sizeof(wxCombo*)*5);
wxFrame *MainFrame=new wxFrame (ParentPanel,wxID_ANY,wxT("Frame"),wxDefaultPosition,wxSize(1200,500));
wxPanel *MainPanel=new wxPanel(MainFrame,wxID_ANY);
wxPanel **Panels=(wxPanels**)malloc(sizeof(wxPanels*)*5);
wxNoteBook *NoteBook=new wxNoteBook(MainPanel,-1,wxPoint(-1,-1),wxSize(-1,-1),wxNB_LEFT);
for(int i=0;o<5;i++)
{
Panels[i]=new wxPanel(NoteBook,wxID_ANY,wxDefaultPosition,wxSize(1100,600));
wxArrayStrings Strings;
Strings.Add(wxT("One"));
Strings.Add(wxT("Two"));
Strings.Add(wxT("Three"));
combo[i]=new wxComboBox(Panels[i],wxNewId(),wxT("Option"),wxDefaultPosition,wxSize(500,30),Strings,wxCB_DROPDOWN);
NoteBook->AddPage(Panels[i],wxString::Format("Sheet %d",i+1));
Connect(combo[i]->GetId(),wxEVT_COMMAND_COMBOBOX_SELECTED,wxCommandEventHandler(MyFrame::OnCombBoxSelect));
}
NoteBook->Show(true);
MainFrame->Show(true);
Center();
}
void MyFrame::OnCombBoxSelect(wxCommandEvent &event)
{
}
with option ("one", "two", "three")
the
" Connect(combo->GetId(),wxEVT_COMMAND_COMBOBOX_SELECTED,wxCommandEventHandler(MyFrame::OnCombBoxSelect));"
calls the function OnCombBoxSelect(wxCommandEvent &event)
when the option "one" or "two" or "three" is selected
so in the OnComboBoxSelect() function
1. how do we know which option ("one", "two", "three") have been selected
2. and in which page we are in
3. and also how do we get the page name and store it in a wxString object