I have a Log page which uses the Data object to store various events in my application.
On the Log page I have added a global string variable which holds the line event details to be logged and a hidden Hotspot object which, in its touch event, adds a timestamp to the event line and inserts the result into the Data object. See below:
// Log_Line contains log entry in the form Type^Message
// Build up a time stamp in s_logtmp
// Build Date in the form DD/MM/YY
// Build Time in the form HH:MM
// Create full record in s_logtmp in the form
// DD/MM/YY HH:MM^Type^Message
// Add entry to Data file
// Update the Record count and max value
This works fine while the Log page is the active page but if I try and run the click event while on another page in the application I get an invalid component error.
click Log.Update,0 // results in an invalid component
How can I add items to the Data object without having the data object currently visible. I have made the Log page, Update object and Log_Line objects Global but I still get Component Invalid error.
The example in the Nextion Blog assumes every thing is running on the same page but for all real world applications the it has to be possible to add items to a Data object behind the scenes.