Start a new topic

Touch Press Event on button

I downloaded the new "Nextion 2.4 Example" from today's update on Indiegogo.

On page 1 "text button", button b3 has following Touch Press Event: "t9.bco=63519".

If I test the solution with Debug, nothing happens with text t9 when I press button b3. Background color of t9 is changed when b3 is released.

So it seems like the Touch Press Event does not work as intended.

the send key value checkmark is not on ,that will enable the output of that event

But why is the output enabled on button release event instead of button press event?

you need to do it on press instead then to make it change when pressed

then if you send a command to an arduino use on event release for that

I'm not sure if I misunderstand something...

The code "t9.bco=63519" is written under Touch Press Event, but the background color of t9 is actually changed when the button is released.

I set mine up using the colors in the right side and use the user code area only for page changes and or arduino code output, (since the side does that anyway under text colors - one for pressed and one for default color)

I think we are talking about two different things :-)

The colors in the right side are used to change the color of the button you press (button b3). 

The user code "t9.bco=63519" under Touch Press Event is used to change the color of another component (text t9).

ohh now I get it, you want to change another items color when you press a button

I missed that earlier

Not all the parameters are able to auto refresh.

In this case, you need to manually refresh t9, see the picture.

We will let you know more in V0.11.

3 people like this

It works! But it would be helpfull to know in which cases the ref (refresh) is nessessary.

1 person likes this

Yes, it works now with "ref t9".

I also tested with following User Code under Touch Press Event:


t9.txt="change color"

and it works without "ref t9".

But if change the order between the 2 lines like this:

t9.txt="change color"


then the text is changed but the background color is not changed!!

In that case it is necessary to add "ref t9".

So it means that if you have several commands related to the same component and the last command changes a parameter able to auto refresh (here ".txt" parameter) then all previous parameters also refresh at the same time and it is not necessary to add "ref t9".

1 person likes this

We have added the command "ref 0" in the wiki.

ref 0: refresh all components of the current page 


If you refresh one of the components,the component will be on the first top,but covers the others.Use this command "ref 0" will be work well.

↑the original order of three components

↑change(refresh) t0,then t0 on the first top

↑use "ref 0" command refresh all components.

1 person likes this
Login or Signup to post a comment