Demo program for GuiBase class and its derivertive classes. GuiBase とその派生クラスのデモプログラム. GuiBase, Button, ButtonGroup, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup, NumericUpDown

Dependencies:   F746_GUI mbed

Revision:
12:262492b42b04
Parent:
11:0195d802ab3d
Child:
13:270545d8d62e
--- a/main.cpp	Sat Apr 30 06:34:22 2016 +0000
+++ b/main.cpp	Mon May 30 14:35:25 2016 +0000
@@ -5,7 +5,7 @@
 //      GuiBase, Button, ButtonGroup, Label, NumericLabel, BlinkLabel,
 //      SeekBar, SeekbarGroup
 //
-//  2016/04/30, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/05/30, Copyright (c) 2016 MIKAMI, Naoki
 //--------------------------------------------------------------------------------
 
 #include "NumericLabel.hpp"
@@ -15,15 +15,6 @@
 
 using namespace Mikami;
 
-Ticker timer;
-NumericLabel<float> obj2(10, 116, Label::LEFT, Font16, LCD_COLOR_YELLOW);
-
-void TimerIsr()
-{
-    static int sec = 0;
-    obj2.Draw("%6.1f [s]", (float)(sec++)/10.0f);
-}
-
 int main()
 {
     Label obj10(240, 2, "Dome: GUI parts, 2016/04/30, 15:31", Label::CENTER, Font16);
@@ -62,20 +53,19 @@
     NumericLabel<int> numLabel3(160, 205);
     
     // SeekbarGroup (vertical)
-    SeekbarGroup barV(400, 120, 130, 2, 50, -5, 5, 2,
+    SeekbarGroup barV(410, 130, 121, 2, 45, -6, 6, 2,
                       SeekBar::Vertical, 0xFFA0FFC0);
     NumericLabel<float> **numLabel4;
     numLabel4 = new NumericLabel<float> *[2];
     for (int n=0; n<2; n++) numLabel4[n] =
-        new NumericLabel<float>(400+n*50, 94, "%4.1f", barV.GetValue(n), Label::CENTER);
+        new NumericLabel<float>(410+n*45, 104, "%4.1f", barV.GetValue(n), Label::CENTER);
+    NumericLabel<int> numLabel5(455, 92, "%1d", barV.GetIntValue(0), Label::CENTER);
 
-    // Test of left-, cenrer-, right-justified
+    // Test of left-, cenrer-, and right-justified
     Label leftJustified(420, 52, "ABC", Label::LEFT);
     Label centerJustified(420, 62, "ABC", Label::CENTER);
     Label rightJustified1(420, 72, "ABC", Label::RIGHT);
 
-    timer.attach(&TimerIsr, 0.1f);
-
     while (true)
     {
         if (button1.Touched()) button2.Draw();
@@ -117,8 +107,11 @@
 
         int sbNum;
         if (barV.GetSlidedNumber(sbNum))
-            numLabel4[sbNum]->Draw("%4.1f", barV.GetValue(sbNum));
-
+        {
+            if (sbNum == 0) numLabel4[sbNum]->Draw("%4.1f", barV.GetValue(sbNum));
+            else            numLabel4[sbNum]->Draw("%4.1f", barV.GetValue(sbNum));
+            if (sbNum == 1) numLabel5.Draw("%1d", barV.GetIntValue(sbNum));
+        }
         // If "doNotTouch" button touched, trapped into endless loop
         if (doNotTouch.Touched())
             BlinkLabel warning(250, 200, "You must reset", Label::LEFT, Font16);