From 19c9e9989a6be039aac2daac660e9133ee578ed7 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 30 Nov 2017 10:31:33 +0100 Subject: [PATCH] #3152 BBTK Bug New Normal - ShareMemory, ComboBox->list --- packages/std/src/bbstdSetElementVector.h | 2 +- packages/std/src/bbstdStringToVector.h | 9 +++-- .../src/bbstdStringVectorToNumericalVector.h | 3 +- packages/wx/src/bbwxComboBox.cxx | 38 +++++++++++++------ packages/wx/src/bbwxComboBox.h | 8 ++-- 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/packages/std/src/bbstdSetElementVector.h b/packages/std/src/bbstdSetElementVector.h index 5f3286e..be232b2 100644 --- a/packages/std/src/bbstdSetElementVector.h +++ b/packages/std/src/bbstdSetElementVector.h @@ -81,7 +81,7 @@ namespace bbstd (*( bbGetInputPVec() ))[ bbGetInputI() ] = bbGetInputValue(); } bbSetOutputVec( *( bbGetInputPVec() ) ); - bbSignalOutputModification(std::string("Vec")); +// bbSignalOutputModification(std::string("Vec")); } //================================================================= diff --git a/packages/std/src/bbstdStringToVector.h b/packages/std/src/bbstdStringToVector.h index 39153b5..6e68911 100644 --- a/packages/std/src/bbstdStringToVector.h +++ b/packages/std/src/bbstdStringToVector.h @@ -90,18 +90,21 @@ namespace bbstd std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); // Find first "non-delimiter". std::string::size_type pos = str.find_first_of(delimiters, lastPos); - bbmOutputOut.clear(); +// bbmOutputOut.clear(); +std::vector out; while (std::string::npos != pos || std::string::npos != lastPos) { // Found a token, add it to the vector. - bbmOutputOut.push_back( - this->decode_item( str.substr(lastPos, pos - lastPos) ) ); +// bbmOutputOut.push_back( this->decode_item( str.substr(lastPos, pos - lastPos) ) ); + out.push_back( this->decode_item( str.substr(lastPos, pos - lastPos) ) ); // std::cout << this->bbGetOutputOut().back() << std::endl; // Skip delimiters. Note the "not_of" lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" pos = str.find_first_of(delimiters, lastPos); } +bbSetOutputOut (out); +//bbSignalOutputModification(); // std::cout << "s=" << this->bbGetOutputOut().size() << std::endl; } //================================================================= diff --git a/packages/std/src/bbstdStringVectorToNumericalVector.h b/packages/std/src/bbstdStringVectorToNumericalVector.h index c7bee76..9bd9f63 100644 --- a/packages/std/src/bbstdStringVectorToNumericalVector.h +++ b/packages/std/src/bbstdStringVectorToNumericalVector.h @@ -85,7 +85,6 @@ namespace bbstd //std::vector vect (bbGetInputIn() ); bbmOutputOut.clear(); - // get a std::string, add it to the > int lgt=bbGetInputIn().size(); for (int i=0; ibbGetOutputOut().size(); //EED for (int j=0; j 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) diff --git a/packages/wx/src/bbwxComboBox.h b/packages/wx/src/bbwxComboBox.h index a1182f9..6b1e702 100644 --- a/packages/wx/src/bbwxComboBox.h +++ b/packages/wx/src/bbwxComboBox.h @@ -22,6 +22,7 @@ class bbwx_EXPORT ComboBox BBTK_DECLARE_INPUT(Selection, int ); BBTK_DECLARE_INPUT(In,std::vector< std::string >); BBTK_DECLARE_INPUT(Form, int ); + BBTK_DECLARE_INPUT(Deselect, bool ); BBTK_DECLARE_OUTPUT(Out, int ); BBTK_DECLARE_OUTPUT(OutString, std::string ); BBTK_PROCESS(Process); @@ -42,10 +43,9 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ComboBox,bbtk::WxBlackBox); BBTK_INPUT(ComboBox,Selection,"i element to be selected (default 0)",int,""); BBTK_INPUT(ComboBox,In,"Vector of strings",std::vector< std::string >,""); BBTK_INPUT(ComboBox,Form,"0 Combobox, 1 List (default 0)",int,""); - - BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,""); - BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,""); - + BBTK_INPUT(ComboBox,Deselect,"(default false) Just for List form",bool,""); + BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,""); + BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,""); BBTK_END_DESCRIBE_BLACK_BOX(ComboBox); //===== // 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.44.0