Start a new topic

Global component

Many times I encountered problem when I made several pages with status bar. In status bar there is battery level and clock. The problem is that every time I change page I have to refresh component value. I suggest that you make another attribute which will change global components value with one command on all pages. So if I send clock.txt="12:35" it will change on all pages and when I switch between pages the value will be refreshed.

(52 KB)
(37.9 KB)

1 person likes this idea

This is why I extended the arduino code to have page change events. I was able to get a function callback when the page changed, then I could automatically push the screen data.
There is one shortcut but there are few drawbacks. If you initialize component value from one page or have same names for those variables. 


I've encountered the same problem I have a status bar with volume, brightness, battery and language status.

and I have about twenty pages so it a little bit difficult to initiate every page.

I am now reviewing all of the Feature Requests, this will take some time, patience please.

Global values of .txt attributes and .val attributes are captured by the .vscope Global

This does not make the component from another page available.

The HMI design allows for up to 3584 bytes (8192 in Enhanced models) per page

This is because when pages are changed they are essentially dumped from memory

There are many advanced considerations and techniques needed to realize Globals.

there are many of requests like this one. They all concern about "real" global variables, that can be either red or written by setValue, setText instruction from Arduino code, or that can be used within the Display environment.

I've  myself  come accross to such an issue.

In spite of all "advanced or technical considerations" that may be brought forth, this is a weak point of these displays that may discourage many from buying and using them. 
Thus , due to the great demand, I think developers should not underestimate such issue.

best regards

Embedded started from assembly and values loaded into registers

 - as such integer based is natural

setting of .vscope to global now saves all "attribute values"

 - any in green can be changed at runtime

 - those not in green can not be changed at runtime.

 - most requests were made at a time when .val and .txt was only saved

As explained many times, prefix the page name to the .objname

 - not such a hard task to expect that users can accomplish

   instead of


   use page prepended format of


or from an Arduino component

   instead of

      NexComponent myMCUsidevar = NexComponent(0,1,"va0");


   use page prepended format of

      NexComponent myMCUsidevar = NexComponent(0,1,"page0.va0");


As for Event Code attached to a component (for the click command)

  this is just not possible to keep all loaded and still load a page.

The Nextion is not a limitless resource MCU, but an HMI device.

But such is not a weakness of device when directions are not followed.

   - In each of those threads listed, I gave the how, even if winded.

1 person likes this

Many thanks for prompt answer. I personally appreciate your great effort to reply to all users and to be patient giving detailed explanations. Its' a really good job.

"is not a weakness"

well, if put on others behalf, most of them are not professional programmer, and they live such an issue like a problem, a complication, as far hint and instruction on "how" to do as you give 'em.
For them it stays as a complication, a tangle. That's all.

I myself spent a couple of hours to realize that the MCU numeric hidden variable "mode" (that can be egual to 0,1,2,3), that I read from arduino through "getValue" function, 
goes back to "0" value each time I change page.
For many users this behaviour - al least - appear "illogical". And at first, haven't red about it yet, I couldn't make heads or tails of it. I was puzzling earlier.

as for any hobby around, you also must be willing to invest a bit time in ... and especially the embedded world, where simple mcu datasheets can have a few 100 or even 1000 pages even a "couple of hours" is far too less ...

an Atmel ATmega328 won't became more easy to handle, only some clever business people call this mcu Arduino UNO ... and which Arduino user ever read the 450 pages of the ATmega328 datasheet?

"a "couple of hours" is far too less ..."

it's up to you. I mean it's personal, relative matter. For you is far too less, for me or others it's gettin far too much. It depends on many things. One of those is how each one interprets his/her own "hobby". For you - so to speak - is using time programming and debugging small device, for others would be building something from devices (possibly ready-to-use). It's taste matter.

Moreover, If a device it's not well implemented and easy to use, that's may prevent people from buying the device itself. From hobbist 
point of view maybe not, but from a trade p.o.v. that's a failureThat's exactly why Windows sells, and Linux doesn't spread.

the game is worth the candle? everybody has his/her own answer. I think.

and now let's go hobbing :-)

Login or Signup to post a comment