Set the attribute "sta"

Hello .

I am using Arduino IDE to run the Nextion on my EPS32 project, all good,

I have a page that includes a Button I need to make invisible in some cases,

in the Nextion editor the object (Button) attribute “sta” can set a “cropped image” which I thought was one way to make the Button invisible.

looking the .h and .cpp files I don’t see that as an option.

Question: can i send a cmd to set the sta attribute?

I do that now to set the LCD backlight, for example,

LCD_Current_Backlight = 100;
dim = “dim=” + String(LCD_Current_Backlight);
sendCommand(dim.c_str());

works but may not be the most elegant, works is what I need.

so can I use cmd to set the sta attribute? for example?

Serial.println(“… Send sta cmd”);
staCmd = 0;
sta = “bFAN_page.sta=” + String(staCmd);
sendCommand(sta.c_str());

any comment / thought

thanks in advance .

You can only change items at runtime which are green. Sta is not green. You can call a hidden hotspot routine which contains the vis command.

It may be easier to put the logic on the Nextion instead of the Arduino.

Use the vis command to hide or show the object.
From the manual:
vis b0,0 // hide component with .objname b0
vis b0,1 // show component with .objname b0, refresh on front layer
vis 1,0 // hide component with .id 1
vis 1,1 // show component with .id 1, refresh on front layer
vis 255,0 // hides all components on the current page