Sign in to follow this  
Gammatech

Format in Variable Value component

Recommended Posts

I need to have a series of values neatly displayed from a range of variables. I have tried a number of variable Value components arranged one below each other with the Caption and Units set appropriately. One of the integer values from a counter tends to vary either side of 100 so might display successively for instance 86,104, 113, 95. This means that the units (Cps in this case) moves to the left as the value drops below 100. If I use Format("%.3i",Gamma[0]) then the values below 100 show with a leading zero. This prevents the units field from moving but is less easy to read. Is there a way to have a neat display of variable value components or some other way to do this?

Share this post


Link to post
Share on other sites

You can set the controls to align right, but you can only do this from script which means naming the control, then doing component.mycomponent.align = 3

Once you do it on one component, you can dup the component and it will keep that align. It will also save with the file, so you don't have to repeat it.

You can alternatively use format like you did, but instead of doing "%.3i" you want "%3i". Doing .3 doesn't make sense for "i" because i means integer and .3 means 3 digits past the decimal, or I guess for integers to prefix with 0's (though that is also: %03i) I guess I'm saying don't use . in your specifier with i or any other integer format.

Oh, and to get it to align properly, make sure and select a fixed font, not a variable width font like Arial.

Share this post


Link to post
Share on other sites

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
Sign in to follow this