Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 8:479ed9f0ba20, committed 2015-12-23
- Comitter:
- MikamiUitOpen
- Date:
- Wed Dec 23 07:24:48 2015 +0000
- Parent:
- 7:6913aebb3905
- Child:
- 9:0573d8a9bbcd
- Commit message:
- 9
Changed in this revision
| button.hpp | Show annotated file Show diff for this revision Revisions of this file |
| button_group.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/button.hpp Fri Dec 11 14:23:01 2015 +0000
+++ b/button.hpp Wed Dec 23 07:24:48 2015 +0000
@@ -71,4 +71,3 @@
};
}
#endif // F746_BUTTON_HPP
-
--- a/button_group.cpp Fri Dec 11 14:23:01 2015 +0000
+++ b/button_group.cpp Wed Dec 23 07:24:48 2015 +0000
@@ -1,7 +1,7 @@
//-----------------------------------------------------------
// Button group class
//
-// 2015/12/11, Copyright (c) 2015 MIKAMI, Naoki
+// 2015/12/23, Copyright (c) 2015 MIKAMI, Naoki
//-----------------------------------------------------------
#include "button_group.hpp"
@@ -67,13 +67,13 @@
// Get touched number and redraw button if touched
bool ButtonGroup::GetTouchedNumber(int &num, uint32_t color)
{
+ if ((num<0) || (num>=numberOfButtons_)) return false;
+
+ int tmp = num;
if (GetTouchedNumber(num))
{
- for (int n=0; n<numberOfButtons_; n++)
- if (n == num)
- buttons_[n]->Draw(color);
- else
- buttons_[n]->Redraw();
+ buttons_[num]->Draw(color);
+ buttons_[tmp]->Redraw();
return true;
}
else