Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » first try on a own (simple) widget...
Re: first try on a own (simple) widget... [message #34671 is a reply to message #34589] Mon, 05 December 2011 10:19 Go to previous messageGo to previous message
cbpporter is currently offline  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.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Own TimeInput widget.... problem with spinbuttons etc.
Next Topic: IMAP?
Goto Forum:
  


Current Time: Sun Aug 24 13:26:57 CEST 2025

Total time taken to generate the page: 0.09423 seconds