Author Topic: Extended Input  (Read 6076 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Extended Input
« on: December 04, 2019, 10:58:01 am »
Several times over the years, I've seen people posting and asking questions like, "Why can't I paste text into INPUT?", or, "Why doesn't INPUT accept ALT-number input?" 

The answer has always been the same:  "It doesn't.  You'll just have to write your own input handler to do that!"

So, after ages of telling people they had to write their own, I finally needed to write my own input handler, so I thought I'd share:

Code: [Select]
_CONTROLCHR OFF
PRINT ExtendedInput$



FUNCTION ExtendedInput$
    PCOPY 0, 1
    A = _AUTODISPLAY: X = POS(0): Y = CSRLIN
    _KEYCLEAR
    DO
        PCOPY 1, 0
        IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN AltDown = -1 ELSE AltDown = 0
        k = _KEYHIT
        IF AltDown THEN
            SELECT CASE k 'ignore all keypresses except ALT-number presses
                CASE 48 TO 57: AltWasDown = -1: alt$ = alt$ + CHR$(k)
            END SELECT
        ELSE
            SELECT CASE k 'without alt, add any keypresses to our input
                CASE 8: oldin$ = in$: in$ = LEFT$(in$, LEN(in$) - 1) 'backspace to erase input
                CASE 9: oldin$ = in$: in$ = in$ + SPACE$(4) 'four spaces for any TAB entered
                CASE 32 TO 128
                    IF _KEYDOWN(100305) OR _KEYDOWN(100306) THEN
                        IF k = 118 OR k = 86 THEN oldin$ = in$: in$ = in$ + _CLIPBOARD$ 'ctrl-v paste
                        IF k = 122 OR k = 90 THEN SWAP in$, oldin$ 'ctrl-z undo
                    ELSE
                        oldin$ = in$: in$ = in$ + CHR$(k) 'add input to our string
                    END IF
            END SELECT
        END IF
        alt$ = RIGHT$(alt$, 3)
        IF AltWasDown = -1 AND AltDown = 0 THEN
            v = VAL(alt$)
            IF v >= 0 AND v <= 255 THEN in$ = in$ + CHR$(v)
            alt$ = "": AltWasDown = 0
        END IF
        blink = (blink + 1) MOD 30
        LOCATE Y, X: IF blink \ 15 THEN PRINT in$ ELSE PRINT in$ + "_"
        _DISPLAY
        _LIMIT 30
    LOOP UNTIL k = 13

    PCOPY 1, 0
    LOCATE Y, X: PRINT in$
    ExtendedInput$ = in$
    IF A THEN _AUTODISPLAY
END FUNCTION

This is used as basically a replacement for INPUT$, and handles quite a few special cases for us.

  • We handle regular input, as normal.
  • CTRL-V works as a paste command, so we can paste clipboard text into the input.
  • CTRL-Z works as an undo, to undo the last change to our text.
  • ALT-number keys can be used to enter an ASCII character into the input.
  • TAB inserts four spaces into our input automatically for ease of formatting.

Like INPUT, this pauses program execution until we finish our input, and it plays nicely with background processes. 



Try it out and play around with it.  See if it performs as you'd expect/want it to.  Type some junk in it.  Then hold down ALT and type in a few numeric codes. (ALT-65 is "A", ALT-1 is the little smiley face, for example.)  Try CTRL-V to paste something, and CTRL-Z to undo your last input (which can be quite useful if you paste the wrong junk into your text with CTRL-V). 

I think this should be easily expandable so people could customize it to suit their own specific needs, if they have any which is different from what it's currently doing.  At the moment, it's doing all that I'd expect it to do, for me, and I hope others might find it useful as well. 

At least now, when somebody asks about "Why can't INPUT do XXXX" again in the future, I can at least say, "Take a look at this, see if it suits your needs, and if not, maybe it'll be a nice starting point to help you write your own input handler."  :D
« Last Edit: December 04, 2019, 11:21:44 am by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Extended Input
« Reply #1 on: December 04, 2019, 11:04:35 am »
Very nice Steve, thanks!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Extended Input
« Reply #2 on: December 04, 2019, 11:12:36 am »
Slight tweak made to make certain the display didn't leave a stray blinker behind when we hit enter.  :)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Extended Input
« Reply #3 on: December 04, 2019, 11:18:29 am »
Hey Steve is it possible to do multiple lines, CHR$(10) Line Feed? That would be really cool!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Extended Input
« Reply #4 on: December 04, 2019, 11:24:19 am »
Hey Steve is it possible to do multiple lines, CHR$(10) Line Feed? That would be really cool!

Wouldn't you just take out the first line so that _CONTROLCHR was ON instead of OFF, and then type in input with ALT-10.   

Say an INPUT of "As" + ALT-10 + "the world turns"... 

The above should display as :

"As"
"the world turns"

(And that CHR$(10) is preserved in there for formatting.)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Extended Input
« Reply #5 on: December 04, 2019, 11:34:48 am »
What??? No INKEY$ model available??? BOOOOOOOOOOOOO!!!

Pete :D

You know you can't please everyone, so you have to please myself...
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Extended Input
« Reply #6 on: December 14, 2019, 11:09:41 pm »
What no SHIFT+INSERT support!?! what a rip!   WAAAAHHHHHhhhhh....  XD

As usual, nice work Steve.
Granted after becoming radioactive I only have a half-life!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Extended Input
« Reply #7 on: December 15, 2019, 02:54:31 pm »
Extended Extended Input:

Code: QB64: [Select]
  1. PRINT ExtendedInput$
  2.  
  3.  
  4.  
  5. FUNCTION ExtendedInput$
  6.     PCOPY 0, 1
  7.     A = _AUTODISPLAY: X = POS(0): Y = CSRLIN
  8.     CP = 0: OldCP = 0 'Cursor Position
  9.     _KEYCLEAR
  10.     DO
  11.         PCOPY 1, 0
  12.         IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN AltDown = -1 ELSE AltDown = 0
  13.         k = _KEYHIT
  14.         IF AltDown THEN
  15.             SELECT CASE k 'ignore all keypresses except ALT-number presses
  16.                 CASE 48 TO 57: AltWasDown = -1: alt$ = alt$ + CHR$(k)
  17.             END SELECT
  18.         ELSE
  19.             SELECT CASE k 'without alt, add any keypresses to our input
  20.                 CASE 8
  21.                     oldin$ = in$
  22.                     IF CP > 0 THEN OldCP = CP: CP = CP - 1
  23.                     in$ = LEFT$(in$, CP) + MID$(in$, CP + 2) 'backspace to erase input
  24.                 CASE 9
  25.                     oldin$ = in$
  26.                     in$ = LEFT$(in$, CP) + SPACE$(4) + MID$(in$, CP + 1) 'four spaces for any TAB entered
  27.                     OldCP = CP
  28.                     CP = CP + 4
  29.                 CASE 32 TO 128
  30.                     IF _KEYDOWN(100305) OR _KEYDOWN(100306) THEN
  31.                         IF k = 118 OR k = 86 THEN
  32.                             oldin$ = in$
  33.                             in$ = LEFT$(in$, CP) + _CLIPBOARD$ + MID$(in$, CP + 1) 'ctrl-v paste
  34.                             'CTRL-V leaves cursor in position before the paste, without moving it after.
  35.                             'Feel free to modify that behavior here, if you want it to move to after the paste.
  36.                         END IF
  37.                         IF k = 122 OR k = 90 THEN SWAP in$, oldin$: SWAP OldCP, CP 'ctrl-z undo
  38.                     ELSE
  39.                         oldin$ = in$
  40.                         in$ = LEFT$(in$, CP) + CHR$(k) + MID$(in$, CP + 1) 'add input to our string
  41.                         OldCP = CP
  42.                         CP = CP + 1
  43.                     END IF
  44.                 CASE 18176 'Home
  45.                     CP = 0
  46.                 CASE 20224 'End
  47.                     CP = LEN(in$)
  48.                 CASE 21248 'Delete
  49.                     oldin$ = in$
  50.                     in$ = LEFT$(in$, CP) + MID$(in$, CP + 2)
  51.                 CASE 19200 'Left
  52.                     CP = CP - 1
  53.                     IF CP < 0 THEN CP = 0
  54.                 CASE 19712 'Right
  55.                     CP = CP + 1
  56.                     IF CP > LEN(in$) THEN CP = LEN(in$)
  57.             END SELECT
  58.         END IF
  59.         alt$ = RIGHT$(alt$, 3)
  60.         IF AltWasDown = -1 AND AltDown = 0 THEN
  61.             v = VAL(alt$)
  62.             IF v >= 0 AND v <= 255 THEN in$ = in$ + CHR$(v)
  63.             alt$ = "": AltWasDown = 0
  64.         END IF
  65.         blink = (blink + 1) MOD 30
  66.         LOCATE Y, X
  67.         PRINT LEFT$(in$, CP);
  68.         IF blink \ 15 THEN PRINT " "; ELSE PRINT "_";
  69.         PRINT MID$(in$, CP + 1)
  70.  
  71.         _DISPLAY
  72.         _LIMIT 30
  73.     LOOP UNTIL k = 13
  74.  
  75.     PCOPY 1, 0
  76.     LOCATE Y, X: PRINT in$
  77.     ExtendedInput$ = in$
  78.  

Added on to the basic functionality presented in the original post so that now:

  • arrow keys move the cursor position inside the text.
  • Home moves the cursor to the beginning of the text.
  • End moves the cursor to the end of the text.
  • Delete now deletes a text character to the right of the cursor.

These basic capabilities make going back and editing our text much simpler and efficient than just hitting backspace until we find our glitch and then retype everything over from that point forward.



And the reason I didn't just replace the original post with this one is simply in case someone wants to write their own extended input handler.  Often, it's best to keep the base process as simple as possible, if others are going to build upon it later, rather than overly complicate things which makes it harder for them to sort out what's going on and alter/add to the original.  So, I figure in this case, simply posting both versions is the simplest way to go -- a basic routine which folks can enhance themselves to suit their personal needs, and a more robust version which offers a few more bells and whistles for plug-n-play usability.
« Last Edit: December 15, 2019, 04:10:18 pm by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Extended Input
« Reply #8 on: December 16, 2019, 10:04:43 pm »
Heya Steve,

So I was thinking (over the years but) recently (due to this post) that a different (and in some cases, better) extended input would not hang up the whole program with a DO... LOOP right in the function, but instead run on a timer to capture input and keep track of a cursor in exactly the way you make it appear, but let other things run while this is happening.

Case in point: my "universal" Sprezzo program, in client mode, can also log into chat rooms. Problem is, in order to watch the chat happen, an INPUT-like statement can't be open. Having something that passively log the keystrokes is a lot better. The old Sprezzo in fact did this, but the function wasn't just a plug-n'-play black box like you're going for.

Short story long, do you find it worth making a passive extended input function? Cause I might, but don't wanna steal your thunder. BUT... since you're kindof setting a standard with this one, there's no reason not to have a second one look and feel the same.
You're not done when it works, you're done when it's right.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Extended Input
« Reply #9 on: December 16, 2019, 10:34:30 pm »
Heya Steve,

So I was thinking (over the years but) recently (due to this post) that a different (and in some cases, better) extended input would not hang up the whole program with a DO... LOOP right in the function, but instead run on a timer to capture input and keep track of a cursor in exactly the way you make it appear, but let other things run while this is happening.

Case in point: my "universal" Sprezzo program, in client mode, can also log into chat rooms. Problem is, in order to watch the chat happen, an INPUT-like statement can't be open. Having something that passively log the keystrokes is a lot better. The old Sprezzo in fact did this, but the function wasn't just a plug-n'-play black box like you're going for.

Short story long, do you find it worth making a passive extended input function? Cause I might, but don't wanna steal your thunder. BUT... since you're kindof setting a standard with this one, there's no reason not to have a second one look and feel the same.

Terry Ritchie’s GLInput Library is passive as you’re describing it.  Your program can run in the background, with it capturing input for you.  I’ve used it several times in the past, and it’s extremely powerful and flexible once you sort out how to use it.  What I’ve got here is mainly just a simple substitute for INPUT, and it’s intended to pause program execution until ENTER is hit (just as INPUT does).

If you need passive input, check out Terry’s library before you go about building your own.  Even if it’s not what you needed, it’s well commented and documented, and might help you on the path of crafting your own easier.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Extended Input
« Reply #10 on: December 16, 2019, 10:43:00 pm »
Quote
Terry Ritchie’s GLInput Library is passive as you’re describing it.  Your program can run in the background, with it capturing input for you.  I’ve used it several times in the past, and it’s extremely powerful and flexible once you sort out how to use it.  What I’ve got here is mainly just a simple substitute for INPUT, and it’s intended to pause program execution until ENTER is hit (just as INPUT does).

If you need passive input, check out Terry’s library before you go about building your own.  Even if it’s not what you needed, it’s well commented and documented, and might help you on the path of crafting your own easier.  ;)

