home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / CLIPPER / NCCLIB.ZIP / NCCVIEW.ZIP / G_EDIT.PRG < prev    next >
Text File  |  1993-11-02  |  20KB  |  793 lines

  1. //═══════════════════════════════════════════════════════╕
  2. //  Program .....: G_Edit                                │
  3. //  CopyRight ...: 1993 National Computer Consultants    │
  4. //                 All rights are reserved.              │
  5. //  Author ......: Greg Rice                             │
  6. //═══════════════════════════════════════════════════════╛
  7.  
  8. #include "nccview.ch"
  9. #include "set.ch"
  10. #include "inkey.ch"
  11. #include "dbstruct.ch"
  12. #include "directry.ch"
  13.  
  14.  
  15. #define BUFFER_SIZE  256
  16.  
  17. Function g_add()
  18.  
  19.     local nOrigRec := recno()
  20.  
  21.  
  22.     if ! ffadd()
  23.       DBGoTo( nOrigRec )
  24.     else
  25.       WinObj():RefreshAll()
  26.       keyboard Chr( K_ENTER )
  27.     endif
  28.  
  29. Return( NIL )
  30.  
  31.  
  32. Function g_Duplicate()
  33.  
  34.     LOCAL tmp[fcount()], nOrigRec := recno(), nAddedRec, i
  35.  
  36.  
  37.     if ffadd()
  38.       nAddedRec := Recno()
  39.       DBGoTo( nOrigRec )
  40.  
  41.       for i  = 1 to fcount()
  42.         tmp[i] := fieldget( i )
  43.       next
  44.  
  45.       DBGoTo( nAddedRec )
  46.  
  47.       for i  = 1 to fcount()
  48.          fieldput( i, tmp[i] )
  49.       next
  50.  
  51.       WinObj():Refresh := .t.
  52.     endif
  53.  
  54. Return( NIL )
  55.  
  56. Function g_insert()
  57.  
  58.     LOCAL curr_rec := recno(), tmp[fcount()], i, to_dele
  59.  
  60.     IF fflock()
  61.       IF ffadd()
  62.         Set order to 0
  63.         WHILE curr_rec < recno()
  64.           WinObj():ShowStatus(DVIEW_REFRESHING)
  65.           skip -1
  66.           for i  = 1 to fcount()
  67.             tmp[i] := fieldget( i )
  68.           next
  69.           to_dele := deleted()
  70.           recall
  71.           skip
  72.           for i  = 1 to fcount()
  73.              fieldput( i, tmp[i] )
  74.           next
  75.           IF to_dele
  76.             dele
  77.           END
  78.           skip -1
  79.         END
  80.         set order to 1
  81.       END
  82.       go bottom
  83.       skip
  84.       for i  = 1 to fcount()
  85.         tmp[i] := fieldget( i )
  86.       next
  87.       go curr_rec
  88.       for i  = 1 to fcount()
  89.          fieldput( i, tmp[i] )
  90.       next
  91.       recall
  92.       ffshare( WinFilename()  )
  93.       AttachIndexfiles( WinIndexFiles() )
  94.       WinObj():Refresh := .t.
  95.     END
  96.     go curr_rec
  97.  
  98. Return( NIL )
  99.  
  100.  
  101. Function g_quickdelete()
  102.  
  103.     if rrlock()
  104.       if deleted()
  105.         recall
  106.       else
  107.         delete
  108.       endif
  109.       unlock
  110.       WinObj():RefreshCurrent()
  111.     endif
  112.  
  113. Return( NIL )
  114.  
  115.  
  116. Function g_delete()
  117.  
  118.     STATIC hfor_cond   := "" , ;
  119.            hwhile_cond := "" , ;
  120.            hhow_many   := 0
  121.  
  122.     LOCAL scrn, ;
  123.           cColor, ;
  124.           func_choice, ;
  125.           GetList    := {}, ;
  126.           CurrentRec := Recno(), ;
  127.           sCursor    := Set( _SET_CURSOR )
  128.  
  129.     priv for_cond, while_cond, how_many
  130.  
  131.  
  132.     for_cond   := subs(hfor_cond+space(BUFFER_SIZE),1,BUFFER_SIZE)
  133.     while_cond := subs(hwhile_cond+space(BUFFER_SIZE),1,BUFFER_SIZE)
  134.     how_many   := hhow_many
  135.     scrn       := savescreen(05,05,19,62)
  136.     cColor     := setcolor()
  137.  
  138.     setcolor(popup_Color())
  139.     WinBox(5,5,18,60,0,4,.t.)
  140.     NccMesg('[ Delete/unDelete ]',5,'center,5,60')
  141.  
  142.     WHILE .t.
  143.  
  144.       FUNC_choice := if(deleted(),2,1)
  145.  
  146.       @ 08,22       Prompt  ' Delete '
  147.       @ 08,col()+3  Prompt ' unDelete '
  148.  
  149.       NccMesg('Highlight choice',11,'center,5,60')
  150.  
  151.       Menu to FUNC_choice
  152.  
  153.       NccMesg('                ',11,'center,5,60')
  154.  
  155.       IF Lastkey() == K_ESC
  156.         exit
  157.  
  158.       END
  159.  
  160.       @11,06 say 'FOR   ' get for_cond ;
  161.                           pict '@S40'
  162.       @12,06 say 'WHILE ' get while_cond ;
  163.                           pict '@S40'
  164.       @13,06 say 'SCOPE ' get how_many valid how_many >= 0
  165.       @14,06 say '     0=All or Next # of records'
  166.  
  167.       set key 28 to pop_it
  168.       set cursor on
  169.       read
  170.       set( _SET_CURSOR, sCursor )
  171.       set key 28 to
  172.  
  173.       IF lastkey() # K_ESC
  174.  
  175.         DO CASE
  176.  
  177.            CASE ! EMPTY(for_cond) .AND. TYPE(for_cond) <> "L"
  178.               msg("FOR condition must be a Logical expression")
  179.  
  180.            CASE ! EMPTY(while_cond) .AND. TYPE(while_cond) <> "L"
  181.               msg("WHILE condition must be a Logical expression")
  182.  
  183.            OTHERWISE
  184.               IF fflock()
  185.                 * ok
  186.                 IF FUNC_choice == 1
  187.                   NccMesg("Deleting",17,'center,5,60')
  188.  
  189.                 ELSE
  190.                   NccMesg("Recalling",17,'center,5,60')
  191.  
  192.                 ENDIF
  193.  
  194.  
  195.                 for_cond   := ltrim(trim(for_cond))
  196.                 while_cond := ltrim(trim(while_cond))
  197.  
  198.                 IF EMPTY(for_cond)
  199.                   * literal true is the same as no FOR condition
  200.                   for_cond := ".T."
  201.  
  202.                 ENDIF
  203.  
  204.                 IF EMPTY(while_cond)
  205.                   * literal true is the same as no WHILE condition
  206.                   while_cond := ".T."
  207.  
  208.                   IF how_many == 0
  209.                     * unless a scope has been entered
  210.                     GO TOP
  211.  
  212.                   ENDIF
  213.  
  214.                 ENDIF
  215.  
  216.                 IF FUNC_choice == 1
  217.                   IF how_many == 0
  218.                     DELETE WHILE &while_cond .and. inkey() # K_ESC FOR &for_cond
  219.  
  220.                   ELSE
  221.                     DELETE NEXT how_many WHILE &while_cond .and. inkey() # K_ESC FOR &for_cond
  222.  
  223.                   ENDIF
  224.  
  225.                 ELSE
  226.                   IF how_many == 0
  227.                     RECALL WHILE &while_cond .and. inkey() # K_ESC FOR &for_cond
  228.  
  229.                   ELSE
  230.                     RECALL NEXT how_many WHILE &while_cond .and. inkey() # K_ESC FOR &for_cond
  231.  
  232.                   ENDIF
  233.  
  234.                 ENDIF
  235.  
  236.                 WinObj():Refresh := .t.
  237.  
  238.               ENDIF
  239.  
  240.               unlock
  241.  
  242.               IF eof()
  243.                 go top
  244.  
  245.               END
  246.  
  247.               EXIT
  248.  
  249.         ENDCASE
  250.       ELSE
  251.         EXIT
  252.  
  253.       END
  254.  
  255.       scroll(11,6,17,59,0)
  256.  
  257.     END
  258.  
  259.     hfor_cond   := for_cond
  260.     hwhile_cond := hwhile_cond
  261.     hhow_many   := hhow_many
  262.  
  263.     setcolor(cColor)
  264.     restscreen(05,05,19,62,scrn)
  265.     Set( _SET_CURSOR, sCursor )
  266.  
  267.  
  268. Return( NIL )
  269.  
  270.  
  271.  
  272. Function g_pack()
  273.  
  274.     LOCAL rec, scrn, cColor, ok := .f.
  275.  
  276.     rec    := recno()
  277.     scrn   := savescreen(3,15,6,65)
  278.     cColor := SetColor()
  279.  
  280.     IF ffexcl( WinFilename() )
  281.       AttachIndexfiles( WinIndexFiles() )
  282.  
  283.       setcolor(popup_color())
  284.       WinBox(3,15,5,63,0,4,.t.)
  285.       NccMesg('Press ─┘ to confirm PACK',4,'center,15,63',,0)
  286.  
  287.       IF Lastkey() == K_RETURN
  288.         NccMesg(' PACKING ',5,'center,15,63')
  289.         pack
  290.         go top
  291.         ok := .t.
  292.  
  293.       END
  294.  
  295.       setcolor(cColor)
  296.  
  297.     END
  298.     IF ffshare( WinFilename() )
  299.       AttachIndexfiles( WinIndexFiles() )
  300.  
  301.       IF reccount() >= rec
  302.         go rec
  303.  
  304.       END
  305.     END
  306.     restscreen(3,15,6,65,scrn)
  307.     if ok
  308.       WinObj():RefreshAll(0)
  309.     endif
  310.  
  311. Return( NIL )
  312.  
  313.  
  314. Function g_zap()
  315.  
  316.     LOCAL rec     := recno() , ;
  317.            scrn   := savescreen(3,15,6,65), ;
  318.            cColor := SetColor(), ;
  319.            ok     := .f.
  320.  
  321.     IF ffexcl( WinFilename() )
  322.       setcolor(popup_color())
  323.       WinBox(3,15,5,63,0,4,.t.)
  324.       NccMesg('Press ─┘ to confirm ZAP',4,'center,15,63',,0)
  325.  
  326.       IF lastkey() == K_RETURN
  327.         NccMesg(' ZAPING ',5,'center,15,63')
  328.         zap
  329.         go top
  330.         ok := .t.
  331.  
  332.       END
  333.  
  334.       setcolor(cColor)
  335.     END
  336.  
  337.     IF ffshare( WinFilename() )
  338.       AttachIndexfiles( WinIndexFiles() )
  339.  
  340.       IF reccount() >= rec
  341.         go rec
  342.  
  343.       END
  344.     END
  345.     restscreen(3,15,6,65,scrn)
  346.     if ok
  347.       WinObj():RefreshAll(0)
  348.     endif
  349.  
  350. Return( NIL )
  351.  
  352.  
  353. Function g_replace()
  354.  
  355.     STATIC hfield_mvar := ""   , ;
  356.            hwith_what  := ""   , ;
  357.            hfor_cond   := ""   , ;
  358.            hwhile_cond := ""   , ;
  359.            hhow_many   := 0
  360.  
  361.     LOCAL scrn, ;
  362.           cColor, ;
  363.           x, ;
  364.           GetList    := {}, ;
  365.           xCursor    := Set( _SET_CURSOR ), ;
  366.           CurrentRec := Recno()
  367.  
  368.     priv field_mvar, with_what, for_cond, while_cond, how_many
  369.  
  370.     hfor_cond   := if(subs(hfor_cond,1,1) == '.', "", hfor_cond)
  371.     hwhile_cond := if(subs(hwhile_cond,1,1) == '.', "", hwhile_cond)
  372.  
  373.     field_mvar := subs(hfield_mvar+space(10),1,10)
  374.     with_what  := subs(hwith_what+space(BUFFER_SIZE),1,BUFFER_SIZE)
  375.     for_cond   := subs(hfor_cond+space(BUFFER_SIZE),1,BUFFER_SIZE)
  376.     while_cond := subs(hwhile_cond+space(BUFFER_SIZE),1,BUFFER_SIZE)
  377.     how_many   := hhow_many
  378.     scrn       := savescreen(03,12,17,69)
  379.     cColor     := setcolor()
  380.  
  381.     setcolor(popup_color())
  382.     WinBox(3,12,16,67,0,4,.t.)
  383.     NccMesg('[ Replace ]',3,'center,12,67')
  384.  
  385.     WHILE .t.
  386.       @05,13 say 'Field ' get field_mvar when force()
  387.       @06,13 say 'WITH  ' get with_what ;
  388.                           pict '@S20'
  389.  
  390.       @09,13 say 'FOR   ' get for_cond ;
  391.                           pict '@S20'
  392.       @10,13 say 'WHILE ' get while_cond ;
  393.                           pict '@S20'
  394.       @11,13 say 'SCOPE ' get how_many valid how_many >= 0
  395.       @12,13 say '     0=All or Next # of records'
  396.  
  397.       set key 28 to pop_it
  398.       Set Cursor On
  399.       read
  400.       Set( _SET_CURSOR, xCursor )
  401.       set key 28 to
  402.  
  403.       IF lastkey() # K_ESC
  404.  
  405.         DO CASE
  406.  
  407.            CASE EMPTY(field_mvar)
  408.               msg("Field not selected")
  409.  
  410.            CASE EMPTY(with_what)
  411.               msg("Replace expression not entered")
  412.  
  413.            CASE TYPE(with_what) <> TYPE(field_mvar) .and. ;
  414.                 !(TYPE(field_mvar) == "M") .and. ;
  415.                 !(TYPE(with_what) == "UI")
  416.               msg("Type mismatch between replace expression and field")
  417.  
  418.            CASE ! EMPTY(for_cond) .AND. TYPE(for_cond) <> "L"
  419.               msg("FOR condition must be a Logical expression")
  420.  
  421.            CASE ! EMPTY(while_cond) .AND. TYPE(while_cond) <> "L"
  422.               msg("WHILE condition must be a Logical expression")
  423.  
  424.            CASE ! Empty(indexkey()) .and. trim(field_mvar) $ uppe(indexkey())
  425.               x := savescreen(14,12,16,67)
  426.               NccMesg("Attempting to replace index key",14,'center,12,67')
  427.               NccMesg("Close index file first then retry", 15,'center,12,67')
  428.               NccMesg(' Press any key ', 16, 'center,12,67')
  429.               keyboard ''
  430.               inkey(0)
  431.               restscreen(14,12,16,67,x)
  432.  
  433.            OTHERWISE
  434.               IF fflock()
  435.                 * ok to replace
  436.                 NccMesg("< Replacing >",15,'center,12,67')
  437.  
  438.                 for_cond   := ltrim(trim(for_cond))
  439.                 while_cond := ltrim(trim(while_cond))
  440.  
  441.                 IF EMPTY(for_cond)
  442.                   * literal true is the same as no FOR condition
  443.                   for_cond := ".T."
  444.  
  445.                 ENDIF
  446.  
  447.                 IF EMPTY(while_cond)
  448.                   * literal true is the same as no WHILE condition
  449.                   while_cond := ".T."
  450.  
  451.                   IF how_many == 0
  452.                     * unless a scope has been entered
  453.                     GO TOP
  454.  
  455.                   ENDIF
  456.  
  457.                 ENDIF
  458.  
  459.                 IF how_many = 0
  460.                   REPLACE &field_mvar WITH &with_what;
  461.                   WHILE &while_cond .and. inkey() # K_ESC FOR &for_cond
  462.  
  463.                 ELSE
  464.                   REPLACE NEXT how_many &field_mvar WITH &with_what;
  465.                   WHILE &while_cond .and. inkey() # K_ESC FOR &for_cond
  466.  
  467.                 ENDIF
  468.  
  469.                 WinObj():Refresh := .t.
  470.  
  471.               ENDIF
  472.  
  473.               unlock
  474.  
  475.               EXIT
  476.  
  477.         ENDCASE
  478.       ELSE
  479.         EXIT
  480.  
  481.       END
  482.     END
  483.  
  484.     hfield_mvar := field_mvar
  485.     hwith_what  := with_what
  486.     hfor_cond   := for_cond
  487.     hwhile_cond := while_cond
  488.     hhow_many   := how_many
  489.  
  490.     setcolor(cColor)
  491.     Set( _SET_CURSOR, xCursor )
  492.     restscreen(03,12,17,69,scrn)
  493.     Go CurrentRec
  494.  
  495. Return( NIL )
  496.  
  497.  
  498. STATIC Function msg(x)
  499.  
  500.     local scrn := savescreen(15,12,16,67)
  501.  
  502.  
  503.     NccMesg(x,15,'center,12,67')
  504.     NccMesg(' Press any key ', 16, 'center,12,67')
  505.     inkey(0)
  506.     restscreen(15,12,16,67,scrn)
  507.  
  508. Return( NIL )
  509.  
  510.  
  511.  
  512. STATIC Function force()
  513.  
  514.     keyboard chr(K_F1)
  515.  
  516. Return( .t. )
  517.  
  518.  
  519. STATIC Function pop_it()
  520.  
  521.     local stru       := WinViewStru(), ;
  522.           pick_stru  := {}, ;
  523.           counter    := 0, ;
  524.           xsele      := 0, ;
  525.           fc, ;
  526.           scrn, ;
  527.           bottom
  528.  
  529.  
  530.     IF readvar() == 'FIELD_MVAR'
  531.       scrn := savescreen(04,49,16,67)
  532.       AEVAL(stru,{ |fi_stru| aadd(pick_stru, ' '+;
  533.                              padr(fi_stru[DBS_NAME],10,' '))+ ' ', ;
  534.                              counter++ })
  535.  
  536.  
  537.       fc     := ltrim(str(counter))
  538.       bottom := if(counter > 6,14,6+counter)
  539.       xsele  := arraydsp( ;
  540.                           pick_stru,;
  541.                           '   Field  ',;
  542.                           ,;
  543.                           07,;
  544.                           51,;
  545.                           bottom,;
  546.                           63,;
  547.                           xsele,;
  548.                           IF(xsele>((bottom-6)/2)+1,((bottom-6)/2),xsele-1),;
  549.                           .f., ;
  550.                           { K_LEFT }, ;
  551.                         )
  552.  
  553.       IF xsele # 0
  554.         if Set( _SET_CONFIRM )
  555.           fc := subs(pick_stru[xsele],2) + ;
  556.                  replicate(chr(K_LEFT),10) + ;
  557.                  chr(K_RETURN)
  558.         else
  559.           fc := subs(pick_stru[xsele],2)
  560.         endif
  561.         keyboard fc
  562.  
  563.       ELSE
  564.         keyboard chr(K_RETURN)
  565.  
  566.       END
  567.       restscreen(04,49,16,67,scrn)
  568.     END
  569.  
  570. Return( nil )
  571.  
  572.  
  573.  
  574. Function g_EditRec()
  575.  
  576.     if WinObj():UserSlot[2] == NIL
  577.       g_Hedit()
  578.     else
  579.       g_Vedit()
  580.     endif
  581.  
  582. Return( NIL )
  583.  
  584.  
  585. STATIC Function g_Hedit()
  586.  
  587.     LOCAL init      := .t.                                       , ;
  588.           Window    := WinObj()                                  , ;
  589.           stru                                                   , ;
  590.           head                                                   , ;
  591.           aEditList := { {}, {} }                                , ;
  592.           GetList   := {}                                        , ;
  593.           i         := 1                                         , ;
  594.           cCol                                                   , ;
  595.           ntxVal                                                 , ;
  596.           nLeftPos                                               , ;
  597.           nWorkArea := Select()                                  , ;
  598.           sCursor   := Set(_SET_CURSOR)
  599.  
  600.  
  601.     // EditList ... [1]  Codeblock to Get/Set Field Value
  602.     //              [2]  Field Value
  603.  
  604.     stru      := Window:Structure
  605.     head      := Window:Headings
  606.     nLeftPos  := Window:LeftPosition
  607.  
  608.     if rrlock()
  609.       Window:DehighLight()
  610.  
  611.       @ Window:TopRow-3, ;
  612.         Window:RightColumn-6 say '<Edit>'
  613.       setpos( ;
  614.               Window:CurrentRow, ;
  615.               Window:LeftColumn  ;
  616.             )
  617.  
  618.       if ! Empty( indexkey() )
  619.         NtxVal := &(indexkey())
  620.       endif
  621.  
  622.       while .t.
  623.         if col() + max(stru[nLeftPos,DBS_LEN],len(head[nLeftPos]))-1 >  ;
  624.            Window:RightColumn .and. ! init
  625.           exit
  626.         endif
  627.         aadd( aEditList[1], fieldwblock(stru[nLeftPos,DBS_NAME], nWorkArea))
  628.         aadd( aEditList[2], eval(aEditList[1,i]) )
  629.         cCol := Col()
  630.         if cCol + stru[nLeftPos,DBS_LEN]-1 > ;
  631.           Window:RightColumn
  632.           @row(),cCol get aEditList[2,i] ;
  633.                        pict '@S' + ;
  634.                        ltrim(str(Window:RightColumn-col()))
  635.         elseif valtype( aEditList[2,i] ) == 'L'
  636.           @row(),cCol+1 get aEditList[2,i]
  637.         else
  638.           @row(),cCol get aEditList[2,i]
  639.         endif
  640.         setpos(  ;
  641.                 row() , ;
  642.                 cCol+;
  643.                 max(stru[nLeftPos,DBS_LEN],len(head[nLeftPos]))+ ;
  644.                 len( Window:ColSep ) ;
  645.               )
  646.         init := .f.
  647.         nLeftPos++
  648.         i++
  649.         if nLeftPos > len(stru)
  650.           exit
  651.         endif
  652.       enddo
  653.       set cursor on
  654.       read
  655.       set(_SET_CURSOR,sCursor)
  656.  
  657.  
  658.       if ! updated()
  659.         Window:RefreshCurrent()
  660.       else
  661.         i := 1                                     // This is the
  662.         aeval( aEditList[1]                   , ;
  663.                  { |x| eval(x,aEditList[2,i]) , ;
  664.                        i++                      ;
  665.                  }                              ;
  666.              )                                    // REPL STATEMENT
  667.         if ! Empty( indexkey() )
  668.           if ! ( NtxVal == &(indexkey()) )
  669.             Window:Refresh := .t.
  670.           else
  671.             Window:RefreshCurrent()
  672.           endif
  673.         else
  674.           Window:RefreshCurrent()
  675.         endif
  676.       endif
  677.       unlock
  678.     endif
  679.  
  680. Return( NIL )
  681.  
  682.  
  683.  
  684. STATIC Function g_Vedit()
  685.  
  686.     LOCAL xfieldblock                                   , ;
  687.           xTemp                                         , ;
  688.           nKey                                          , ;
  689.           xKey                                          , ;
  690.           HoldColor                                     , ;
  691.           vBar                                          , ;
  692.           nStop     := .f.                              , ;
  693.           o         := WinObj()                         , ;
  694.           x         := WinViewStru()                    , ;
  695.           sExit     := ReadExit( .t. )                  , ;
  696.           sCursor   := SET( _SET_CURSOR )               , ;
  697.           GetList   := {}
  698.  
  699.  
  700.  
  701.     vBar := NccVbar():New( o:TopRow, o:RightColumn+1         , ;
  702.                         o:BottomRow, o:RightColumn+1      , ;
  703.                         len(x)                              ;
  704.                       )
  705.  
  706.     HoldColor      := o:InverseColor
  707.     o:InverseColor := o:StandardColor
  708.     o:deHighLight()
  709.  
  710.     if ! rrlock()
  711.       Return( NIL )
  712.     endif
  713.  
  714.     vBar:Activate()
  715.  
  716.     While .t.
  717.  
  718.        vBar:UpDate( o:userslot[2] )
  719.  
  720.        @ o:TopRow-3, ;
  721.          o:RightColumn-6 say '<Edit>'
  722.  
  723.        setpos( o:CurrentRow, o:LeftColumn+11 )
  724.        xFieldblock := fieldwblock(fieldname(fieldpos(x[o:userslot[2]][1])), Current_Window())
  725.        xTemp := xFieldblock:Eval()
  726.  
  727.        if valtype( xTemp ) == 'C' .and. len( xTemp ) > o:RightColumn - Col() + 1
  728.          @row(), o:LeftColumn + 11 GET xTemp  PICT '@S' + ;
  729.                           ltrim(str(o:RightColumn - Col() + 1))
  730.  
  731.        elseif valtype( xTemp ) == 'L'
  732.          @row(), o:LeftColumn + 12 GET xTemp
  733.        else
  734.          @row(), o:LeftColumn + 11 GET xTemp
  735.  
  736.        endif
  737.  
  738.        Set Cursor on
  739.        READ
  740.        Set Cursor Off
  741.  
  742.        xKey := 'N'
  743.        nKey := Lastkey()
  744.        if nkey == K_ESC .and. Updated()
  745.          While .t.
  746.            NccPopUp('\nAbort Changes (Y/N)\n',Popup_Color(),10 )
  747.            nKey := uppe(chr(lastkey()))
  748.            if nKey $ 'YN'
  749.              exit
  750.            endif
  751.          enddo
  752.        endif
  753.  
  754.        if xKey == 'Y' .or. nKey == K_ESC
  755.          Exit
  756.        endif
  757.  
  758.        eval( xFieldblock, xTemp )
  759.  
  760.        Do Case
  761.          Case nKey == K_PGDN        ;   o:PageDown()
  762.          Case nKey == K_PGUP        ;   o:PageUp()
  763.  
  764.          Case nKey == K_UP          ;   o:Up()
  765.          case nKey == K_SH_TAB      ;   o:Up()
  766.  
  767.          Case nKey == K_DOWN        ;   o:Down()
  768.          Case nKey == K_TAB         ;   o:Down()
  769.          Case nKey == K_ENTER       ;   o:Down()
  770.  
  771.        EndCase
  772.  
  773.        if o:AtBottom .and. ;
  774.          ( nkey == K_ENTER .or. nkey == K_DOWN .or. nKey == K_TAB ) ;
  775.          .or. ;
  776.          o:AtTop .and. ;
  777.          ( nKey == K_UP .or. nKey == K_SH_TAB )
  778.          exit
  779.        endif
  780.  
  781.      Enddo
  782.  
  783.      unlock
  784.      o:InverseColor := HoldColor
  785.      o:RefreshCurrent()
  786.  
  787.      ReadExit( sExit )
  788.      Set( _SET_CURSOR, sCursor )
  789.      vBar:Hide()
  790.  
  791. Return( NIL )
  792.  
  793.