diff --git a/ChangeLog b/ChangeLog index 7cb85c12..76cf0011 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2020-01-09 Markus Gans - * The setCurrentItem() method was added to the FComboBox widget class. + * With setText() and clearText() the text in the edit line can be changed + without changing the content of the combo box + * The setCurrentItem() method was added to the FComboBox widget class. Thanks cybin for the sample code 2020-01-03 Markus Gans diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h index ae6a43fc..5259f012 100644 --- a/src/include/final/fcombobox.h +++ b/src/include/final/fcombobox.h @@ -177,6 +177,8 @@ class FComboBox : public FWidget bool unsetEditable(); void setCurrentItem (std::size_t); void setMaxVisibleItems (std::size_t); + void setText (const FString&); + void clearText(); void setLabelText (const FString&); void setLabelOrientation (const FLineEdit::label_o); @@ -303,8 +305,7 @@ inline bool FComboBox::hasShadow() //---------------------------------------------------------------------- template -void FComboBox::insert ( const std::initializer_list& list - , FDataPtr d ) +void FComboBox::insert (const std::initializer_list& list, FDataPtr d) { for (auto& item : list) { @@ -315,8 +316,7 @@ void FComboBox::insert ( const std::initializer_list& list //---------------------------------------------------------------------- template -void FComboBox::insert ( const ItemT& item - , FDataPtr d ) +void FComboBox::insert (const ItemT& item, FDataPtr d) { FListBoxItem listItem (FString() << item, d); insert (listItem); @@ -326,6 +326,14 @@ void FComboBox::insert ( const ItemT& item inline void FComboBox::reserve (std::size_t new_cap) { list_window.list.reserve(new_cap); } +//---------------------------------------------------------------------- +inline void FComboBox::setText (const FString& s) +{ input_field.setText(s); } + +//---------------------------------------------------------------------- +inline void FComboBox::clearText() +{ input_field.clear(); } + //---------------------------------------------------------------------- inline void FComboBox::setLabelText (const FString& s) { input_field.setLabelText(s); }