It could be that I just need a toddlers guide to globals and refreshing them. Hopefully someone can assist
I have 4 pages on my Nextion, Each of the text field is set as vscope- global and each text field as a unique name
From my Arduino I am sending
// delay (10);
// delay (10);
If I am on the page where the above fields are I get a clean write. If on another page and move to this page they are not there
I assume that this has something to do with the refresh, but I would have thought that if they are global then the value would have been picked up as soon as the page is selected.
In this context can someone please explain pre and postinitialize event for a page
Any green bold component attribute in the Editor gets an auto-refresh on all changes.
The Nextion Instruction Set gives a lot of insight into the commands
t10 is being a Text component? or a Variable component? ...
in the instruction set, you will see t10.txt="text" no spaces is a correct format.
I am not an Arduino user, so I send t10.text="text" over serial, I think Arduino has a serial.write?
Every time a page is entered, there is a Pre-initialized Event (that code gets run), then next up is the Design that was declared in your HMI file (values get initialized to design time settings), then next up is the Post-initialize Event (this code gets run).
I lost all that I typed before, so this will be the condensed version. Remember Pre-Design-Post.
So Global for a text component means that its value can be set or retrieved from another page. You have to keep track of its states in the way you design your project. So I am on Page3, a user setting was on Page2. I can on Page3 set Text component t10 to the value from Page2 Text Component user2 using
Still remember Pre-Design-Post, so as the user changes Pages into Page2, the Visual Text Component will be reset to the design value. If you were to have a non-visual Variable component sitting on Page0 called user2 (sta text, and vscope global) then in a pre-init you could copy values somewhere, (design time reset occurs) and in the Post-init you can retrieve t10.txt=Page0.user.txt
Or on your Arduino you could simply track the page the user is on, and when you user changes into the page, set the t10 text value using a serial write (t10.txt="value")
Hope this was at least somewhat helpful