ewmailing / IupEmscripten

Emscripten (native web browser) backend for IUP (Portable native-GUI Interface) [switch to Emscripten branch]
Other
10 stars 1 forks source link

IupProgressBar->VALUE #11

Open cmatzenbach opened 6 years ago

zNeill commented 6 years ago

Value is working but as a next step need to implement the default MIN and MAX values as 0 and 1 per the documentation.

zNeill commented 6 years ago

@ewmailing There isn't an equivalent of the "MIN" property ( https://webserver2.tecgraf.puc-rio.br/iup/en/elem/iupprogressbar.html) in HTML. The HTML5 progress widget only has "value" and "max" properties as per W3 documentation: https://www.w3schools.com/tags/tag_progress.asp

Do you think it would be problematic to skip implementation of the IupProgressBar min property? Can you think of practical uses of a non-zero min property in Iup programs?

ewmailing commented 6 years ago

MIN is an important property that will break programs if you don't support it. It is a convenience feature, and I'm sure there are plenty of real-world cases that prefer to use their natural range instead of always normalizing between some artificial range, such as [0 to 1], [0 to 100], [0 to 1000], [-1 to 1], etc. Imagine an app that follows the progress of boiling water in F. That would scale would go from [32, 212].

I think this should be easy enough to fake. You just need to renormalize values between the user's specified MIN and MAX.

So when they set the current VALUE (progress), that is already in their units (say Fahrenheit). So if they set 32, then you renormalize it so it is 0.

And when they get the current VALUE, you convert the other way from your html widget to the user's units. So if the bar is 0, then it is 32.

zNeill commented 6 years ago

Makes perfect sense, thanks. Will implement with normalization.

On Fri, Mar 23, 2018 at 01:32 ewmailing notifications@github.com wrote:

MIN is an important property that will break programs if you don't support it. It is a convenience feature, and I'm sure there are plenty of real-world cases that prefer to use their natural range instead of always normalizing between some artificial range, such as [0 to 1], [0 to 100], [0 to 1000], [-1 to 1], etc. Imagine an app that follows the progress of boiling water in F. That would scale would go from [32, 212].

I think this should be easy enough to fake. You just need to renormalize values between the user's specified MIN and MAX.

So when they set the current VALUE (progress), that is already in their units (say Fahrenheit). So if they set 32, then you renormalize it so it is 0.

And when they get the current VALUE, you convert the other way from your html widget to the user's units. So if the bar is 0, then it is 32.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ewmailing/IupEmscripten/issues/11#issuecomment-375549880, or mute the thread https://github.com/notifications/unsubscribe-auth/ATv22jIF4BQLXUOxTTTlDfVO3jtGbolZks5thIjmgaJpZM4S4A9V .