Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 04:42 24 Apr 2024 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 : PIN numbers

Author Message
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 02:38am 09 May 2022
Copy link to clipboard 
Print this post

Evening Gents..

I was wondering if there is a standard way to enter a PIN number into the Numberbox...

Is there a way to limit the entry to just 4 numbers max and not allow access to the second keyboard layout..?? I looked at the Formatbox but didn't see a PIN type format... Just wondering if this was done by anyone already....

Thanks..!!  
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 04:00am 09 May 2022
Copy link to clipboard 
Print this post

The FORMATBOX uses an undocumented special string construct to control how the data is to be entered.  It consists of a pair of characters repeated for as many numbers that are allowed to be entered.  The first character of a pair is a digit which is the maximum digit to be entered and the second character is the "ghost character" to guide the user.

So, you could use:
GUI FORMATBOX #ref, "9*9*9*9*", StartX, StartY, Width, Height, FColour, BColour
This would allow four digits, each with a value of 0 to 9 and a ghost char of *.

I have not tested this so there could be some problems.  The main issue that I can see is that the entered PIN will not be hidden as the user enters the digits.

For anyone who wants to explore this "feature" the following is the C code from the source:
// Format String:
// xc where x is the maximum value digit and c is the ghost char
// these are concatenated to make a string of digits (eg, seconds = 5s9s)
// Special constructs: 1 to 32 = 3dDd       1 to 12 = 1mMm
//                     1 to 24 = 2hHh       0 to 179 = 1dLd9d
// A separator is in brackets.  Eg (:)   or   (' )
// Special chars: A = AM/PM    N = N/S    E = E/W
if(checkstring(argv[a], "DATE1")) Ctrl[r].fmt = "3dDd(/)1mMm(/)9y9y";
if(checkstring(argv[a], "DATE2")) Ctrl[r].fmt = "1mMm(/)3dDd(/)9y9y";
if(checkstring(argv[a], "DATE3")) Ctrl[r].fmt = "9y9y9y9y(/)1mMm(/)3dDd";
if(checkstring(argv[a], "TIME1")) Ctrl[r].fmt = "2hHh(:)5m9m";
if(checkstring(argv[a], "TIME2")) Ctrl[r].fmt = "2hHh(:)5m9m(:)5s9s";
if(checkstring(argv[a], "TIME3")) Ctrl[r].fmt = "1hMh(:)5m9m( )A";
if(checkstring(argv[a], "TIME4")) Ctrl[r].fmt = "1hMh(:)5m9m(:)5s9s( )A";
if(checkstring(argv[a], "DATETIME1")) Ctrl[r].fmt = "3dDd(/)1mMm(/)9y9y( )1hMh(:)5m9m( )A";
if(checkstring(argv[a], "DATETIME2")) Ctrl[r].fmt = "3dDd(/)1mMm(/)9y9y( )2hHh(:)5m9m";
if(checkstring(argv[a], "DATETIME3")) Ctrl[r].fmt = "1mMm(/)3dDd(/)9y9y( )1hMh(:)5m9m( )A";
if(checkstring(argv[a], "DATETIME4")) Ctrl[r].fmt = "1mMm(/)3dDd(/)9y9y( )2hHh(:)5m9m";
if(checkstring(argv[a], "LAT1")) Ctrl[r].fmt = "8d9d(` )5m9m(' )5s9s(\" )N";
if(checkstring(argv[a], "LAT2")) Ctrl[r].fmt = "8d9d(` )5m9m(' )5s9s(.)9s(\" )N";
if(checkstring(argv[a], "LONG1")) Ctrl[r].fmt = "1dLd9d(` )5m9m(' )5s9s(\" )E";
if(checkstring(argv[a], "LONG2")) Ctrl[r].fmt = "1dLd9d(` )5m9m(' )5s9s(.)9s(\" )E";
if(checkstring(argv[a], "ANGLE1")) Ctrl[r].fmt = "9d9d9d(` )5m9m(')";


Geoff
Edited 2022-05-09 14:07 by Geoffg
Geoff Graham - http://geoffg.net
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 09:30am 09 May 2022
Copy link to clipboard 
Print this post

Much thanks Geoffg..!!

So, after the end user enters the PIN number, I then store a copy and then use the CtrlVal to once again set the FormatBox to display the Gost Text of "PIN SET". Then later, challenge the end user to match it. Once correctly matched, I would clear the internally stored PIN and allow the machine to function...

I will give it a go and report back..  

EDIT: Update... All seems to be working just fine..  

Basic testing done...
Edited 2022-05-11 22:42 by Zonker
 
Print this page


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

© JAQ Software 2024