Start a new topic

Global variable are not available

Hello there,
the global variables are only on one side available.
It makes no difference if the variable is declared local or global.
The variable is on a new page not available.

They do work.  While on page 1 call page2.mytext.txt="Hello World".

Thank you it works fine 


So I have been able to use the Global Variable to perform a back button.  And it works well.

What I would really love to do, without Arduino Code, is to click a Text component, stuff it's value reference into a Global variable and also stuff the current page number into another global variable.  The page would switch to a keyboard, allow the user to enter a number or string, then upon clicking enter, the value would be placed back into the text component, and the page would return to where the text component resides.

In the attached example you can see I have nested back buttons working.  Also pre-populating the keypad with the current value on the pages.  Just need to figure out how to get the value back to the text component that was pressed.


1 person likes this

YES,The statement of variable should be"pageNAME.cmpNAME.val or txt=".

Looky_Xu, I am trying to use one keypad to modify multiple text components on multiple screens. So I need to know where to store the new string once I have pressed the "enter" button. Did you try my example and look at the source?

Hello there,

Now I have really found a bug.

If you have too many variables on a page can not edit it all.

I missing a scrollbar!

Thus, the maximum number of variables = screen size

For better understanding I have made a picture

3 people like this
@Looky_Xu this is a solution, but it is very messy and gets quite complex when trying to manage many variable/pages with one keypad.

1 person likes this

I don't think it is too complex. you can clearly konw that every one text component is defined by a value of variable. 

I have v0.35 and global variables do not seem to be working. I am using the correct syntax. Are global variables broken in this version of the editor? I also downloaded the back button example on this page and it gives me this error

Error: Invalid Page ID:page = back.val( Double click to jump to code)

Error: Compile failed! 1 Errors, 0 Warnings,

Please upload your HMI here.

I actually made an example to upload here and it works fine. My HMI file that does not work has about 100 png images total file size is 3MB. Could that be the cause of globals not working? I cannot post that file here because it has company specific branding on it and it would suck to remove that from every screen.


A thought.  When using global variables, it is best that the names of all objects should be unique (variables, components, page components) to avoid a potential object lookup collision.  I can't confirm with certainty that a collision is the reason, but it is worth testing.  More than 250 components per page is another limit I have yet to test, and it may be that globals defined elsewhere may add to the count.  It would be interesting if any of those could be present in your project and if so, a possible contributing factor.


1 person likes this

@Patrick I had all the globals declared with unique names. But it just would not see the variables for some reason. I did not have more that 25 components on each page but i had about a 100 small images loaded and the total size was about 3mb. I just scrapped that file and started a new file. Globals are working in that file the way they're supposed to work.

Login or Signup to post a comment