+void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )
+{
+ //
+ // Show some wxOwnerDrawComboBoxes for comparison
+ //
+
+ wxBoxSizer* colSizer;
+ wxBoxSizer* rowSizer;
+ wxStaticBoxSizer* groupSizer;
+
+ wxComboBox* cb;
+ wxOwnerDrawnComboBox* odc;
+
+ const int border = 4;
+
+ wxDialog* dlg = new wxDialog(this,wxID_ANY,
+ wxT("Compare against wxComboBox"),
+ wxDefaultPosition,wxDefaultSize,
+ wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
+
+ colSizer = new wxBoxSizer( wxVERTICAL );
+
+ rowSizer = new wxBoxSizer(wxHORIZONTAL);
+
+ groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY,wxT(" wxOwnerDrawnComboBox ")),
+ wxVERTICAL);
+
+ groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Writable, sorted:")), 0,
+ wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, border );
+
+ odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ m_arrItems,
+ wxCB_SORT // wxNO_BORDER|wxCB_READONLY
+ );
+
+ odc->Append(wxT("H - Appended Item")); // test sorting in append
+
+ odc->SetValue(wxT("Dot Dash"));
+
+ groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+
+ //
+ // Readonly ODComboBox
+ groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Read-only:")), 0,
+ wxALIGN_CENTER_VERTICAL|wxRIGHT, border );
+
+ odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ m_arrItems,
+ wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
+ );
+
+ odc->SetValue(wxT("Dot Dash"));
+ odc->SetText(wxT("Dot Dash (Testing SetText)"));
+
+ groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+
+ //
+ // Disabled ODComboBox
+ groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Disabled:")), 0,
+ wxALIGN_CENTER_VERTICAL|wxRIGHT, border );
+
+ odc = new wxOwnerDrawnComboBox(dlg,wxID_ANY,wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ m_arrItems,
+ wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
+ );
+
+ odc->SetValue(wxT("Dot Dash"));
+ odc->Enable(false);
+
+ groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+
+ rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border );
+
+
+ groupSizer = new wxStaticBoxSizer(new wxStaticBox(dlg,wxID_ANY,wxT(" wxComboBox ")),
+ wxVERTICAL);
+
+ //
+ // wxComboBox
+ //
+ groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Writable, sorted:")), 0,
+ wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, border );
+
+ cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ m_arrItems,
+ wxCB_SORT // wxNO_BORDER|wxCB_READONLY
+ );
+
+ cb->Append(wxT("H - Appended Item")); // test sorting in append
+
+ cb->SetValue(wxT("Dot Dash"));
+
+ groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+
+ //
+ // Readonly wxComboBox
+ groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Read-only:")), 0,
+ wxALIGN_CENTER_VERTICAL|wxRIGHT, border );
+
+ cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ m_arrItems,
+ wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
+ );
+
+ cb->SetValue(wxT("Dot Dash"));
+
+ groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+
+ //
+ // Disabled wxComboBox
+ groupSizer->Add( new wxStaticText(dlg,wxID_ANY,wxT("Disabled:")), 0,
+ wxALIGN_CENTER_VERTICAL|wxRIGHT, border );
+
+ cb = new wxComboBox(dlg,wxID_ANY,wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ m_arrItems,
+ wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY
+ );
+
+ cb->SetValue(wxT("Dot Dash"));
+ cb->Enable(false);
+
+ groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border );
+
+ rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border );
+
+ colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, border );
+
+ dlg->SetSizer( colSizer );
+ colSizer->SetSizeHints( dlg );
+
+ dlg->SetSize(60,240);
+ dlg->Centre();
+ dlg->ShowModal();
+}
+
+MyFrame::~MyFrame()
+{
+ delete wxLog::SetActiveTarget(m_logOld);
+}
+