Hi Ralph,

I have a full screen editor that I wrote about ...... um..... 1990 or so,
that works great.  I've also adapted it to a full screen TCL manager, and
have used it for editing dicts as well.  Care to make me an offer for the
source?  In case you decide no, here's my section from what you're working
on that handles all the chars.  My methodology for the chars was to EQU them
at the beginning, so that I can just refer to them as a name in the program
instead of the numerical values.

It also has a text window command interface, which is what CTRL-A invokes.
Got the search and replace stuff, quick find, insert or replace mode, print,
quick line delete and quick undelete unlimited number of lines per session,
select, copy, cut and paste, and a bunch of other stuff.  I pretty much made
it work like the DOS EDIT as a starter, and then started hanging other stuff
on it, like pre-compile or compile without exiting, so I can make changes in
one window, while testing in another.  Cut and Paste works either locally
using a U2 MEMOS file, or can go from machine to machine using the PC as the
clipboard (although this PC clipboard would only work on an ROI Manage-2000
system unless I converted it to a FTP script generator, or something like
that).

VAM is vertical offset AMount, HAM is Horizontal offset AMount, LIN is the
real line number and COL is the real column number, so that I can subtract
the number of pages down and the number of pages over from the real line and
real column to determine where to print the current char within the virtual
window.  It was really fun to write, so I'll understand if you want to 'roll
your own' instead of buying.  Another cool feature is that I can type in
ALLOCATED.DOLLAR.AMOUNT and hit one key to convert that to
Allocated_Dollar_Amount.  I love that one....

I wrote this in native Pick, and later converted it to U2.  Some of the
labels are numeric from before you could have alpha text labels, but
*****LOOK MA - NO GOTO'S***** !!!!!!

Hope this helps!

  LOOP
    LOOP
      IF LN.TOG THEN PRINT L(24):C(65):LIN:',':COL:EOL:
      PRINT L(LIN-VAM):C(COL-HAM):
      IF FN.KEY.ACTIVE THEN
        FN.KEY.CNTR+=1
        IF FN.KEY.CNTR>FN.KEY.LEN THEN
          FN.KEY.ACTIVE=0
          CH.IN = SEQ(IN())
        END ELSE
          CH.IN=SEQ(FN.KEY.VAL[FN.KEY.CNTR,1])
        END
      END ELSE
        CH.IN = SEQ(IN())
      END
      PRINT L(LIN-VAM):C(COL-HAM):
      IF CH.IN=2 THEN GOSUB HANDLE.FUNCTION.KEYS
      CH.IN = CHAR(CH.IN)
    WHILE CH.IN # CTRL.A DO
      BEGIN CASE
        CASE CH.IN>SMALLEST AND CH.IN<BIGGEST
          IF VM.FLAG="Y" THEN
            IF CH.IN='}' THEN [EMAIL PROTECTED]
            IF CH.IN='|' THEN [EMAIL PROTECTED]
          END
          ZIGGY=ZIG<LIN>
          ZLEN=LEN(ZIGGY)
          IF INSERT.MODE="I" THEN
            IF COL>ZLEN THEN
              ZIGGY=ZIGGY:SPACE(COL-ZLEN+5)
              ZIG<LIN>=ZIGGY[1,COL-1]:CH.IN
            END ELSE
              ZIG<LIN>=ZIGGY[1,COL-1]:CH.IN:ZIGGY[COL,LEN(ZIGGY)]
            END
            PRINT
