test

Dependencies:   ad5422_arduino mbed LT1446 ADS1248-1 LM35-1 Flash FT813 PGA280_ADS1259

Revision:
7:c364201bc3ed
Parent:
5:21240fa1ee4c
diff -r cfe7cb0bdb1a -r c364201bc3ed TFT/display.myWidgets.cpp
--- a/TFT/display.myWidgets.cpp	Fri Aug 14 14:16:03 2020 +0000
+++ b/TFT/display.myWidgets.cpp	Tue Sep 01 10:52:34 2020 +0000
@@ -21,11 +21,58 @@
 
 void Display::myWdget_NumPad(uint16_t x,uint16_t y)
 {
-    char key=pressedButton;
-    (*_TFT).Keys(x, y, 240, 60, 29, key, "123");
-    (*_TFT).Keys(x, y+63, 240, 60, 29, key, "456");
-    (*_TFT).Keys(x, y+63+63, 240, 60, 29, key, "789");
-    (*_TFT).Keys(x, y+63+63+63, 240, 60, 29, key, ".0<");
+    //шарина одной кнопки = 240/3
+    //высота 60
+    //расстояние между 2
+    char key;
+    uint16_t y1=y; //для отрисовки
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='1';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='2';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='3';
+    pressedButton=key;
+    
+    y+=63;
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='4';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='5';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='6';
+    pressedButton=key;
+    
+    y+=63;
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='7';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='8';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='9';
+    pressedButton=key;
+    
+    y+=63;
+    if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
+    key='.';
+    pressedButton=key;
+    if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
+    key='0';
+    pressedButton=key;
+    if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
+    key='<';
+    pressedButton=key;
+    
+    (*_TFT).Keys(x, y1, 240, 60, 29, key, "123");
+    (*_TFT).Keys(x, y1+63, 240, 60, 29, key, "456");
+    (*_TFT).Keys(x, y1+63+63, 240, 60, 29, key, "789");
+    (*_TFT).Keys(x, y1+63+63+63, 240, 60, 29, key, ".0<");
 }
 
 void Display::myWdget_Edit_change(char * text)