is there a function to change all text pco in one command, rather than typing 29 times the below each time i need to change the text colouryes I am Australia
using the below lib
#include <Arduino.h> #include <Nextion.h>
nextion.print("t0.pco=22249");
nextion.write("\xFF\xFF\xFF");
// there are 29 "text" boxes that need to change ("t0" -- to -- "t29")
nextion.print("t29.pco=22249");
nextion.write("\xFF\xFF\xFF");
// then back again
// there are 29 "text" boxes that need to change ("t0" -- to -- "t29")
That's 30 text boxes, not 29...
Yes, what you do is put a hidden button* on the page and under touch release event you put all the code for the change you want to make.
You also need to put under touch press event a release event for the same button.
All you do then is send a single touch press event to the button and the rest will be done on the Nextion.
You might even be able to construct a for loop on the Nextion rather than have the same thing 29 times, but I've never tried it.
To hide a button make it as small as possible (22 I think is the smallest), make the bco, bco2, pco and pco2 all the same as the background. Put the button somewhere out of the way, if possible put it underneath something else that won't ever be touched.
Be aware that there is no one here currently who provides support for the Nextion official libraries. If you get stuck using them then so far as these fora go you will be on your own (unless you want to become the person who provides the support )
I support my own methods in my tutorial, Seithan supports his library.