L(LIN-VAM):C(1):EOL:CHANGE(ZIG<LIN>[1+HAM,LAST.COL],ESCAPE,'[')
            PRINT L(LIN-VAM):C(COL-HAM):
          END ELSE
            PRINT L(LIN-VAM):C(COL-HAM):
            PRINT CH.IN
            IF COL>ZLEN THEN
              ZIGGY=ZIGGY:SPACE(COL-ZLEN+5)
              ZIG<LIN>=ZIGGY[1,COL-1]:CH.IN
            END ELSE
              ZIGGY[COL,1]=CH.IN
              ZIG<LIN>=ZIGGY
            END
          END
          IF COL = LAST.COL+HAM THEN GOSUB 3000 ; * Do a H.Tab
          COL+=1
        CASE ESCAPE=CH.IN
          IP.TIMEOUT = 99999
          PRINT L(LIN-VAM):C(COL-HAM):
          IF FN.KEY.ACTIVE THEN
            FN.KEY.CNTR+=1
            IF FN.KEY.CNTR>FN.KEY.LEN THEN
              FN.KEY.ACTIVE=0
              SECOND.CHAR = SEQ(IN())
            END ELSE
              SECOND.CHAR = SEQ(FN.KEY.VAL[FN.KEY.CNTR,1])
            END
          END ELSE
            SECOND.CHAR = SEQ(IN())
          END
          SECOND.CHAR = CHAR(SECOND.CHAR)
          IF SECOND.CHAR=ESCAPE THEN
            PRINT L(LIN-VAM):C(COL-HAM):
            PRINT '['
            ZIGGY=ZIG<LIN>
            ZIGGY[COL,1]=CH.IN
            ZIG<LIN>=ZIGGY
            IF COL = LAST.COL+HAM THEN GOSUB 3000 ; * Do a H.Tab
            COL+=1
          END ELSE
            GOSUB 200 ; * Do Other Escape Sequences
          END
        CASE DOWN = CH.IN
          IF LIN = LAST.LINE+VAM THEN GOSUB 1000 ; * Do a V.Tab
          LIN+=1
        CASE UP = CH.IN
          IF LIN>1 THEN
            IF LIN=VAM+1 THEN GOSUB 2000 ; * Cancel a V.Tab
            LIN-=1
          END
        CASE LEFT = CH.IN
          IF COL>1 THEN
            IF COL>2 THEN IF COL=HAM+2 THEN GOSUB 4000 ; * Cancel a H.Tab
            COL-=1
          END
        CASE RIGHT = CH.IN
          IF COL = LAST.COL+HAM THEN GOSUB 3000 ; * Do a H.Tab
          COL+=1
        CASE TAB = CH.IN
          COL+=TOFFSET
          LOOP WHILE COL>LAST.COL+HAM DO
            GOSUB 3000 ; * Do a H.Tab
          REPEAT
        CASE CARRIAGE.RETURN = CH.IN
          IF COL=1 THEN
            INS '' BEFORE ZIG<LIN>
            GOSUB 100 ; * Display Screen
          END ELSE
            COL=1
            LIN+=1
            IF HAM>0 THEN
              HAM=0
              IF LIN > LAST.LINE+VAM THEN
                GOSUB 1000 ; * Do a Vertical Tab
              END ELSE
                GOSUB 100 ; * Display Screen
              END
            END ELSE
              IF LIN > LAST.LINE+VAM THEN GOSUB 1000 ; * Do a Vertical Tab
            END
          END
        CASE BACKSPACE = CH.IN
          IF COL>1 THEN
            IF COL>2 THEN IF COL=HAM+2 THEN GOSUB 4000 ; * Cancel a H.Tab
            IF INSERT.MODE="I" THEN
              ZIGGY=ZIG<LIN>
              ZIGA=ZIGGY[1,COL-2]
              ZIGB=ZIGGY[COL,99999]
              ZIG<LIN>=ZIGA:ZIGB
              ZIGGY=ZIG<LIN>
              ZIGA=ZIGGY[LAST.COL+HAM,1]
              COL-=1
              PRINT
L(LIN-VAM):C(1):EOL:CHANGE(ZIG<LIN>[1+HAM,LAST.COL],ESCAPE,'[')
              PRINT L(LIN-VAM):C(COL-HAM):
            END ELSE
              COL-=1
              PRINT L(LIN-VAM):C(COL-HAM):
              PRINT " "
              IF LEN(ZIG<LIN>)=COL THEN
                ZIGGY=ZIG<LIN>
                ZIGGY[COL,1]=""
                ZIG<LIN>=ZIGGY
              END ELSE
                ZIGGY=ZIG<LIN>
                ZIGGY[COL,1]=" "
                ZIG<LIN>=ZIGGY
              END
            END
          END ELSE
            IF LIN>1 THEN
              LIN-=1
              COL=LEN(ZIG<LIN>)+1
              IF INT(COL/LAST.COL)>0 THEN
                HAM=COL-HOFFSET
                GOSUB 100 ; * Display Screen
              END
            END
          END
      END CASE
    REPEAT
    GOSUB 800 ; * Windows Front End
    IF INSERT.MODE="I" THEN
      PRINT L(24):C(1):EOL:B4.T:'Insert ON':
    END ELSE
      PRINT L(24):C(1):EOL:B4.T:'Insert OFF':
    END
    PRINT ' - ':THE.FILE.NAME:' - ':ITEM.NAME:AFT.T:
  REPEAT

Allen E. Elwood
Senior Programmer Analyst
Curnayn and Associates
Direct (818) 361-5251
Fax    (818) 361-5251
Cell    (818) 800-5595
Home (818) 361-7217



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED]
Sent: Friday, July 09, 2004 22:28
To: [EMAIL PROTECTED]
Subject: Re: [U2] Unidata keystroke capture


In a message dated 7/9/2004 2:02:49 PM Pacific Daylight Time,
[EMAIL PROTECTED] writes:


> I'm trying to determine for my homegrown editor when a keystroke is
pressed
> in Unidata.
>
>   KEY = IN()
>   KEY.ID=KEY
>
>    What do I need to do next to make the KEY.ID into a useful value to
> check?
>
> CHAR?
> SEQ?

Hire a consultant. By the way why not just say KEY.ID = IN()
Voila! I have reduced your program by 50% ! Send me my check, thnks.
Make sure you work on the arrow, insert, delete, home, and end keys first,
they tend to be the deal breakers when making your own editor.  Tab, Esc,
backspace, enter are relatively easy in comparison.
Will Johnson
Fast Forward
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to