Start a new topic

Looking for some help with variable and text boxes...

Hello all. I am trying to make a simple project where I need 3 pages. To explain....

Page one is number pad where numbers generate into t0 box. I want to store the value of t0 into a global variable. 

Page two is the same thing. Another number pad entering into t1 box and stored globally. 

Page three is 2 boxes. t2 and t3. t2 is the value of t0 on page 1 and t3 is the value of t1 on page 2. 

The last thing is t4 which is t2 and t3 added together. 

I get the number pad fine. That is working great. The problem is I can't figure out the string that saves t0 or t1 to a global variable to be called on page 3. 

I try va0.val=t0.txt when I press the enter button but it won't compile.

Basically I dont need to flip the the second page until I hit enter on the first page so I figured the command I am attempting would be best suited when the enter key is hit. 

I have looked at some similar examples on here but with no luck. Any help is appreciated. Thanks....

va0.val is numeric

t0.txt is string

You can change the .sta of a variable from Number to String

You change the .vscope from local to global

Add the pagename period in front of the variable


Ok I will try this. The number is a float (eg 12.34), would it be better to use as a number or a string?

depends, I prefer 2 number components for my floats.  If 0.01 resolution

the multiply your value * 100 then, set n1 with .length of 2

n0.val=value/100 and n1.val=value%100

I should have added, Nextion Numbers are integer based, no floating points.

But if all values were multiplied by 100, one could graphically embed a ^ decimal separator.  Kind of like the old school gas pumps use to, then numbers can be mathematically worked on.  Text will lack this conversion back for math reworking.

Login or Signup to post a comment