Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:29 12 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Numberbox change?

Author Message
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 09:30pm 23 Mar 2019
Copy link to clipboard 
Print this post

Did the operation of the numberbox change recently?

I had this code:

GUI NUMBERBOX #2,0,100,150,60,rgb(RED),rgb(BLACK)
GUI BUTTON #3,"Cancel",0,300,150,60,rgb(RED),rgb(WHITE)

DO
Pause 100
LOOP WHILE CTRLVAL(#2) = 0 AND CTRLVAL(#3) = 0

PRINT CTRLVAL(#2)


And CTRLVAL(#2) used to remain 0 until the enter on the numberbox was touched. Now it equals whatever digit is touched.

In other words, it stayed 0 until all 4 (or whatever number) digits PLUS ENTER were touched on the numberbox.



Micromites and Maximites! - Beginning Maximite
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1044
Posted: 11:19pm 23 Mar 2019
Copy link to clipboard 
Print this post


5.05.01 ChangeLog has these notes. They indicate something has changes in this area.


Fixed a bug which caused the CtrlVal() function to return an incorrect value for a
NUMBERBOX or TEXTBOX when called from within the MM.KEYPRESS subroutine.
As part of the above fix CtrlVal() will always return a floating point value for
NUMBERBOX - even within the MM.KEYPRESS subroutine (previously it was
documented as returning a string inside this sub).


F4 H7FotSF4xGT
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 12:21am 24 Mar 2019
Copy link to clipboard 
Print this post

Lets say a number box has a value in it. The user wants to change that value. The software would want to do something now that the value has changed. I expected that the "change" would happen when the user was done entering the complete number on the popup keypad, not as each digit was being entered. When would I know that the user is done?

Micromites and Maximites! - Beginning Maximite
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1945
Posted: 01:48am 24 Mar 2019
Copy link to clipboard 
Print this post

I've been using the number box for a while and just checked it again. It correctly shows each number pressed on the keypad in the number box control, which is logical as the user needs to verify the key pressed, however I can remember in the past that even though each keypress was shown in the control, the control returned 0 if you read it before the Ent key was pressed, so from memory, it appear to have changed it's behaviour slightly, however I use MM.KEYPRESS to set a flag when the Ent key is pressed for that control and process the control value in the main loop once the flag is set. Most likely why I hadn't noticed the change before.


SUB MM.KEYPRESS(KREF AS INTEGER, CAPVal$ AS STRING)

Select CASE KREF
CASE JOBS_TBOX
IF CAPVal$ = "Ent" THEN
ELSE
DoKeyPress(CAPVal$,1)
ENDIF

CASE JOBS_DCPT
IF CAPVal$ = "Ent" THEN
ELSE
DoKeyPress(CAPVal$,2)
ENDIF

CASE NumBOX_JOBS
IF CAPVal$ = "Ent" THEN
JOBKpadClosed = 1
ButtonTouched = DO_JOBS_Kpad
ENDIF

CASE NumBox_MoveFenceVal
IF CAPVal$ = "Ent" THEN
ButtonTouched = DO_MoveFence_Kpad
ENDIF

END SELECT
END SUB


I use DoKeyPress(CAPVal$,2) for the textbox to check each char entered and limit the string length to stop text writing past the end of the control.
Edited by KeepIS 2019-03-25
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025