added CMS_FORM_SELECT.select_value_by_text

This commit is contained in:
Jocelyn Fiat
2013-02-05 19:24:13 +01:00
parent 3dbccc024f
commit 09c3e56f86
2 changed files with 32 additions and 0 deletions

View File

@@ -61,6 +61,33 @@ feature -- Element change
end end
end end
select_value_by_text (a_text: detachable READABLE_STRING_GENERAL)
local
opt: CMS_FORM_SELECT_OPTION
l_found: BOOLEAN
v: READABLE_STRING_8
do
if a_text /= Void then
v := html_encoded_string (a_text.to_string_32)
across
options as o
loop
if o.item.is_same_text (v) then
l_found := True
o.item.set_is_selected (True)
else
o.item.set_is_selected (False)
end
end
else
across
options as o
loop
o.item.set_is_selected (False)
end
end
end
set_value (v: detachable WSF_VALUE) set_value (v: detachable WSF_VALUE)
do do
if attached {WSF_STRING} v as s then if attached {WSF_STRING} v as s then

View File

@@ -35,6 +35,11 @@ feature -- Status
Result := value.same_string (v) Result := value.same_string (v)
end end
is_same_text (v: like text): BOOLEAN
do
Result := text.same_string (v)
end
feature -- Access feature -- Access
value: READABLE_STRING_32 value: READABLE_STRING_32