Re: EuGTK Convert Units
- Posted by irv Aug 03, 2018
- 1550 views
Replacing the function with the one below seems to give good precision, with the full "precision" shown in the tooltip (with the actual values shown in a terminal if run from one).
---------------------------- global function Convert() -- ---------------------------- atom val = to_number(get(V1,"text")) object from_units = get(cb2,"active text") object to_units = get(cb3,"active text") if val = 0 then return 1 end if if atom(from_units) or atom(to_units) then return 1 end if object results = convert_unit(val,from_units, to_units) results[1] = from_units results[2] = to_units display(results) set(V2,"tooltip markup",text:format("[4] [1] = [3] [2]",results)) results[3] = sprintf("%.4g",results[3]) display(results) results = append(results,val) set(V2,"text",text:format("[4] [1] = [3] [2]",results)) return 1 end function