Home » U++ Library support » CalendarCtrl » Clock small scale
Re: Clock small scale [message #20348 is a reply to message #15141] |
Fri, 13 March 2009 05:25 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
Also fixed the issue with decreasing minutes under zero by button push. The problem occurred because of the use of increment/decrement operators on byte values and passing those values to functions that expected int values. Mixing signed/unsigned is yet again not a great idea, and by using binary operators we get implicit int conversion:
void Clock::SetHourLeft()
{
sel.hour = SetMinMax(sel.hour - 1, 0, 23).value;
UpdateTime();
}
void Clock::SetHourRight()
{
sel.hour = SetMinMax(sel.hour + 1, 0, 23).value;
UpdateTime();
}
void Clock::SetMinuteLeft()
{
MinMax mm = SetMinMax(sel.minute - 1, 0, 59);
sel.minute = mm.value;
sel.hour = SetMinMax(sel.hour + mm.diff, 0, 23).value;
UpdateTime();
}
void Clock::SetMinuteRight()
{
MinMax mm = SetMinMax(sel.minute + 1, 0, 59);
sel.minute = mm.value;
sel.hour = SetMinMax(sel.hour + mm.diff, 0, 23).value;
UpdateTime();
}
|
|
|
Goto Forum:
Current Time: Tue May 14 21:32:09 CEST 2024
Total time taken to generate the page: 0.01937 seconds
|