From f26b702afa376d56bd1c53c54b71f0ae1608e035 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 16 Jun 2021 15:47:42 +0200 Subject: [PATCH] #3466 Combobox with Spin --- packages/std/src/bbstdFilesFromDirectory.cxx | 15 ++++++---- packages/std/src/bbstdFilesFromDirectory.h | 2 ++ packages/wx/src/bbwxComboBox.cxx | 31 +++++--------------- packages/wx/src/bbwxComboBox.h | 2 +- 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/packages/std/src/bbstdFilesFromDirectory.cxx b/packages/std/src/bbstdFilesFromDirectory.cxx index 387b5ad..4caeae3 100644 --- a/packages/std/src/bbstdFilesFromDirectory.cxx +++ b/packages/std/src/bbstdFilesFromDirectory.cxx @@ -49,18 +49,23 @@ void FilesFromDirectory::Process() { Filenames.clear(); SimpleFilenames.clear(); - if (bbGetInputIn()!="") + + if (bbGetInputActive()==true) { - DirName = bbGetInputIn(); - /*int nbFiles = */ Explore(DirName, bbGetInputRecursive(), bbGetInputRecursiveLevel() ); - CleanFilenames( DirName ); - } // if In + if (bbGetInputIn()!="") + { + DirName = bbGetInputIn(); + /*int nbFiles = */ Explore(DirName, bbGetInputRecursive(), bbGetInputRecursiveLevel() ); + CleanFilenames( DirName ); + } // if In + } // Active bbSetOutputOut(Filenames); bbSetOutputOutSimple(SimpleFilenames); } void FilesFromDirectory::bbUserSetDefaultValues() { + bbSetInputActive(true); bbSetInputIn("."); bbSetInputRecursive(false); bbSetInputType(0); diff --git a/packages/std/src/bbstdFilesFromDirectory.h b/packages/std/src/bbstdFilesFromDirectory.h index 841df20..f3b8671 100644 --- a/packages/std/src/bbstdFilesFromDirectory.h +++ b/packages/std/src/bbstdFilesFromDirectory.h @@ -39,6 +39,7 @@ namespace bbstd public bbtk::AtomicBlackBox { BBTK_BLACK_BOX_INTERFACE(FilesFromDirectory,bbtk::AtomicBlackBox); + BBTK_DECLARE_INPUT(Active,bool); BBTK_DECLARE_INPUT(In,std::string); BBTK_DECLARE_INPUT(Recursive,bool); BBTK_DECLARE_INPUT(RecursiveLevel,int); @@ -69,6 +70,7 @@ namespace bbstd BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory"); BBTK_CATEGORY(""); + BBTK_INPUT(FilesFromDirectory,Active,"(default true) Active true/false ",bool,""); BBTK_INPUT(FilesFromDirectory,In,"Directory Name",std::string,""); BBTK_INPUT(FilesFromDirectory,Recursive,"(default false) Recursive directory exploration",bool,""); BBTK_INPUT(FilesFromDirectory,Type,"(0 default) 0=files 1=All_directories 2=last_directories ",int,""); diff --git a/packages/wx/src/bbwxComboBox.cxx b/packages/wx/src/bbwxComboBox.cxx index 086708b..e1883ac 100644 --- a/packages/wx/src/bbwxComboBox.cxx +++ b/packages/wx/src/bbwxComboBox.cxx @@ -72,10 +72,15 @@ namespace bbwx // 2) Insertion of the components in the window // We use a FlexGridSizer +// wxFlexGridSizer *sizerV = new wxFlexGridSizer(1); +// wxFlexGridSizer *sizerH1 = new wxFlexGridSizer(0); +// wxFlexGridSizer *sizerH2 = new wxFlexGridSizer(2); wxFlexGridSizer *sizer = new wxFlexGridSizer(2); + if (title!="") { sizer->Add( new wxStaticText(panel,-1, bbtk::std2wx(title) ) ); + sizer->Add( new wxStaticText(panel,-1, _T("") ) ); } //--------------------------------------------------------------------- if (mTypeForm==1) @@ -101,19 +106,12 @@ namespace bbwx (wxObjectEventFunction) (void (wxPanel::*)(wxScrollEvent&)) &ComboBoxWidget::OnSpinCtrlClick); - sizer->Add( mwxspinbutton,1,wxEXPAND ); } - sizer->AddGrowableCol(0); + panel->SetSizer(sizer); - FillItems( iSelection,lstIn ); - -// for (i=0;iAppend( bbtk::std2wx( lstIn[i] ) ); -// } // for i -// itemcontainer->SetSelection(iSelection); + FillItems( iSelection,lstIn ); } //------------------------------------------------------------------------- @@ -177,23 +175,8 @@ void ComboBoxWidget::OnComboBox(wxEvent& event) void ComboBoxWidget::OnSpinCtrlClick(wxCommandEvent& event) { int iSelection = mwxspinbutton->GetValue(); - printf("EED ComboBoxWidget::OnSpinCtrlClick %d\n", iSelection ); itemcontainer->SetSelection(iSelection); OnComboBoxSelection( iSelection ); - -/* - if (mBox->bbGetInputType()==0) - { - mBox->bbSetOutputOut( mwxSpinCtrl->GetValue() ); - } else { - mBox->bbSetOutputOut( mwxSpinButton->GetValue() ); - }// if Type - - // and signal that the output has changed - //if(_reactiveOnKeyStroke==1){ - mBox->bbSignalOutputModification(std::string("Out")); - //} -*/ } diff --git a/packages/wx/src/bbwxComboBox.h b/packages/wx/src/bbwxComboBox.h index de0b439..3a02e05 100644 --- a/packages/wx/src/bbwxComboBox.h +++ b/packages/wx/src/bbwxComboBox.h @@ -48,7 +48,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ComboBox,bbtk::WxBlackBox); BBTK_INPUT(ComboBox,In,"Vector of strings",std::vector< std::string >,""); BBTK_INPUT(ComboBox,Form,"0 Combobox, 1 List (default 0)",int,""); BBTK_INPUT(ComboBox,Deselect,"(default false) Just for List form",bool,""); - BBTK_INPUT(ComboBox,WithSpinButton,"(default false) With spin button",bool,""); + BBTK_INPUT(ComboBox,WithSpinButton,"(default false) With spin button true/false",bool,""); BBTK_OUTPUT(ComboBox,Out,"i Item selected",int,""); BBTK_OUTPUT(ComboBox,OutString,"string Item selected",std::string,""); -- 2.47.1