mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-27 23:57:13 +09:00
.
This commit is contained in:
1 parent
d282a78b17
commit
941f7974c4
1 file changed
+8
-3
@@ -87,6 +87,7 @@ Elements.calculator_input_textfield = Gui.define("calculator/input_textfield")
|
|||||||
Elements.calculator_result_text_box = Gui.define("calculator/result_text_box")
|
Elements.calculator_result_text_box = Gui.define("calculator/result_text_box")
|
||||||
:draw{
|
:draw{
|
||||||
type = "text-box",
|
type = "text-box",
|
||||||
|
caption = "",
|
||||||
text = "",
|
text = "",
|
||||||
read_only = true,
|
read_only = true,
|
||||||
name = "calculator_result_text_box",
|
name = "calculator_result_text_box",
|
||||||
@@ -330,15 +331,19 @@ function Elements.change(event)
|
|||||||
local label = event.element.parent.calculator_result_text_box
|
local label = event.element.parent.calculator_result_text_box
|
||||||
|
|
||||||
if event.text == "" then
|
if event.text == "" then
|
||||||
|
label.caption = ""
|
||||||
label.text = ""
|
label.text = ""
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local ok, result = Elements.parse(event.text:lower())
|
local ok, result = Elements.parse(event.text:lower())
|
||||||
label.style.font_color = ok and {1, 1, 1} or {1, 0, 0}
|
label.style.font_color = ok and {1, 1, 1} or {1, 0, 0}
|
||||||
label.text = ok
|
|
||||||
and ("= " .. format_number(result, false))
|
if ok then
|
||||||
or (type(result) == "table" and result or {"", {"exp-gui_calculator.error"}, tostring(result)})
|
label.text = "= " .. format_number(result, false)
|
||||||
|
else
|
||||||
|
label.caption = type(result) == "table" and result or {"", {"exp-gui_calculator.error"}, tostring(result)}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local e = defines.events
|
local e = defines.events
|
||||||
|
|||||||
Reference in new issue
Block a user