Skip to content

Commit

Permalink
add additional fix to 0119-WebUI-Fix-ProofAndSetValue WebUI patch to fix
Browse files Browse the repository at this point in the history
issues in getOptionBox tcl function to perform a correct floating point
comparison via an epsilon difference value if the option is a floating
point. This should fix issue with not correctly selected combobox values
(fixes #2929).
  • Loading branch information
jens-maus committed Nov 20, 2024
1 parent 81f864b commit 5626642
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,28 @@
append s "jQuery('#separate_CHANNEL\_$chn\_$prn').val(this.value / 100);\">"

append s "<input id=$elemId type=\"text\" size=\"5\" class=\"hidden\" value=$value name=$param>"
@@ -406,10 +419,18 @@
set select ""
foreach val [lsort -real [array names optionValues]] {

- if {$val == $value} {
- set select "selected=\"selected\""
+ if {[string is double -strict $value]} {
+ if {[expr abs($val - $value)] < 1e-15} {
+ set select "selected=\"selected\""
+ } else {
+ set select ""
+ }
} else {
- set select ""
+ if {$val == $value} {
+ set select "selected=\"selected\""
+ } else {
+ set select ""
+ }
}

append s "<option class=\"[extractParamFromTranslationKey $optionValues($val)]\" value=$val $select>$optionValues($val)</option>"
--- occu/WebUI/www/config/easymodes/hm-cc-vg-1_master.tcl.orig
+++ occu/WebUI/www/config/easymodes/hm-cc-vg-1_master.tcl
@@ -24,7 +24,12 @@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,18 @@ proc getOptionBox {param options value chn prn {extraparam ""}} {
set select ""
foreach val [lsort -real [array names optionValues]] {

if {$val == $value} {
set select "selected=\"selected\""
if {[string is double -strict $value]} {
if {[expr abs($val - $value)] < 1e-15} {
set select "selected=\"selected\""
} else {
set select ""
}
} else {
set select ""
if {$val == $value} {
set select "selected=\"selected\""
} else {
set select ""
}
}

append s "<option class=\"[extractParamFromTranslationKey $optionValues($val)]\" value=$val $select>$optionValues($val)</option>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,18 @@ proc getOptionBox {param options value chn prn {extraparam ""}} {
set select ""
foreach val [lsort -real [array names optionValues]] {

if {$val == $value} {
set select "selected=\"selected\""
if {[string is double -strict $value]} {
if {[expr abs($val - $value)] < 1e-15} {
set select "selected=\"selected\""
} else {
set select ""
}
} else {
set select ""
if {$val == $value} {
set select "selected=\"selected\""
} else {
set select ""
}
}

append s "<option class=\"[extractParamFromTranslationKey $optionValues($val)]\" value=$val $select>$optionValues($val)</option>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,18 @@ proc getOptionBox {param options value chn prn {extraparam ""}} {
set select ""
foreach val [lsort -real [array names optionValues]] {

if {$val == $value} {
set select "selected=\"selected\""
if {[string is double -strict $value]} {
if {[expr abs($val - $value)] < 1e-15} {
set select "selected=\"selected\""
} else {
set select ""
}
} else {
set select ""
if {$val == $value} {
set select "selected=\"selected\""
} else {
set select ""
}
}

append s "<option class=\"[extractParamFromTranslationKey $optionValues($val)]\" value=$val $select>$optionValues($val)</option>"
Expand Down

0 comments on commit 5626642

Please sign in to comment.