Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:20 02 Aug 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 : Micromite V5.04.09 Beta 19

     Page 5 of 5    
Author Message
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 08:49am 01 Jul 2018
Copy link to clipboard 
Print this post

Still like to know if this is the same in the previous versions, however a short bit of code and I can now set the input limit to anything I want. User can type all day and nothing more is added to the TextBox display once set limit is reached.

NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1115
Posted: 05:16am 02 Jul 2018
Copy link to clipboard 
Print this post

Guys,

I am still struggling with NumberBox. Can someone have a look at the code below to see where I am going off the rails or if there really is a bug there - appreciated any help or advice.


Option explicit
DIM MyNB = 1
Dim InsideNB
DIM ExitNB
DIM NBKeyVal
' Carry out initialisation routines here - enable interrupt last
StartPoint:
CLS
Font 3
GUI numberbox MyNB,10,120,180,40,RGB(red),RGB(Black)
BackLight 100

GUI interrupt TouchDown,TouchUp ' subroutine to handle touch int

Main:
Do 'Main program loop,
DO while InsideNB = 0
LOOP
' should only get here if touch detected
If ExitNB = 1 Then
Print "NB exited, NB value returned is ",CtrlVal(MyNB)
print "NB key value variable is ",NBKeyVal
ExitNB = 0
EndIf
Loop
' end of main process loop

' Interrupt handling subroutines
Sub TouchDown
InsideNB = 1 ' entered numberbox
end sub

Sub TouchUp
ExitNB = 1 ' left the numberbox pressing Ent
InsideNB = 0 '
End Sub

Sub MM.KEYPRESS ref as Integer, caption as string
print "Key pressed had caption ",caption
If ref = MyNB AND caption = "Ent" Then
print "Inside KP, Ent pressed with key value = ",CtrlVal(ref) ' manual says this will return a string?
' *** this next line fails because CtrlVal(ref) actually returns a Null (I think) which VAL does not like
if VAL(CtrlVal(ref)) > 60 then CtrlVal(ref) = "60"
' *** comment out the line above and uncomment the line below
' if CtrlVal(ref) > 60 then CtrlVal(ref) = 60
' *** the line above does not throw an error but does not work becuase if CtrlVal(ref) returns a NULL
' the > 60 line will always fail. if you enter a number greater than 60 it is not changed
NBKeyVal = CtrlVal(ref) ' here I want a global variable to equal the number entered
' but I always end up with NBKeyVal with a value of 0
Endif
End Sub


According to the manual, the MM.KEYPRESS subroutine should allow checking the value entered. The test code above is as per the manual as far as I can see.

Thanks,
panky


... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 05:29am 02 Jul 2018
Copy link to clipboard 
Print this post

Currently you can't read the Keypad from within MM.Keypress, that is one of the problems. You could overcome that by reading the control value outside of MM.Keypress, after the control closes. Just flag when the Ent key is pressed and then read the Control contents in the main program.



NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1115
Posted: 06:51am 02 Jul 2018
Copy link to clipboard 
Print this post

Thanks Mike, I had pretty much figured that out - it was the issue with whether the fact that CtrlVal(ref) inside KEYPRESS was a string as indicated in the manual or was something else (it acts like a NULL). In any event, either way there is an error in the manual or a bug within KEYPRESS.

Thanks for taking the time to assist.
panky
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 07:05am 03 Jul 2018
Copy link to clipboard 
Print this post

I have not used MM.KEYPRESS at all in my code but I regularly get the value from a NUMBERBOX() with NBKeyVal = CtrlVal(LASTREF) after the Touch UP interrupt has been fired (usual method set flag in interrupt routine and process in another sub).

Not sure if this helps or not.
Rob White
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1115
Posted: 07:20am 03 Jul 2018
Copy link to clipboard 
Print this post

Hi Rob, That's also how I normally do it - I was just trying to determine if there was a bug in KEYPRESS as a result of earlier dicussion in this thread.

Cheers, panky.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 10:57am 04 Jul 2018
Copy link to clipboard 
Print this post

I needed to turn Beta 19 into a final release which I have now done. It can be downloaded from http://geoffg.net/micromite.html (scroll to the bottom of the page).

There are a number of features and bugs which have been reported here which did not make it into this release so I plan to start a V5.04.10 beta version in which I will tackle these. This will be out soon and I will start a new thread for it. So, keep your eyes peeled.

Geoff
Geoff Graham - http://geoffg.net
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 09:38pm 04 Jul 2018
Copy link to clipboard 
Print this post

Thanks Geoff, I just wanted to say that this is a fabulous piece of software and none of the problems we report are in any way knocking the incredible work effort you have put into bringing this to life over the years. It's so good that I have to constantly remind myself that this is free software. Thanks again * 10000000.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 10:56pm 04 Jul 2018
Copy link to clipboard 
Print this post

  Quote  Thanks Geoff, I just wanted to say that this is a fabulous piece of software and none of the problems we report are in any way knocking the incredible work effort you have put into bringing this to life over the years. It's so good that I have to constantly remind myself that this is free software. Thanks again * 10000000.


Totally agree.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1115
Posted: 11:53pm 04 Jul 2018
Copy link to clipboard 
Print this post

Amen from me also.

panky

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
     Page 5 of 5    
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