Basic calculator example to show the LPC4088 Experiment Base Board with a touch LCD from DisplayModule

Dependencies:   DmTftLibrary mbed

Fork of dm_calc by Display Module

Revision:
2:b17b19212e5a
Parent:
0:3713b01e72fe
--- a/Button.cpp	Fri Jul 04 10:33:40 2014 +0000
+++ b/Button.cpp	Wed Jul 09 08:34:25 2014 +0000
@@ -21,19 +21,20 @@
 {
   bool needsRepaint = false;
   if (_enabled) {
-    if ((x >= _x0) && (y >= _y0) && (x <= _x1) && (y <= _y1)) {
+    if (!pressed && _pressed) {
+      // user released => click
+      needsRepaint = true;
+      _pressed = false;
+      if (_func != NULL) {
+        _func(_funcArg);
+      }       
+    }
+    else if ((x >= _x0) && (y >= _y0) && (x <= _x1) && (y <= _y1)) {
       if (pressed && !_pressed) {
         // user pressing inside area
         needsRepaint = true;
         _pressed = true;
-      } else if (!pressed && _pressed) {
-        // user released inside area => click
-        needsRepaint = true;
-        _pressed = false;
-        if (_func != NULL) {
-          _func(_funcArg);
-        }       
-      }
+      } 
     }
   }
   return needsRepaint;
@@ -53,4 +54,3 @@
     tft->drawStringCentered(_x0, _y0, _x1-_x0, _y1-_y0, _caption);
   }
 }
-