Skip to content

Commit

Permalink
Document ComboBox#value=
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Sep 25, 2020
1 parent 08b9840 commit 891b272
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions library/cwm/src/lib/cwm/common_widgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ class ComboBox < AbstractWidget
abstract_method :label

alias_method :orig_value=, :value=

# Sets the current value
#
# If the given value is not in the list of items but the widget is editable,
# the item is added to the list.
#
# @param val [Object] Value to assign to the widget
def value=(val)
change_items([[val, val]] + items) if editable? && !items.map(&:first).include?(val)
self.orig_value = val
Expand Down

0 comments on commit 891b272

Please sign in to comment.