Start a new topic

If statement on button

Hi, how can I set  ' If statement ' on button to find for example
 " if(button1=pressed)
vis picture1,1



There is no need for that "if" approach. Just write your code in the respective event-handler fields for the "press" and "release" events of the button in the Nextion IDE.

My problem is exactly this:
I have one image in page1, I want the image to be enabled only when I press the button which I have in page 1. So, I set Image ( vis Image1,0) when Preinitialize Event of the page to hide the picture and when I press the button I set it (vis Image1,1) and it works perfect, but when I change page, the image hide because of Preinitilize Event

That's why Gerry told you in the other thread to save the state of visibility after button press in a global variable and using that one to control the visibility in the pre-init event instead of hiding it automatically each time you come back on the page (and the pre-init is laughed again).

1 person likes this
Login or Signup to post a comment