But the code refused to enter the inner loop of each nested FOR. After dozens of attempts at adjusting the indentation and using various debugging tools, I decided to just retype it. I retyped it exactly as is, and it worked.
The short answer is: what you experienced is not supposed to happen and from your description I cannot see a plausible explanation. Hence it would be helpful to have an example file that demonstrates each case such that other people can have a look at it and investigate the problem on their own.
I cut and pasted the original code into a button, so see if I could force it to run. It did not.
The not working code…? From where? Anyways. Example files are the way to go.
So there is something about the way it was typed that affected the way it ran. If someone could explain this to me, I would appreciate it.
Question, when I type a variable name, and Nextion shows a pop up box with the name of the variable, can I keep typing, or do I have to hit enter in order to make sure Nextion knows this is a variable?
No, this does not make a difference. Nextion is not indentation sensitive, nor is sensitive to copy/pase. Also, Nextion does nothing smart during autocomplete (or at any other moment). Autocomplete just types the letters for you.
The HMI file - which is compiled into the TFT file that will be uploaded to the device or run in the debugger - doesn’t contain anything complex/smart/… The device properties (model, orientation, encoding, etc), a list of all your pages, each one with a list of components, each one with its attributes just as you see them in the editor (yes, when you open it in an editor you’ll see
id[value]type[value]objname[value]...). No other information. The code events are also stored line by line as you typed and see them in the editor. No hidden variables/links/… Your text and int32 values. That’s all there is.
Btw. you can let Nextion do the indentation automatically by switching the code view to another event (f.ex. switch from touch press to touch release event and back). You’ll see that the editor has adjusted the indentation. Just to repeat, no, it does not make a difference. It’s only cosmetics.