Module: _browse      Library: Clipper 5.3


This module contains the following functions and procedures:



Note: Because this is raw decompiler output, the code is closer
to that seen in a .PPO file, rather than a .PRG file. In other
words, you must allow for the preprocessor conversions normally 
performed based on the contents of STD.CH and other .CH files
 
#include "common.ch"
#include "inkey.ch"

//-----------------------------------------------------------------
//  file-wide static variables
//
static Static1:= { || setcursor(iif( readinsert(!readinsert()), 1, 2 ;
   )) }

//---------------------------------------------------[top]-
//  BROWSE( Arg1, Arg2, Arg3, Arg4 )
//
function BROWSE( Arg1, Arg2, Arg3, Arg4 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8, Local9, Local10, Local11, Local12, Local13
   if ( !used() )
      return .F.
   endif
   if ( PCount() < 4 )
      Arg1 := 1
      Arg2 := 0
      Arg3 := MaxRow()
      Arg4 := MaxCol()
   endif
   Local4 := SaveScreen(Arg1, Arg2, Arg3, Arg4)
   @ Arg1, Arg2, Arg3, Arg4 box "ΥΝΈ³ΎΝΤ³"
   @ Arg1 + 3, Arg2 say "Ζ"
   @ Arg1 + 3, Arg4 say "΅"
   @ Arg1 + 1, Arg2 + 1 say Space(Arg4 - Arg2 - 1)
   Local1 := tbrowsedb(Arg1 + 2, Arg2 + 1, Arg3 - 1, Arg4 - 1)
   Local1:headsep(" Ν")
   Local1:skipblock({ |_1| skipped(_1, Local5) })
   for Local2 := 1 to FCount()
      Local1:addcolumn(tbcolumnne(FieldName(Local2), ;
         fieldblock(FieldName(Local2))))
   next
   if ( EOF() )
      goto top
   endif
   Local5 := Local6:= .F.
   Local8 := setcursor(0)
   do while ( !Local1:stabilize() )
   enddo
   if ( LastRec() == 0 )
      Local7 := 24
      Local9 := .T.
   else
      Local9 := .F.
   endif
   Local3 := .T.
   do while ( Local3 )
      if ( !Local9 )
         do while ( !Local1:stabilize() )
            if ( ( Local7 := InKey() ) != 0 )
               Local9 := .T.
               exit
            endif
         enddo
      endif
      if ( !Local9 )
         if ( Local1:hitbottom() .AND. ( !Local5 .OR. RecNo() != ;
               LastRec() + 1 ) )
            if ( Local5 )
               Local1:refreshcur()
               do while ( !Local1:stabilize() )
               enddo
               goto bottom
            else
               Local5 := .T.
               setcursor(iif( readinsert(), 2, 1 ))
            endif
            Local1:down()
            do while ( !Local1:stabilize() )
            enddo
            Local1:colorrect({Local1:rowpos(), 1, Local1:rowpos(), ;
               Local1:colcount()}, {2, 2})
         endif
         statline(Local1, Local5)
         do while ( !Local1:stabilize() )
         enddo
         Local7 := InKey(0)
         if ( ( Local10 := SetKey(Local7) ) != Nil )
            eval(Local10, procname(1), procline(1), "")
            loop
         endif
      else
         Local9 := .F.
      endif
      do case
      case Local7 == 1001
      case Local7 == 1002 .OR. Local7 == 1006
         do case
         case ( Local12 := mrow() ) < Local1:ntop()
         case ( Local13 := mcol() ) < Local1:nleft()
         case Local12 > Local1:nbottom()
         case Local13 <= Local1:nright()
            Local11 := Local1:mrowpos() - Local1:rowpos()
            do while ( Local11 < 0 )
               Local11++
               Local1:up()
            enddo
            do while ( Local11 > 0 )
               Local11--
               Local1:down()
            enddo
            Local11 := Local1:mcolpos() - Local1:colpos()
            do while ( Local11 < 0 )
               Local11++
               Local1:left()
            enddo
            do while ( Local11 > 0 )
               Local11--
               Local1:right()
            enddo
         endcase
      case Local7 == 24
         if ( Local5 )
            Local1:hitbottom(.T.)
         else
            Local1:down()
         endif
      case Local7 == 5
         if ( Local5 )
            Local6 := .T.
         else
            Local1:up()
         endif
      case Local7 == 3
         if ( Local5 )
            Local1:hitbottom(.T.)
         else
            Local1:pagedown()
         endif
      case Local7 == 18
         if ( Local5 )
            Local6 := .T.
         else
            Local1:pageup()
         endif
      case Local7 == 31
         if ( Local5 )
            Local6 := .T.
         else
            Local1:gotop()
         endif
      case Local7 == 30
         if ( Local5 )
            Local6 := .T.
         else
            Local1:gobottom()
         endif
      case Local7 == 4
         Local1:right()
      case Local7 == 19
         Local1:left()
      case Local7 == 1
         Local1:home()
      case Local7 == 6
         Local1:end()
      case Local7 == 26
         Local1:panleft()
      case Local7 == 2
         Local1:panright()
      case Local7 == 29
         Local1:panhome()
      case Local7 == 23
         Local1:panend()
      case Local7 == 22
         if ( Local5 )
            eval(Static1)
         endif
      case Local7 == 7
         if ( RecNo() != LastRec() + 1 )
            if ( Deleted() )
               recall
            else
               delete
            endif
         endif
      case Local7 == 13
         if ( Local5 .OR. RecNo() != LastRec() + 1 )
            Local7 := doget(Local1, Local5)
            Local9 := Local7 != 0
         else
            Local7 := 24
            Local9 := .T.
         endif
      case Local7 == 27
         Local3 := .F.
      case Local7 >= 32 .AND. Local7 <= 255
         keyboard Chr(13) + Chr(Local7)
      endcase
      if ( Local6 )
         Local6 := .F.
         Local5 := .F.
         freshorder(Local1)
         setcursor(0)
      endif
   enddo
   setcursor(Local8)
   RestScreen(Arg1, Arg2, Arg3, Arg4, Local4)
   return .T.

//---------------------------------------------------[top]-
//  DOGET( Arg1, Arg2 )
//
static function DOGET( Arg1, Arg2 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8, Local9, Local10, Local11, Local12
   Arg1:hittop(.F.)
   statline(Arg1, Arg2)
   do while ( !Arg1:stabilize() )
   enddo
   Local2 := Set(_SET_SCOREBOARD, .F.)
   Local3 := Set(_SET_EXIT, .T.)
   Local1 := SetKey(K_INS, Static1)
   Local10 := setcursor(iif( readinsert(), 2, 1 ))
   Local7 := indexkey(0)
   if ( !Empty(Local7) )
      Local8 := &Local7
   endif
   Local4 := Arg1:getcolumn(Arg1:colpos())
   Local11 := eval(Local4:block())
   Local5 := getnew(Row(), Col(), { |_1| iif( PCount() == 0, Local11, ;
      Local11 := _1 ) }, "mGetVar", Nil, Arg1:colorspec())
   Local9 := .F.
   if ( ReadModal({Local5}) )
      if ( Arg2 .AND. RecNo() == LastRec() + 1 )
         append blank
      endif
      eval(Local4:block(), Local11)
      if ( !Arg2 .AND. !Empty(Local12 := ordfor(indexord())) .AND. ;
            !&Local12 )
         goto top
      endif
      if ( !Arg2 .AND. !Empty(Local7) .AND. Local8 != &Local7 )
         Local9 := .T.
      endif
   endif
   if ( Local9 )
      freshorder(Arg1)
      Local6 := 0
   else
      Arg1:refreshcur()
      Local6 := exitkey(Arg2)
   endif
   if ( Arg2 )
      Arg1:colorrect({Arg1:rowpos(), 1, Arg1:rowpos(), ;
         Arg1:colcount()}, {2, 2})
   endif
   setcursor(Local10)
   set scoreboard (Local2)
   Set(_SET_EXIT, Local3)
   SetKey(K_INS, Local1)
   return Local6

//---------------------------------------------------[top]-
//  EXITKEY( Arg1 )
//
static function EXITKEY( Arg1 )

   local Local1 := LastKey()
   do case
   case Local1 == 3
      if ( Arg1 )
         Local1 := 0
      else
         Local1 := 24
      endif
   case Local1 == 18
      if ( Arg1 )
         Local1 := 0
      else
         Local1 := 5
      endif
   case Local1 == 13 .OR. Local1 >= 32 .AND. Local1 <= 255
      Local1 := 4
   case Local1 != 5 .AND. Local1 != 24
      Local1 := 0
   endcase
   return Local1

//---------------------------------------------------[top]-
//  FRESHORDER( Arg1 )
//
static function FRESHORDER( Arg1 )

   local Local1 := RecNo()
   Arg1:refreshall()
   do while ( !Arg1:stabilize() )
   enddo
   if ( Local1 != LastRec() + 1 )
      do while ( RecNo() != Local1 .AND. !BOF() )
         Arg1:up()
         do while ( !Arg1:stabilize() )
         enddo
      enddo
   endif
   return Nil

//---------------------------------------------------[top]-
//  SKIPPED( Arg1, Arg2 )
//
static function SKIPPED( Arg1, Arg2 )

   local Local1 := 0
   if ( LastRec() != 0 )
      if ( Arg1 == 0 )
         skip 0
      elseif ( Arg1 > 0 .AND. RecNo() != LastRec() + 1 )
         do while ( Local1 < Arg1 )
            skip 
            if ( EOF() )
               if ( Arg2 )
                  Local1++
               else
                  skip -1
               endif
               exit
            endif
            Local1++
         enddo
      elseif ( Arg1 < 0 )
         do while ( Local1 > Arg1 )
            skip -1
            if ( BOF() )
               exit
            endif
            Local1--
         enddo
      endif
   endif
   return Local1

//---------------------------------------------------[top]-
//  STATLINE( Arg1, Arg2 )
//
static function STATLINE( Arg1, Arg2 )

   local Local1 := Arg1:ntop() - 1, Local2:= Arg1:nright()
   @ Local1, Local2 - 27 say "Record "
   if ( LastRec() == 0 .AND. !Arg2 )
      @ Local1, Local2 - 20 say "<none>               "
   elseif ( RecNo() == LastRec() + 1 )
      @ Local1, Local2 - 40 say "         "
      @ Local1, Local2 - 20 say "                <new>"
   else
      @ Local1, Local2 - 40 say iif( Deleted(), "<Deleted>", ;
         "         " )
      @ Local1, Local2 - 20 say pad(LTrim(Str(RecNo())) + "/" + ;
         LTrim(Str(LastRec())), 16) + iif( Arg1:hittop(), "<bof>", ;
         "     " )
   endif
   return Nil

//---EOF


Use your Browser's BACK button to return to Function Listings