Say, good to know. My ego pretty much doesn't allow me to use someone else's code, but I *may* give it a look. Tee hee hee.
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Extended Input
« Reply #11 on: December 16, 2019, 10:44:41 pm »
Doesn't _LIMIT allow background processing if there is any extra time in the loop?

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Extended Input
« Reply #12 on: December 16, 2019, 11:36:22 pm »
This could be true I suppose if the other things run on timers - otherwise I figure you'd be trying to violate sequence.
You're not done when it works, you're done when it's right.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Extended Input
« Reply #13 on: February 02, 2021, 01:15:51 am »
And an upgrade to this that no one was asking for -- OEInput!

Code: QB64: [Select]
  1. OEInput "{P}Enter a password =>", a$
  2.  
  3. OEInput "{UI}Enter an unsigned integer =>", a$
  4.  
  5. OEInput "{I}Enter an integer=>", a$
  6.  
  7. OEInput "{F}Enter a float=>", a$
  8.  
  9. OEInput "{IL10}Enter an integer of less than 10 digits =>", a$
  10.  
  11. OEInput "{X15,Y15}Enter whatever at loc 15,15 =>", a$
  12.  
  13. OEInput "{D}Check to make certain paste is disabled here =>", a$
  14.  
  15.  
  16.  
  17.  
  18. SUB OEInput (prompt$, result$) 'Over Engineered Input
  19.     PCOPY 0, 1
  20.     A = _AUTODISPLAY: X = POS(0): Y = CSRLIN
  21.     CP = 0: OldCP = 0 'Cursor Position
  22.     _KEYCLEAR
  23.  
  24.     IF LEFT$(prompt$, 1) = "{" THEN 'possible limiter
  25.         i = INSTR(prompt$, "}")
  26.         IF i THEN 'yep, we have something!
  27.             limiter$ = UCASE$(MID$(prompt$, 2, i - 2))
  28.             IF INSTR(limiter$, "U") THEN limit = limit OR 1 'Unsigned
  29.             IF INSTR(limiter$, "I") THEN 'can't limit to BOTH an integer AND a float
  30.                 limit = limit OR 2 'Integer
  31.             ELSEIF INSTR(limiter$, "F") THEN
  32.                 limit = limit OR 4 'Float
  33.             END IF
  34.             IF INSTR(limiter$, "P") THEN password_protected = -1: limit = limit OR 8 'don't show passwords.
  35.             IF INSTR(limiter$, "L") THEN 'Length Limitation
  36.                 limit = limit OR 16
  37.                 jstart = INSTR(limiter$, "L")
  38.                 DO
  39.                     j = j + 1
  40.                     m$ = MID$(limiter$, jstart + j, 1)
  41.                 LOOP UNTIL m$ < "0" OR m$ > "9"
  42.                 length_limit = VAL(MID$(limiter$, jstart + 1, j - 1))
  43.             END IF
  44.             IF INSTR(limiter$, "X") THEN 'X position on screen
  45.                 limit = limit OR 32
  46.                 jstart = INSTR(limiter$, "X")
  47.                 DO
  48.                     j = j + 1
  49.                     m$ = MID$(limiter$, jstart + j, 1)
  50.                 LOOP UNTIL m$ < "0" OR m$ > "9"
  51.                 X = VAL(MID$(limiter$, jstart + 1, j - 1))
  52.             END IF
  53.             IF INSTR(limiter$, "Y") THEN 'Y position on scren
  54.                 limit = limit OR 64
  55.                 jstart = INSTR(limiter$, "Y")
  56.                 DO
  57.                     j = j + 1
  58.                     m$ = MID$(limiter$, jstart + j, 1)
  59.                 LOOP UNTIL m$ < "0" OR m$ > "9"
  60.                 Y = VAL(MID$(limiter$, jstart + 1, j - 1))
  61.             END IF
  62.             IF INSTR(limiter$, "D") THEN disable_paste = -1: limit = limit OR 128 'disable paste
  63.         END IF
  64.         IF limit <> 0 THEN prompt$ = MID$(prompt$, i + 1)
  65.     END IF
  66.  
  67.     DO
  68.         PCOPY 1, 0
  69.         IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN AltDown = -1 ELSE AltDown = 0
  70.         k = _KEYHIT
  71.         IF AltDown THEN
  72.             SELECT CASE k 'ignore all keypresses except ALT-number presses
  73.                 CASE -57 TO -48: AltWasDown = -1: alt$ = alt$ + CHR$(-k)
  74.             END SELECT
  75.         ELSE
  76.             SELECT CASE k 'without alt, add any keypresses to our input
  77.                 CASE 8
  78.                     oldin$ = in$
  79.                     IF CP > 0 THEN OldCP = CP: CP = CP - 1
  80.                     in$ = LEFT$(in$, CP) + MID$(in$, CP + 2) 'backspace to erase input
  81.                 CASE 9
  82.                     oldin$ = in$
  83.                     in$ = LEFT$(in$, CP) + SPACE$(4) + MID$(in$, CP + 1) 'four spaces for any TAB entered
  84.                     OldCP = CP
  85.                     CP = CP + 4
  86.                 CASE 32 TO 128
  87.                     IF _KEYDOWN(100305) OR _KEYDOWN(100306) THEN
  88.                         IF k = 118 OR k = 86 THEN
  89.                             IF disable_paste = 0 THEN
  90.                                 oldin$ = in$
  91.                                 in$ = LEFT$(in$, CP) + _CLIPBOARD$ + MID$(in$, CP + 1) 'ctrl-v paste
  92.                                 'CTRL-V leaves cursor in position before the paste, without moving it after.
  93.                                 'Feel free to modify that behavior here, if you want it to move to after the paste.
  94.                             END IF
  95.                         END IF
  96.                         IF k = 122 OR k = 90 THEN SWAP in$, oldin$: SWAP OldCP, CP 'ctrl-z undo
  97.                     ELSE
  98.                         check_input:
  99.                         oldin$ = in$
  100.                         IF limit AND 1 THEN 'unsigned
  101.                             IF k = 43 OR k = 45 THEN _CONTINUE 'remove signs +/-
  102.                         END IF
  103.                         IF limit AND 2 THEN 'integer
  104.                             IF k = 45 AND CP = 0 THEN GOTO good_input 'only allow a - sign for the first digit
  105.                             IF k < 48 OR k > 57 THEN _CONTINUE 'remove anything non-numeric
  106.                         END IF
  107.                         IF limit AND 4 THEN 'float
  108.                             IF k = 45 AND CP = 0 THEN GOTO good_input 'only allow a - sign for the first digit
  109.                             IF k = 46 AND period = 0 THEN period = -1: GOTO good_input 'only one decimal point
  110.                             IF k < 48 OR k > 57 THEN _CONTINUE 'remove anything non-numeric
  111.                         END IF
  112.                         good_input:
  113.                         IF CP < length_limit OR length_limit = 0 THEN
  114.                             in$ = LEFT$(in$, CP) + CHR$(k) + MID$(in$, CP + 1) 'add input to our string
  115.  
  116.                             OldCP = CP
  117.                             CP = CP + 1
  118.                         END IF
  119.                     END IF
  120.                 CASE 18176 'Home
  121.                     CP = 0
  122.                 CASE 20224 'End
  123.                     CP = LEN(in$)
  124.                 CASE 21248 'Delete
  125.                     oldin$ = in$
  126.                     in$ = LEFT$(in$, CP) + MID$(in$, CP + 2)
  127.                 CASE 19200 'Left
  128.                     CP = CP - 1
  129.                     IF CP < 0 THEN CP = 0
  130.                 CASE 19712 'Right
  131.                     CP = CP + 1
  132.                     IF CP > LEN(in$) THEN CP = LEN(in$)
  133.             END SELECT
  134.         END IF
  135.         alt$ = RIGHT$(alt$, 3)
  136.         IF AltWasDown = -1 AND AltDown = 0 THEN
  137.             v = VAL(alt$)
  138.             IF v >= 0 AND v <= 255 THEN
  139.                 k = v
  140.                 alt$ = "": AltWasDown = 0
  141.                 GOTO check_input
  142.             END IF
  143.         END IF
  144.         blink = (blink + 1) MOD 30
  145.         LOCATE Y, X
  146.         PRINT prompt$;
  147.         IF password_protected THEN
  148.             PRINT STRING$(LEN(LEFT$(in$, CP)), "*");
  149.             IF blink \ 15 THEN PRINT " "; ELSE PRINT "_";
  150.             PRINT STRING$(LEN(MID$(in$, CP + 1)), "*")
  151.         ELSE
  152.             PRINT LEFT$(in$, CP);
  153.             IF blink \ 15 THEN PRINT " "; ELSE PRINT "_";
  154.             PRINT MID$(in$, CP + 1)
  155.         END IF
  156.  
  157.         _DISPLAY
  158.         _LIMIT 30
  159.     LOOP UNTIL k = 13
  160.  
  161.     PCOPY 1, 0
  162.     LOCATE Y, X:
  163.     IF password_protected THEN
  164.         PRINT prompt$; STRING$(LEN(in$), "*")
  165.     ELSE
  166.         PRINT prompt$; in$
  167.     END IF
  168.     result$ = in$
  169.  

It does all it did before, but now you can send it a prompt to print to the screen, much like INPUT "Enter a number => "; n$

And, since I'm adding a prompt, I'm adding it's own little control system of limiters which we play around with for our text.

Control starts as the first digits of your prompt and begin with an "{" and end with an "}", and we add our control codes inside those braces.

We can limit by number (integer, unsigned, or float).  We can limit by length.  We can position our prompt without using locate. We can hide user input for passwords.  We can disable paste capabilities (which probably don't make sense to have, if we're going to limit input with other things...) Alt-### can be used to enter ASCII characters via the num pad now.

We can do one of these things, or all of these things, or none of these things!

And, if folks need something else added to this, feel free to speak up while I'm still at home and have a few days where I don't have to take care of mom.  (Which gives you the next 3 days, or so, to make requests for additions/alterations.)

My philosophy is, "If you're going to over engineer something, then by God, do it right!" 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Extended Input
« Reply #14 on: February 02, 2021, 01:21:20 am »
Quote
My philosophy is, "If you're going to over engineer something, then by God, do it right!"

Ahem, where's OPTION _EXPLICIT?
You're not done when it works, you're done when it's right.