U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » Slider&ProgressIndicator » Progress overflow
Progress overflow [message #47640] Mon, 20 February 2017 23:50 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1310
Registered: September 2007
Ultimate Contributor
Hi, progress is overflowing for large values, giving negative % when Percent is enabled.

In Progress.cpp, from line 56 :
		w.DrawRect(r1, Nvl(color, SColorHighlight()));
		w.DrawRect(r2, SColorPaper);
		w.DrawRect(r3, SColorPaper);
		if(percent) {
			String pt = Format("%d %%", 100 * actual / max(total, 1));
			Size psz = GetTextSize(pt, StdFont());


should be

		w.DrawRect(r1, Nvl(color, SColorHighlight()));
		w.DrawRect(r2, SColorPaper);
		w.DrawRect(r3, SColorPaper);
		if(percent) {
			String pt = Format("%d %%", (int)(100L * actual / max(total, 1)));
			Size psz = GetTextSize(pt, StdFont());


Ciao

Max
Re: Progress overflow [message #47704 is a reply to message #47640] Tue, 07 March 2017 23:34 Go to previous message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Good catch, thanks, applied.
Previous Topic: SliderCtrl with UHD
Goto Forum:
  


Current Time: Sun Apr 26 02:40:00 GMT+2 2026

Total time taken to generate the page: 0.00567 seconds