/////////////////////////////////////////////////////////////////////////////
-// Program: wxWindows Widgets Sample
+// Program: wxWidgets Widgets Sample
// Name: combobox.cpp
// Purpose: Part of the widgets sample showing wxComboBox
// Author: Vadim Zeitlin
class ComboboxWidgetsPage : public WidgetsPage
{
public:
- ComboboxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
+ ComboboxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
+
+ virtual wxControl *GetWidget() const { return m_combobox; }
protected:
// event handlers
EVT_TEXT(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
EVT_TEXT_ENTER(ComboPage_Combo, ComboboxWidgetsPage::OnComboText)
- EVT_CHECKBOX(-1, ComboboxWidgetsPage::OnCheckOrRadioBox)
- EVT_RADIOBOX(-1, ComboboxWidgetsPage::OnCheckOrRadioBox)
+ EVT_CHECKBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
+ EVT_RADIOBOX(wxID_ANY, ComboboxWidgetsPage::OnCheckOrRadioBox)
END_EVENT_TABLE()
// ============================================================================
IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"));
-ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook,
- wxImageList *imaglist)
- : WidgetsPage(notebook)
+ComboboxWidgetsPage::ComboboxWidgetsPage(wxBookCtrl *book,
+ wxImageList *imaglist)
+ : WidgetsPage(book)
{
// init everything
m_chkSort =
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane
- wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style"));
+ wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style"));
// should be in sync with ComboKind_XXX values
static const wxString kinds[] =
_T("drop down"),
};
- m_radioKind = new wxRadioBox(this, -1, _T("Combobox &kind:"),
+ m_radioKind = new wxRadioBox(this, wxID_ANY, _T("Combobox &kind:"),
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(kinds), kinds,
1, wxRA_SPECIFY_COLS);
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane
- wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Change combobox contents"));
+ wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY,
+ _T("&Change combobox contents"));
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
wxSizer *sizerRow;
sizerRow = CreateSizerWithTextAndLabel(_T("Current selection"),
ComboPage_CurText,
&text);
- text->SetEditable(FALSE);
+ text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
// right pane
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
- m_combobox = new wxComboBox(this, ComboPage_Combo, _T(""),
+ m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
0, NULL,
0);
// final initializations
Reset();
- SetAutoLayout(TRUE);
SetSizer(sizerTop);
sizerTop->Fit(this);
void ComboboxWidgetsPage::Reset()
{
- m_chkSort->SetValue(FALSE);
- m_chkReadonly->SetValue(FALSE);
+ m_chkSort->SetValue(false);
+ m_chkReadonly->SetValue(false);
}
void ComboboxWidgetsPage::CreateCombo()
delete m_combobox;
}
- m_combobox = new wxComboBox(this, ComboPage_Combo, _T(""),
+ m_combobox = new wxComboBox(this, ComboPage_Combo, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
0, NULL,
flags);
m_textDelete->SetValue(wxString::Format(_T("%ld"), sel));
wxLogMessage(_T("Combobox item %ld selected"), sel);
+
+ wxLogMessage(_T("Combobox GetValue(): %s"), m_combobox->GetValue().c_str() );
}
void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))