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 » Limits check in Meter code
Limits check in Meter code [message #28689] Sun, 12 September 2010 03:33 Go to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

I had to make the following changes in Controls4u.cpp Meter code. I am limiting the meter values, otherwise meter does awful things Evil or Very Mad when it is set to values outside its Min/Max range.

void Meter::SetData(const Value& v)	{
	double val = v;
	if (val > max)	val = max;
	if (val < min)	val = min;
#ifdef _MULTITHREADED
	if (running) {	// Stop movement before changing value
		AtomicInc(kill);	
		while (running)
			Sleep(10);
		AtomicDec(kill);	
	}
	AtomicInc(running);
	Thread().Run(callback2(MeterThread, this, val));
#else
	value = val;
	RefreshValue();
#endif
}


Regards
Jerson
Re: Limits check in Meter code [message #28726 is a reply to message #28689] Mon, 13 September 2010 22:25 Go to previous message
koldo is currently offline  koldo
Messages: 3357
Registered: August 2008
Senior Veteran
Ok. Done!

Best regards
IƱaki
Previous Topic: where can I find more info?
Next Topic: Global variables in Upp
Goto Forum:
  


Current Time: Wed Apr 24 22:57:40 CEST 2024

Total time taken to generate the page: 0.02394 seconds