I have a dashboard that I will be using as input to locate two linear actuators.
When I click the Width button (bWidth) t1 begins to blink with a cursor.
If I then click on the Height button (bHeight) the cursor in t1 stops and a cursor begins to blink in the t2.
All that is working fine. My two questions are:
When I start inputting #’s, how do I tell them to populate the textbox that has the focus (blinking cursor)?
Also, some help with moving the first pressed # into the tens column when a second # is pressed.
I am fairly competent on the Arduino side, but I’m a total NOOB with the Nextion display. This seems like a great forum, and I am grateful for what I’ve learned so far and I’m very appreciative of any help you can give me.
You’ll need a variable to store which entry field, Width or Height, is active.
// Note: vaTxtLength.val limits the number of characters which
// can be entered. In my project, this can vary.
// Button 1 Touch Release Event
strlen t0.txt,vaCurLength.val
if(vaCurLength.val<vaTxtLength.val)
{
t0.txt=t0.txt+"1"
}
// Button 4 Touch Release Event
strlen t0.txt,vaCurLength.val
if(vaCurLength.val<vaTxtLength.val)
{
t0.txt=t0.txt+"4"
}
// Text box Touch Release Event. This deletes last digit entered
t0.txt=t0.txt-1
// OK button Touch Release Event
// Many if statements to write the entry back to the calling page/control.
// Some convert to numbers
if(va0.val==12)// Move: X-1 Count (Each page/control has an ID)
{
cov t0.txt,pageMove.n0.val,0
pageMove.vaCount_X1.val=pageMove.n0.val
delay=100
page pageMove
}
// Some store the text in EEPROM and send it to the MCU.
if(va0.val==224)// Rose:X Axial Amplitude
{
pageRose.vaXAmp.txt=t0.txt
pageRose.t6.txt=t0.txt
wepo pageRose.t6.txt,264 //Store value in EEPROM at 224-231
print "ã" // Ascii:227
print t0.txt
printh FF // Custom serial end code
delay=100
page pageRose // Return to calling page
}
Sorry for the late reply. Thank you, this will be very helpful.
This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).