Loading ...
Sorry, an error occurred while loading the content.

RE: [libertybasic] How does INKEY.BAS work

Expand Messages
  • Stefan Pendl
    ... Most examples are missing a proper TRAPCLOSE command and the NOMAINWIN switch. All examples are still working, even those from release 1.x ;-) ... I would
    Message 1 of 8 , Jan 7, 2008
    • 0 Attachment
      >
      > I replaced that line with WAIT and everything worked, so thank you
      > for that help. I wonder why the code was not updated.
      >

      Most examples are missing a proper TRAPCLOSE command and the NOMAINWIN switch.
      All examples are still working, even those from release 1.x ;-)

      > I want now to incorporate a variable called say mode$ which will
      > have a value of say, "A" for alphabetical only, or "N" for numbers,
      > or "N." for numbers and decimal point etc. etc. so INKEY$ can test
      > for a limited range of INPUT for a particular instance.
      >

      I would use a variable holding the valid characters.

      Example:

      SELECT CASE mode$
      CASE "A"
      ValidChars$ = "abcdef...
      CASE "N"
      ValidChars$ = "123...
      CASE "N."
      ValidChars$ = ".123...
      END SELECT

      IF LEN(key$) = 1 AND INSTR(ValidChars$, LOWER$(key$)) > 0 THEN

      ---
      Stefan Pendl
    Your message has been successfully submitted and would be delivered to recipients shortly.