]> Creatis software - bbtk.git/commitdiff
#2710 BBTK Bug New Normal - package wx box ComboBox refresh error wt-version
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 6 Oct 2015 08:44:25 +0000 (10:44 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 6 Oct 2015 08:44:25 +0000 (10:44 +0200)
packages/wx/src/bbwxComboBox.cxx

index e76d44f4d54443769211b03cf167c709b15d7eae..234a0e6c2444949c38f7fa14a22ec1b3207661f0 100644 (file)
@@ -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;i<lstIn.size(); i++)
                {
-                       wxlistbox->Append(  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;i<lstIn.size(); i++)
                {
-                       wxchoice->Append(  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;i<lstIn.size(); i++)
+               {
+                               wxlistbox->Append(  bbtk::std2wx( lstIn[i] )  ); 
+                       } // for i
+               wxlistbox->SetSelection(iSelection);
+               } else {
+                       wxchoice->Clear();
+               for (i=0;i<lstIn.size(); i++)
+               {
+                               wxchoice->Append(  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)
 //=====