Nextion: Changing text field width doesn't work

Hi - I have a text field that I'd like to change the width of (not the character max, the actual size) from an arduino.

I'm sending a serial line like this:


The X position changes successfully, but the width does not. Am I wrong to be using ".w"?

As documented in the Nextion Editor Guide, you can only change the attributes at run time that are shown green in the editor's attribute pane.

I deduce you are using an "intelligent" class device which permits x and y to be adjusted, but not w and h. The lower class devices don't allow changes to x and y either.

You have deduced correctly, and I can see here in the Nextion editor that w/h are not green, so I will now go cry and try to figure out what's next.

While I'm bothering you, my new solution uses pictures. Unfortunately, sending the picq command over serial from the arduino doesn't work:

    Serial1.print(F("picq 322,238,60,4,126"));

Yet the command "picq 322,238,60,4,126" works perfectly fine from within the Nextion's page event programming.

  • Make sure you are printing out whatever messages the Nextion returns to the Arduino to the serial monitor - in case it is returning an error code.
  • If you don't already have it, precede the print() with an HMICommandEnd() just to make sure that the front of the command is not being messed with.
  • Connect the Arduino to the Nextion simulator and monitor what is being sent back and forward. Try manually sending the command there too.

Not getting any errors or hangups of any sort, but I have noticed that other GUI commands don't work via serial either, such as draw, line, fill, etc. But changing properties of existing components is just fine (.txt, .val, etc). It's strange...

All I can suggest is to test with a bare-bones Nextion project and Arduino sketch to eliminate as many variables from the system as possible. If it still doesn't work, then post the sketch and HMI file on the forum.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.