|
Forum Index : Microcontroller and PC projects : Re PicoMite Text and Number Boxes
| Author | Message | ||||
| LouisG Senior Member Joined: 19/03/2016 Location: AustraliaPosts: 129 |
Hi, I made a number box on an ILI9488 screen showing the setpoint for a timer. It works fine and displays a value from an element in an array. Am able to touch the number box, have a number pad pop up, update the setpoint by punching in a new number and pressing Enter on the number pad. However, it doesn't permanently replace the old value of the array element with the new value. It just updates the value shown in the number box (which is marvellous in itself). Is there a way to make the update permanent, i.e. update the array element? ...Louis - |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2833 |
See if this works:- A(n) = CtrlVal(#x) where x is the number of the control. Haven't tried it but the manual seems to show that on p62. "= CTRLVAL(#ref) This is a function that will return the current value of a control. For controls like check boxes or switches it will be the number one (true) indicating that the control has been selected by the user or zero (false) if not. For controls that hold a number (e.g. a SPINBOX) the value will be the number (normally a floating point number). For controls that hold a string (e.g. TEXTBOX) the value will be a string. For example: PRINT "The number in the spin box is: " CTRLVAL(#10)" Edited 2023-02-22 17:25 by phil99 |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
As Phil commented, you have to read the new value of the control and assign it to your variable... there is no facility to automatically update a variable. If you want to automate this update you could intercept the touch up interrupt and copy the value in the interrupt. This will work because the touch up interrupt is fired after the user has touched the ENT key and closed the number box. By the way, in most cases you do not have to copy the value to somewhere else, you can just use the value of the control directly. ie, IF CTRLVAL(#10) > 123 THEN do something. Geoff Geoff Graham - http://geoffg.net |
||||
| LouisG Senior Member Joined: 19/03/2016 Location: AustraliaPosts: 129 |
Thanks Guys. Will give Touch Up a go + assign CTRLVAL to the variable. - |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |