X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e9cc1579573a1f9b1e7f560454f7c16bce5ca979..f40f8e17226c2080dec017e2043fe59e2d21e15b:/samples/combo/combo.cpp?ds=sidebyside diff --git a/samples/combo/combo.cpp b/samples/combo/combo.cpp index b5f4705b47..7710587b73 100644 --- a/samples/combo/combo.cpp +++ b/samples/combo/combo.cpp @@ -45,7 +45,7 @@ // the application icon (under Windows and OS/2 it is in resources and even // though we could still include the XPM here it would be unused) -#if !defined(__WXMSW__) && !defined(__WXPM__) +#ifndef wxHAS_IMAGES_IN_RESOURCES #include "../sample.xpm" #endif @@ -125,6 +125,7 @@ enum // simple menu events like this the static method is much simpler. BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_TEXT(wxID_ANY,MyFrame::OnComboBoxUpdate) + EVT_TEXT_ENTER(wxID_ANY,MyFrame::OnComboBoxUpdate) EVT_COMBOBOX(wxID_ANY,MyFrame::OnComboBoxUpdate) EVT_MENU(ComboCtrl_Compare, MyFrame::OnShowComparison) @@ -376,6 +377,14 @@ public: virtual void Init() { } + virtual ~TreeCtrlComboPopup() + { + if (!m_isBeingDeleted) + { + wxMessageBox("error wxTreeCtrl::Destroy() was not called"); + } + SendDestroyEvent(); + } virtual bool Create( wxWindow* parent ) { @@ -504,7 +513,7 @@ protected: wxWindow* win = GetPopupWindow(); win->SetSize(rect); win->Raise(); // This is needed - win->ShowWithEffect(wxSHOW_EFFECT_SLIDE_TO_BOTTOM); + win->ShowWithEffect(wxSHOW_EFFECT_BLEND); return true; } }; @@ -615,7 +624,7 @@ MyFrame::MyFrame(const wxString& title) // the "About" item should be in the help menu wxMenu *helpMenu = new wxMenu; - helpMenu->Append(ComboCtrl_About, wxT("&About...\tF1"), wxT("Show about dialog")); + helpMenu->Append(ComboCtrl_About, wxT("&About\tF1"), wxT("Show about dialog")); fileMenu->Append(ComboCtrl_Compare, wxT("&Compare against wxComboBox..."), wxT("Show some wxOwnerDrawnComboBoxes side-by-side with native wxComboBoxes.")); @@ -743,14 +752,21 @@ MyFrame::MyFrame(const wxString& title) // rowSizer = new wxBoxSizer( wxHORIZONTAL ); - rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("List View wxComboCtrl:")), 1, - wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); + rowSizer->Add( new wxStaticText(panel, + wxID_ANY, + "List View wxComboCtrl (custom animation):"), + 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Tree Ctrl wxComboCtrl:")), 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); rowSizer = new wxBoxSizer( wxHORIZONTAL ); cc = new wxComboCtrlWithCustomPopupAnim(); + + // Let's set a custom style for the contained wxTextCtrl. We need to + // use two-step creation for it to work properly. + cc->SetTextCtrlStyle(wxTE_RIGHT); + cc->Create(panel, wxID_ANY, wxEmptyString); // Make sure we use popup that allows focusing the listview. @@ -911,7 +927,7 @@ MyFrame::MyFrame(const wxString& title) panel->SetSizer( topSizer ); topSizer->SetSizeHints( panel ); - SetSize(740,400); + Fit(); Centre(); } @@ -931,6 +947,11 @@ void MyFrame::OnComboBoxUpdate( wxCommandEvent& event ) { wxLogDebug(wxT("EVT_TEXT(id=%i,string=\"%s\")"),event.GetId(),event.GetString().c_str()); } + else if ( event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER ) + { + wxLogDebug("EVT_TEXT_ENTER(id=%i,string=\"%s\")", + event.GetId(), event.GetString().c_str()); + } } void MyFrame::OnShowComparison( wxCommandEvent& WXUNUSED(event) )