sizer->AddGrowableCol(0);
panel->SetSizer(sizer);
- for (i=0;i<lstIn.size(); i++)
- {
- itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
+
+
+ FillItems( iSelection,lstIn );
+
+// for (i=0;i<lstIn.size(); i++)
+// {
+// itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
+// } // for i
// itemcontainer->SetSelection(iSelection);
}
{
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)
//--------------------------------------------------------------------------
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 ;i<size; i++)
+ {
+ if ( strLength < (int) lstIn[i].length() ) { strLength=lstIn[i].length(); }
+ } // for
+ // Adding spaces at the bigining to the others strings in the list to have the same size
+ int ii,len2;
+ for (i=0 ;i<size; i++)
+ {
+ len2 = strLength - lstIn[i].length();
+ for (ii=0;ii<len2;ii++)
+ {
+ lstIn[i]=" "+lstIn[i]; // 3 space characters
+ } // for ii
+ } // for i
+
itemcontainer->Clear();
- for (i=0;i<lstIn.size(); i++)
+ for (i=0;i<size; i++)
{
itemcontainer->Append( 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)