Jump to content

Question regarding gwinProgressbarDecrement()


Recommended Posts

Posted

Why does the gwinProgressbarDecrement() function decrement by both the resolution and the minimum? Shouldn't it be one or the other, and if anything I would think we would always decrement by the resolution and cap it at the min.

 

This also will allow the progress bar to fall outside the min range as an additional decrement of the step always occurs no matter what not to mention that if I want to decrement by 1 normally it will always decrement more.

 

void gwinProgressbarDecrement(GHandle gh) {
	#define gsw		((GProgressbarObject *)gh)

	if (gh->vmt != (gwinVMT *)&progressbarVMT)
		return;

	if (gsw->pos > gsw->res)
		gsw->pos -= gsw->min;
	else
		gsw->pos = gsw->min;

	gsw->pos -= gsw->res;

	PBResetDisplayPos(gsw);
	_gwinUpdate(gh);

	#undef gsw
}

 

I would think it should be something more like this:

void gwinProgressbarDecrement(GHandle gh) {
	#define gsw		((GProgressbarObject *)gh)

	if (gh->vmt != (gwinVMT *)&progressbarVMT)
		return;

	if (gsw->pos > gsw->min)
		gsw->pos -= gsw->res;
	else
		gsw->pos = gsw->min;

	PBResetDisplayPos(gsw);
	_gwinUpdate(gh);

	#undef gsw
}

 

 

Please clarify if I'm not understanding the use of this correctly.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...