From 8aa06a9ac40f57b0be1fda0b6413d3dca8b324ed Mon Sep 17 00:00:00 2001 From: Romain Chanoir Date: Fri, 24 Jan 2014 09:30:19 -0500 Subject: [PATCH] examples : fix a bug when clicking on the "." button directly Signed-off-by: Romain Chanoir --- examples/calculator.nit | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/calculator.nit b/examples/calculator.nit index 32c2f72..2be8aad 100644 --- a/examples/calculator.nit +++ b/examples/calculator.nit @@ -57,6 +57,7 @@ class CalculatorContext fun switch_to_decimals do + if self.current == null then current = 0.0 if after_point != null then return after_point = -1 @@ -112,11 +113,11 @@ class CalculatorGui if user_data isa Char then # is an operation var c = user_data if c == '.' then - but_dot.set_sensitive= false + but_dot.sensitive= false context.switch_to_decimals lbl_disp.text = "{context.current.to_i}." else - but_dot.set_sensitive= true + but_dot.sensitive= true context.push_op( c ) var s = context.result.to_precision_native(6) -- 1.7.9.5