Start a new topic
Solved

Overlapping dual-state buttons

In my case, I have a dual-state button (button1) in a given position set to "Autoloading" and another dual-state button (button2)in the same position that is set to "Load Command".


When the screen initializes, button 1 is shown, and works as expected (press it, it changes states). I have another button that toggles the shown button as follows:

 

if(button3.val==0)
{
ref button1
}
if(button3.val==1)
{
ref button2
}

 The code works fine, and will toggle which of button1 and button2 is shown on screen, but once button2 has been loaded (with the first press of button3), touching that space on the screen will always activate button2, regardless of which one (button1 or button2) is visible at that time.


It seems whichever button is on top in the editor takes precedence over the touch event in that area of the screen, regardless of which one is made visible using the "ref" command.


This problem would be resolved if we could unload an object, similar to how we use ref to load one.


Dear Paul Dufresne,


Your report has been received and we will ameliorate the nextion and provide better service!


This topic is deemed as historic and as such marked as solved.

In current Nextion Editors the introduction of the vis command offers a better solution.