DIR0K ;SFISC/MKO-GET KEYS FOR FIELD EDITOR ;23NOV2004
 ;;22.0;VA FileMan;**1004**;Mar 30, 1999
 ;
GETKEY ;Get key sequences
 N AU,AD,AR,AL,F1,F2,F3,F4,I,K,T
 N REMOVE,PREVSC,NEXTSC
 S AU=$P(DDGLKEY,U,2)
 S AD=$P(DDGLKEY,U,3)
 S AR=$P(DDGLKEY,U,4)
 S AL=$P(DDGLKEY,U,5)
 S F1=$P(DDGLKEY,U,6)
 S F2=$P(DDGLKEY,U,7)
 S F3=$P(DDGLKEY,U,8)
 S F4=$P(DDGLKEY,U,9)
 S REMOVE=$P(DDGLKEY,U,13)
 S PREVSC=$P(DDGLKEY,U,14)
 S NEXTSC=$P(DDGLKEY,U,15)
 ;
 S DIR0(DIR0P_"IN")="",DIR0(DIR0P_"OUT")=""
 ;
 I DIR0P="C" S I="" F  S I=$O(DIR0MAP(I)) Q:I'=+$P(I,"E")  S T=DIR0MAP(I) D INOUT
 F I=1:1 S T=$P($T(GENMAP+I),";;",2,999) Q:T=""  D INOUT
 I DIR0P="" F I=1:1 S T=$P($T(SMMAP+I),";;",2,999) Q:T=""  D INOUT
 ;
 S DIR0(DIR0P_"IN")=DIR0(DIR0P_"IN")_U
 S DIR0(DIR0P_"OUT")=$E(DIR0(DIR0P_"OUT"),1,$L(DIR0(DIR0P_"OUT"))-1)
 Q
 ;
INOUT ;Set DIR0("IN") and DIR0("OUT")
 I $P(T,";",2)="KEYDOWN" Q:$P(T,";")=""  S DIR0KD=$P(T,";"),K="KD"
 E  I $P(T,";",2)="TIMEOUT" Q:$P(T,";")=""  S DIR0TO=$P(T,";"),K="TO"
 E  S @("K="_$P(T,";",2))
 I DIR0(DIR0P_"IN")'[(U_K) D
 . S DIR0(DIR0P_"IN")=DIR0(DIR0P_"IN")_U_K
 . S DIR0(DIR0P_"OUT")=DIR0(DIR0P_"OUT")_$P(T,";")_";"
 ;
 Q
GENMAP ;General field editor key sequences
 ;;RIGHT;AR
 ;;LEFT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