From aa3ecf5a6dcecec01ddd03b6827bd8452bcd12a1 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 29 Apr 2020 17:52:40 +0200 Subject: [PATCH] #3416 BBTK Feature New Normal - Patch combobox to show the end of the string item --- packages/wx/src/bbwxComboBox.cxx | 49 +++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/packages/wx/src/bbwxComboBox.cxx b/packages/wx/src/bbwxComboBox.cxx index 06ec591..05f3a33 100644 --- a/packages/wx/src/bbwxComboBox.cxx +++ b/packages/wx/src/bbwxComboBox.cxx @@ -88,10 +88,14 @@ namespace bbwx sizer->AddGrowableCol(0); panel->SetSizer(sizer); - for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); - } // for i + + + FillItems( iSelection,lstIn ); + +// for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); +// } // for i // itemcontainer->SetSelection(iSelection); } @@ -119,7 +123,13 @@ namespace bbwx { mBox->bbSetInputSelection( iSelection ); mBox->bbSetOutputOut( iSelection ); - mBox->bbSetOutputOutString( bbtk::wx2std( itemcontainer->GetString(iSelection) ) ); + +// Patch to clean the spaces at the begining + std::string tmpStr = bbtk::wx2std( itemcontainer->GetString(iSelection) ); + if (tmpStr.length()>0) { while(tmpStr[0]==' ') tmpStr.erase(0,1); } + mBox->bbSetOutputOutString( tmpStr ); +// mBox->bbSetOutputOutString( bbtk::wx2std( itemcontainer->GetString(iSelection) ) ); + mBox->bbSignalOutputModification(); VerifyDeselect(iSelection); if (mTypeForm==0) @@ -143,13 +153,38 @@ void ComboBoxWidget::OnComboBox(wxEvent& event) //-------------------------------------------------------------------------- void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn ) { - int i; + int i,size=lstIn.size(); + +// Patch to put spaces at the beginin + int strLength=-1; + // Looking for the longest string + for (i=0 ;iClear(); - for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); } // for i if (iSelection>=0) itemcontainer->SetSelection(iSelection); + + if (mTypeForm==0) + { + ((wxChoice*)itemcontainer)->SetAutoLayout( true ); + ((wxChoice*)itemcontainer)->Layout( ); + } // if mTypeForm } BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox) -- 2.45.0