Class library: Button class and ButtonGroup class for DISCO-F746NG. クラスライブラリ: DISCO-F746NG 用の,Button クラス,ButtonGroup クラス.
Dependents: F746_SpectralAnalysis_NoPhoto F746_Fourier_series_of_square_wave_01 F746_ButtonGroup_Demo F746_Mandelbrot ... more
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