#include "bbwxComboBox.h"
#include "bbwxPackage.h"
-
#include <vector>
#include <string>
int typeForm,
int sizeX,
int sizeY
- )
- :
+ ) :
wxPanel( parent, -1,wxDefaultPosition ) ,
mBox(box),
mTypeForm(typeForm)
// 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)
{
wxListBox *wxlistbox = new wxListBox ( panel , -1 , wxDefaultPosition,wxSize(sizeX,sizeY),0, NULL, wxLB_SINGLE );
(wxObjectEventFunction)
(void (wxPanel::*)(wxScrollEvent&))
&ComboBoxWidget::OnSpinCtrlClick);
-
sizer->Add( mwxspinbutton,1,wxEXPAND );
}
-
sizer->AddGrowableCol(0);
+
panel->SetSizer(sizer);
- FillItems( iSelection,lstIn );
-
-// for (i=0;i<lstIn.size(); i++)
-// {
-// itemcontainer->Append( bbtk::std2wx( lstIn[i] ) );
-// } // for i
-// itemcontainer->SetSelection(iSelection);
+ FillItems( iSelection,lstIn );
}
//-------------------------------------------------------------------------
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"));
- //}
-*/
}
//--------------------------------------------------------------------------
void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
{
- int i,size=lstIn.size();
+ int i,size = lstIn.size();
#if defined(_WIN32)
// Patch to put spaces at the beginin
#else
+ /*
// Patch to put spaces at the beginin
int strLength=-1;
// Looking for the longest string
lstIn[i]=" "+lstIn[i]; // spaces characters
} // for ii
} // for i
+ */
#endif // defined(_WIN32)
itemcontainer->Clear();
void ComboBox::Process()
{
int iSelection = bbGetInputSelection();
- if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=bbGetInputIn().size()-1; }
-// if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=0; }
+// if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=bbGetInputIn().size()-1; }
+ if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=0; }
ComboBoxWidget *w = (ComboBoxWidget*)bbGetOutputWidget();
- w->FillItems( iSelection, bbGetInputIn() );
- bbSetInputSelection( iSelection );
- bbSetOutputOut( iSelection );
- int size = bbGetInputIn().size();
- if ( (iSelection>=0) && ( iSelection<size) )
- {
- bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
- } // if iSelection
- w->VerifyDeselect(iSelection);
+ if (w!=NULL) {
+ w->FillItems( iSelection, bbGetInputIn() );
+ bbSetInputSelection( iSelection );
+ bbSetOutputOut( iSelection );
+ int size = bbGetInputIn().size();
+ if ( (iSelection>=0) && ( iSelection<size) )
+ {
+ bbSetOutputOutString( bbGetInputIn()[ iSelection ] );
+ } // if iSelection
+ w->VerifyDeselect(iSelection);
+ } // if w
}
//=====
// 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)
bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
} // if InputIn size
bbSetOutputWidget( w );
+
}
//=====
// 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::bbUserFinalizeProcessing()
{
-
-}
}
-// EO namespace bbwx
+
+}// EO namespace bbwx