Thanks Tim... it looks good.

I just responded to Bill Haskett's off-list eMail with the following...

Thanks also to Brian, John, and Martin.

--Bill.B

Thanks Bill!

The given code does the job and is quite excellent.  

(Some window dressing follows.)

--Bill


-----Original Message-----
From: Bill Haskett [mailto:[EMAIL PROTECTED]
Sent: Friday, February 08, 2008 4:03 PM
To: 'Brutzman, Bill'
Subject: RE: [U2] [UB] Detecting KeyBoard Up Arrow


Bill:

The following code parses keystrokes for UV

LOOP                                                              ; ** UV
version
   AsciiChar = KEYIN()                  ; ** get ascii value           UV
version
   DecChar   = SEQ(AsciiChar)           ; ** convert ascii to decimal  UV
version
   DecStr   := DecChar : SP1            ; ** build decimal keypress    UV
version
   KeyStr   := AsciiChar                ; ** build ascii keypress      UV
version
   HexStr   := OCONV(AsciiChar, 'MX')   ; ** hex value                 UV
version
   INPUT TA.FULL,-1                     ; ** TAhead full?              UV
version
UNTIL NOT(TA.FULL) DO REPEAT                                      ; ** UV
version

What it basically does is process a keystroke, one character at a time,
until the
type-ahead buffer is empty.  The type-ahead buffer gets filled up with all
the
characters of a keystroke, so this is what you have to do to parse the
characters of
a keystroke.

If you need more info, let me know.

Bill Haskett

>------------------------------------------------------------------------

  prompt ''

  Red = @(-5)
  Grn = @(-6)

*---------------------------------------------------------------------------
---
Top:

  crt @(0)
  crt @(-1)
  
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt '  _______                             '
  crt ' /       \                            '
  crt ' \  KBT  /  ' : Red : ' KeyBoard.Test ' : Grn
  crt '  \_____/                             '   
  crt
  crt
  crt
  crt
  crt
  crt
  crt
  crt ' [Character.To.Be.Tested] ' :

  loop                                    
                       AsciiChar = keyin()     
     DecimalChar = seq(AsciiChar)           
     input  Chars.Present, -1             
  until not(Chars.Present) do repeat      

  begin case
        case DecimalChar = '65'  ;  Result = 'Up   ' 
        case DecimalChar = '66'  ;  Result = 'Down ' 
        case DecimalChar = '67'  ;  Result = 'Right' 
        case DecimalChar = '68'  ;  Result = 'Left'  
        case 1                   ;  Result = ''
  end   case

                                                           crt @(-1) : Red
                                                           crt 
                                                         crt
                                                           crt
                                                           crt '   _______
'
                                                           crt '  /       \
'
                                                           crt '  \  KBT  /
' 
                                                           crt '   \_____/
'  : Grn 
                                                           crt
                                                           crt
                                                           crt
                                                           crt
                                                           crt
                                                         crt
'__AsciiChar______' :   AsciiChar
                                                           crt
'__DecimalChar____' : DecimalChar
    begin case
          case Result # ''  ;                crt '__Result_________' :
Result 
    end   case
                                                           crt
                                                           crt '  [<]  [X]
' : 

  input Ans, 1 :
        Ans = upcase(Ans)

  begin case
        case Ans = 'X'  ;  null
          case 1          ;  go Top
  end   case  

*---------------------------------------------------------------------------
---
The.End:

  crt @(-1)
  
  END
  

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Tim Stokes
Sent: Friday, February 08, 2008 5:25 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [UB] Detecting KeyBoard Up Arrow


The SYSTEM.14 is a variable I named it SYSTEM.14 because in some Pick
system SYSTEM(14) returned what was in the input buffer.

The version I used here is the FOR NEXT version. Other version use the
LOOP as someone has already shown.

You can do is this as well.

Ans = ''
LOOP
WHILE INPUT INPUT.BUFFER,-1 DO
  Ans := KEY()
REPEAT
INPUTCLEAR ; * Flush the input buffer.

Ans will that have the entire sequence

Then you have code something like this.

BEGIN CASE
 CASE ANS[1,3] = CHAR(27):"[A"
   * Code for up arrow
 CASE ANS[1,1] = "A"
   * Code for activity
 CASE ANS[1,1] = "M"
   * Code for MPR calc
 CASE ANS[1,1] = "P"
   * Code for Purchase Order
 CASE ANS[1,1] = "X"
   * code for exit
 CASE 1
   * Code for anything else they pressed
END CASE

Using this code if you have someone who is a fast typist what they
entered after the selection will be flushed.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brutzman, Bill
Sent: Friday, February 08, 2008 3:29 PM
To: 'u2-users@listserver.u2ug.org'
Subject: RE: [U2] [UB] Detecting KeyBoard Up Arrow

While I appreciate the responses, I am still struggling with this
dog-gone
thing.

An aspect of it that I have not mentioned yet is that the user prompt
that
this is intended to be used with includes alpha characters, that is...

   Menu

        [A]  Activity
        [M]  MRP Calc
        [P]  Purchase.Orders
        [X]  Exit
      [U]  Up.Arrow

Also... in the following, why are we counting to SYSTEM.14.

 INPUT SYSTEM.14,-1
  Ans = ''
  FOR X = 1 TO SYSTEM.14
    Ans := KEYIN()
  NEXT X
        
Further help would be appreciated.

--Bill


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Tim Stokes
Sent: Friday, February 08, 2008 11:37 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [UB] Detecting KeyBoard Up Arrow


You can use something like this.
 INPUT SYSTEM.14,-1
  Ans = ''
  FOR X = 1 TO SYSTEM.14
    Ans := KEYIN()
  NEXT X
  
begin case
        case Ans = CHAR(27):"[A"   ;  crt 'Victory ' : 
                                gosub Bottom.Prompt 

        case Ans = 'x'     ;  go The.End
        case Ans = 'X'     ;  go The.End

          case 1             ;  crt '__' : Ans : '__'   
                                gosub Bottom.Prompt 
  end   case
  

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brutzman, Bill
Sent: Thursday, February 07, 2008 5:00 PM
To: 'u2-users@listserver.u2ug.org'
Subject: [U2] [UB] Detecting KeyBoard Up Arrow

The following program needs help.

Using Dynamic Connect (+ wIntegrate) , I am trying to decode it when a
user
presses the UpArrow key.

Suggestions would be appreciated.

--Bill


________________________________________________________________________
____
____

  prompt ''

*-----------------------------------------------------------------------
----
---
Top: 

  crt @(-1)
  crt
  crt

  input Ans, 1

  begin case
        case Ans = '^[OA'  ;  crt 'Victory ' : 
                                gosub Bottom.Prompt 

        case Ans = 'x'     ;  go The.End
        case Ans = 'X'     ;  go The.End

          case 1             ;  crt '__' : Ans : '__'   
                                gosub Bottom.Prompt 
  end   case

  go Top

*-----------------------------------------------------------------------
----
---
*-----------------------------------------------------------------------
----
---
Bottom.Prompt:

                              crt
                                crt ' [<] ' :
                                    input Ans.2
return

*-----------------------------------------------------------------------
----
---
The.End:

  crt @(-1)

END

________________________________________________________________________
____
_____

The program comes back with the following...  The box looks like the pi
symbol (3.14) on the screen.

^[
____

 [<] OA
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to