]> Creatis software - bbtk.git/blobdiff - packages/wx/src/bbwxComboBox.cxx
#3152 BBTK Bug New Normal - ShareMemory, ComboBox->list
[bbtk.git] / packages / wx / src / bbwxComboBox.cxx
index b11c55874b7ab4d32ebb5fb487020eb79812d5a0..8b2ea6479994078fb7d8d89022cd8f34382064ab 100644 (file)
@@ -29,6 +29,7 @@ namespace bbwx
        void OnComboBoxSelection(int iSelection);
        void OnComboBox(wxEvent& event);
        void FillItems( int iSelection, std::vector< std::string > lstIn);
+    void VerifyDeselect(int iSelection);
 
   private:
     int                        mTypeForm;
@@ -53,7 +54,7 @@ namespace bbwx
                        int sizeY
                )
     :
-    wxPanel( parent, -1) ,
+    wxPanel( parent, -1,wxDefaultPosition,wxSize(sizeX,sizeY) ) ,
     mBox(box),
     mTypeForm(typeForm)
   {
@@ -91,14 +92,25 @@ namespace bbwx
        {
                itemcontainer->Append(  bbtk::std2wx( lstIn[i] )  ); 
        } // for i
-       itemcontainer->SetSelection(iSelection);
+//     itemcontainer->SetSelection(iSelection);
   }
-  //-------------------------------------------------------------------------
-  
+
+  //-------------------------------------------------------------------------  
   ComboBoxWidget::~ComboBoxWidget()
   {
   }
 
+  //--------------------------------------------------------------------------
+  void ComboBoxWidget::VerifyDeselect(int iSelection)
+  {
+       if ((iSelection>=0) && (mBox->bbGetInputDeselect()==true) )
+       {
+               if (mTypeForm==1) 
+               { 
+                       ((wxListBox*)itemcontainer)->Deselect( iSelection ); 
+               } // if mTypeForm
+       } // if iSelection
+  }
 
   //--------------------------------------------------------------------------
   void ComboBoxWidget::OnComboBoxSelection(int iSelection)
@@ -108,8 +120,12 @@ namespace bbwx
                mBox->bbSetInputSelection( iSelection );
                mBox->bbSetOutputOut( iSelection );
                mBox->bbSetOutputOutString(    bbtk::wx2std( itemcontainer->GetString(iSelection) )     );
-               mBox->bbSignalOutputModification("Out");
-               mBox->bbSignalOutputModification("OutString");
+               mBox->bbSignalOutputModification();
+
+               VerifyDeselect(iSelection);
+
+//             mBox->bbSignalOutputModification("Out");
+//             mBox->bbSignalOutputModification("OutString");
        } // if iSelection
   }
 
@@ -127,7 +143,7 @@ namespace bbwx
        {
                        itemcontainer->Append(  bbtk::std2wx( lstIn[i] )  ); 
                } // for i
-       itemcontainer->SetSelection(iSelection);
+               if (iSelection>=0) itemcontainer->SetSelection(iSelection);
        } 
 
 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
@@ -143,14 +159,14 @@ void ComboBox::Process()
        w->FillItems( iSelection, bbGetInputIn() );
     bbSetInputSelection( iSelection );
     bbSetOutputOut( iSelection );
-
     int size = bbGetInputIn().size();
     if         (  (iSelection>0) && ( (size-1)<=iSelection) ) 
     { 
        bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
-    }
-}
+    } // if iSelection
 
+       w->VerifyDeselect(iSelection);
+}
 //===== 
 // 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)
 //===== 
@@ -178,13 +194,13 @@ void ComboBox::bbUserSetDefaultValues()
        bbSetInputForm(0);
        bbSetInputWinWidth(100);
        bbSetInputWinHeight(200);
+       bbSetInputDeselect(false);
 }
 //===== 
 // 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)
 //===== 
 void ComboBox::bbUserInitializeProcessing()
 {
-
 }
 //===== 
 // 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)