Component ID Changing

Hi all,

this is my first post so please be nice.

I am using a 3.5" screen controlled by an esp32 (nspanel) I have an issue whereby randomly the components id of certain pages change by themselves even if I do not change anything on the page.

Has anyone encountered this before or know why it could be happening.

Thanks in advance

Hi and welcome @D4VEW557,

The id marks the layer at compile time. The background (page object) has id 0 and the topmost component has the highest of all ids. AFAIK these aren‘t runtime modifiable. Therefore the only thing I can imagine is that you‘re changing between similar pages with different component order and thus different ids (which is not visible until components overlap).

Kind regards,


I had exactly the same problem on my project. I found that component IDs changed when I deleted a component on a page or changed the Z-order of one. I had to continually check the IDs on the components I was using the Touch Event on and update my base code when they changed.

I finally gave up on using component IDs and the Touch Event message. I designed my own update protocol using the Prints command so I could reliably detect when a control changed and that solved my problem.


Are you using the id or the objname to interact with the page? Objname doesn’t change unless you change it. Id changes whenever the order is changed.

Hi I’ve had this issue a couple of times until I figured it out
If you change the visual order of an object ie send it back
Or delete an object,
every object on the pages gets renumbered with a new ID number.
This is incredibly frustrating especially when using the Nextion Library.
Have to go through your code and renumber everything that has changed.
Another thing that is so about this software that makes it difficult to use .

Hope this helps

Thanks for the replies chaps,

As I am still experimenting an making changes to the display so it is likely as you had said. I just assumed once object had an assigned id it would keep it regardless of changes to other objects.

Thanks again for you help.