Jump to content

Recommended Posts

Hello, I hope that you are doing well.

 

I am programming a new project in VisiLogic and was wondering if there was a way to change numeric variable properties on the fly. This is because I want the customer to be able to choose between SI and Imperial Units, and I need to change some number displays and numeric entries accordingly. I tried hiding some variables when a "unit" bit is set, but I cannot place one number on top of the other, nor are there binary numeric variables. Is there an easy way to do this that I am missing? Thank you very much in advance.

Link to comment
Share on other sites

Hi!

To implement a multiple unit numeric variable you can do the following:

1. define a numeric variable. add a numeric link and in the text box select "String from Library". You should define a library string ID variable.

2. Enter "String Library" from the project tree and double click on an empty space in the table. In the pop up window fill the text for the units you need.

3. Write the logic for the conversion between units. Use a button to select between units and perform the caluculations in every unit change. After you converted the value use the function "Set String Library" to select the unit that will be displayed.

 

I attached a small application I made for demonstration. It's a unit converter for pressure units - ATM to PSI. It's pretty straightforward and I believe you will find it easy to implement.

Pressure Convertor.vlp

Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.