From ad458230343cabfb02926d50ac0f8e17de477085 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Tue, 6 Oct 2015 10:44:25 +0200 Subject: [PATCH] #2710 BBTK Bug New Normal - package wx box ComboBox refresh error --- packages/wx/src/bbwxComboBox.cxx | 33 ++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/wx/src/bbwxComboBox.cxx b/packages/wx/src/bbwxComboBox.cxx index e76d44f..234a0e6 100644 --- a/packages/wx/src/bbwxComboBox.cxx +++ b/packages/wx/src/bbwxComboBox.cxx @@ -28,6 +28,8 @@ namespace bbwx ~ComboBoxWidget(); void OnComboBox(wxEvent& event); + void FillItems( int iSelection, std::vector< std::string > lstIn); + private: int mTypeForm; @@ -84,7 +86,7 @@ namespace bbwx Connect( wxlistbox->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); + wxlistbox->Append( bbtk::std2wx( lstIn[i] ) ); } // for i wxlistbox->SetSelection(iSelection); sizer->Add( wxlistbox,1,wxGROW ); @@ -95,7 +97,7 @@ namespace bbwx Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); + wxchoice->Append( bbtk::std2wx( lstIn[i] ) ); } // for i wxchoice->SetSelection(iSelection); sizer->Add( wxchoice,1,wxGROW ); @@ -130,6 +132,30 @@ namespace bbwx mBox->bbSignalOutputModification("OutString"); } +//-------------------------------------------------------------------------- + void ComboBoxWidget::FillItems( + int iSelection, + std::vector< std::string > lstIn + ) + { + int i; + if (mTypeForm==1) + { + wxlistbox->Clear(); + for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); + } // for i + wxlistbox->SetSelection(iSelection); + } else { + wxchoice->Clear(); + for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); + } // for i + wxchoice->SetSelection(iSelection); + } // if + } BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox) BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox); @@ -138,7 +164,10 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox); //===== void ComboBox::Process() { + ComboBoxWidget *w = (ComboBoxWidget*)bbGetOutputWidget(); + w->FillItems( bbGetInputSelection(),bbGetInputIn() ); } + //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== -- 2.47.1