cbpporter Messages: 1428 Registered: September 2007
Ultimate Contributor
I don't understand exactly what you want to do, but you are doing things very complicated.
Everywhere you are setting data, using strings, converting to from strings, etc. This is not really the U++ way. EditIntSpin what you use in some cases has "Int" in its name. So using Value semantics, it defaults to int in the right context. So instead of using:
editHour.SetData(0);
editMin.SetData(0);
you could use:
editHour <<= 0;
editMin <<= 0;
This is not important here though. Where it begins to count is in:
void Countdown::btnHourClick()
{
int i = StrInt(editHour.GetText().ToString());
if (i > 0) intime.increaseHour(i);
else intime.decreaseHour((i*(-1)));
return;
}
You should write this as:
void Countdown::btnHourClick()
{
int i = editHour;
if (i > 0) intime.increaseHour(i);
else intime.decreaseHour((i*(-1)));
return;
}
You take and EditIntSpin which stores an int in a value, call GetText, call ToString on it and finally you convert it back to an int.
The way you should implement this class IMO is make all the methods that set data to update the hour and minute fields like you wanted and then in the rest of implementation no longer keep obtaining the string representation and parse it.