Simple demo program of SeekBar, NumericLabel, and ButtonGroup. SeekBar, NumericLabel, ButtonGroup の簡単な使い方の例.

Dependencies:   F746_GUI mbed

Revision:
0:5ee6e4aa18fc
Child:
1:81cfe85b6544
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Nov 19 08:26:07 2016 +0000
@@ -0,0 +1,37 @@
+//-----------------------------------------------------
+//  Label, NumericLabel, SeekBar のデモプログラム
+//  Demo program of Label, NumericLabel, and SeekBar
+//
+//  2016/11/19, Copyright (c) 2016 MIKAMI, Naoki
+//-----------------------------------------------------
+
+#include "F746_GUI.hpp"
+
+using namespace Mikami;
+
+int main()
+{
+    Label label1(240, 40, "Example", Label::CENTER, Font16);
+    Label label2(240, 60, "SeekBar, NumericLabel, ButtonGroup", Label::CENTER, Font16);
+    
+    SeekBar myBar(100, 200, 250, -1,1, 0, "-1", "0", "1");
+    NumericLabel<float> myLabel(210, 150, "%5.2f", 0);
+    ButtonGroup bG(400, 200, 50, 30, 2, (string[]){"ON", "OFF"}, 0, 5, 1, 0);
+    
+    while (true)
+    {
+        float val = myBar.GetValue();
+        // Slide thumb on SeekBar
+        // If thumb is not touched printf() is not executed
+        if (myBar.Slide()) printf("val = %f\r\n", val);
+        myLabel.Draw(val);
+        
+        int num;
+        if (bG.GetTouchedNumber(num))
+        {
+            if (num == 0) myBar.Activate();
+            else          myBar.Inactivate();
+        }
+        wait(0.05f);
+    }
+}