Start a new topic

Am I missing something basic on component ID's?

When I assign a value to say t0.txt on page0, it also changes t0 on other pages.

Am I missing something on a very basic level?

I assume I could track the current page in use on the Nextion and send the values (and refresh) for that page, but wonder if I am missing the easy way to do this.

My searches, forum and net have not panned out

TIA

1 Comment

When you send t0.txt="this", it is going to effect the t0 text component on the current page.

It does not effect t0 on other pages as they are not in memory (unless declared as a global, in which case there should only be one t0 declared, or told to do so in event code or by the MCU code)


1) You can track your pages with the sendme command and it will return which pages is current

2) You could give all components a unique name by changing .objname attribute in your HMI design

3) You can use the "Send Component ID" checkbox in the component's Pressed/Released Events to alert your MCU as to which component has been pressed, and then deal with that component.

4) You could prepend page0.t0 or page1.t0 to your variables, although your design shouldn't require it.


Nextion HMI design when changing pages:

Conduct page PreInitialize Events

Dump current page from memory

Load requested page from HMI design with default values in the HMI design

Conduct Page Post Initialize Event

Wait for serials command, timer events or screen touch events


So if it is occurring by itself, it is being told somewhere by code to do so.


Login or Signup to post a comment