Nextion iteration

Looking for a little guidance here. I am trying to setup an application that has 16 text boxes on a Nextion basic display. I would really like to set it up where I can iterate through the boxes to update the information. Here is my setup:

#include <Nextion.h>
#define TEXT_TYPE 0;
const int numTextBoxes = 16;

NexText myText[numTextBoxes];

for (int i = 0; i < numTextBoxes; i++) {
  char textBoxName[4] = {"t"};
  strcat(textBoxName, '0' + i);
  myText[i] = NexText(TEXT_TYPE, i+1, textBoxName);

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:


Just trying to create the array and I get the following error:

no matching function for call to 'NexText::NexText()'

I am at a loss as to the proper way to initialize the array. Any help would be appreciated.
Thanks for all the help.

NexText myText[numTextBoxes];

for (int i = 0; i < numTextBoxes; i++) {

looks like you have code (the for loop) that is not within a function

the error message suggests that there is no function call NexText with 2 arguments of the type you’ve specified

I appreciate it, but I don't think that is the issue. Would that not be the same as this:

NexText myText[numTextBoxes];
myText[0] = NexText(0, 1, "t1");
myText[1] = NexText(0, 2, "t2");
myText[2] = NexText(0, 3, "t3");

I still get the same error.

you can't use a function to "statically" initialize a global variable (i.e. outside of a function)

could you find an post the NexText function prototype?

Not sure I follow the first line. (beginner level)

I think this is what you wanted to see:

class NexText: public NexTouch
public: /* methods */
     * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name);
    NexText(uint8_t pid, uint8_t cid, const char *name);

There is more to the class, but it all revolves around getting/setting text, colors, fonts...

I was just looking for an easy way to run through creating/modifying all the text boxes without having to individually create each one and maintaining each one. I have been able to do this with other variables (the actual text for each box, relay switching. I just can't figure out how to create an array of Nextion text boxes (or any other Nextion object - they all have additional parameters like the NexText object above.)


So I'm guessing this cannot be done. I have tried searching for how to do this but have not found any similar examples.