Module: _browsys      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"

//---------------------------------------------------[top]-
//  FIELDNBLOC( Arg1, Arg2 )
//
function FIELDNBLOC( Arg1, Arg2 )

   local Local1
   if ( Select(Arg1) == 0 )
      return Nil
   elseif ( ( Arg1 )->( Local1 := fieldpos(Arg2) ) == 0 )
      return Nil
   endif
   return { |_1| iif( ISNIL( _1 ), ( Arg1 )->( fieldget(Local1) ), ;
      fieldnput(Arg1, Arg2, _1) ) }

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

   local Local1, Local2
   if ( Select(Arg1) == 0 )
      return .F.
   elseif ( ( Arg1 )->( Local1 := fieldpos(Arg2) ) == 0 )
      return .F.
   endif
   Local2 := Seconds()
   do while ( !( Arg1 )->( dbrlock() ) )
      if ( Seconds() < Local2 )
      elseif ( alert("ERROR: Unable to Save Information", {"Retry", ;
            "Cancel"}) != 1 )
         return .F.
      else
         Local2 := Seconds() + 20
      endif
      InKey(0.2)
   enddo
   ( Arg1 )->( fieldput(Local1, Arg3) )
   ( Arg1 )->( dbrunlock(( Arg1 )->( RecNo() )) )
   return .T.

//---------------------------------------------------[top]-
//  TBADDCOL( Arg1, Arg2 )
//
function TBADDCOL( Arg1, Arg2 )

   return makecolumn(Arg1, Arg2, Nil)

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

   local Local1
   if ( !( ISNUMBER( Arg3 ) ) )
      Arg3 := Len(Arg1[ 8 ]) + 1
   elseif ( Arg3 < 1 )
      return Arg1
   elseif ( Arg3 > Len(Arg1[ 8 ]) )
      return Arg1
   endif
   AAdd(Arg1[ 8 ], Arg2[ 1 ])
   if ( ISARRAY( Arg1[ 3 ] ) )
      Local1 := tbcolumnne(Arg2[ 7 ], { |_1| iif( ISNIL( _1 ), ;
         Arg1[ 3 ][ Arg1[ 4 ] ], Arg1[ 3 ][ Arg1[ 4 ] ] := _1 ) })
   else
      Local1 := tbcolumnne(Arg2[ 7 ], fieldwbloc(Arg2[ 1 ], ;
         Select(Arg1[ 3 ])))
   endif
   Arg2 := asize(Arg2, 13)
   Local1:colorbloc(Arg2[ 2 ])
   Local1:colsep(Arg2[ 3 ])
   Local1:defcolor(Arg2[ 4 ])
   Local1:footing(Arg2[ 5 ])
   Local1:footsep(Arg2[ 6 ])
   Local1:heading(Arg2[ 7 ])
   Local1:headsep(Arg2[ 8 ])
   Local1:width(Arg2[ 9 ])
   Local1:picture(Arg2[ 10 ])
   Local1:preblock(Arg2[ 11 ])
   Local1:postblock(Arg2[ 12 ])
   if ( ISLOGICAL( Arg2[ 13 ] ) )
      Local1:setstyle(1, Arg2[ 13 ])
   endif
   Arg1[ 1 ]:addcolumn(Local1)
   return Arg1

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

   return makecolumn(Arg1, Arg2, Arg3)

//---------------------------------------------------[top]-
//  TBBBLOCK( Arg1, Arg2 )
//
function TBBBLOCK( Arg1, Arg2 )

   local Local1, Local2 := Arg1[ 7 ]
   if ( ISBLOCK( Arg2 ) )
      Arg1[ 7 ] := Arg2
   endif
   return Local2

//---------------------------------------------------[top]-
//  TBCLOSE( Arg1 )
//
function TBCLOSE( Arg1 )

   local Local1, Local2, Local3, Local4, Local5
   if ( Set(40) == 3 .OR. ISNIL( Set(40) ) )
      RestScreen(Asc(SubStr(Arg1[ 2 ], 1, 1)), Asc(SubStr(Arg1[ 2 ], ;
         2, 1)), Asc(SubStr(Arg1[ 2 ], 3, 1)), Asc(SubStr(Arg1[ 2 ], ;
         4, 1)), SubStr(Arg1[ 2 ], 5))
   else
      Local1 := Len(Arg1[ 2 ])
      Local2 := Arg1[ 2 ][ Local1 - 3 ]
      Local3 := Arg1[ 2 ][ Local1 - 2 ]
      Local4 := Arg1[ 2 ][ Local1 - 1 ]
      Local5 := Arg1[ 2 ][ Local1 ]
      RestScreen(Local2, Local3, Local4, Local5, Arg1[ 2 ])
   endif
   return Nil

//---------------------------------------------------[top]-
//  TBCREATE( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, ;
//
function TBCREATE( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, ;
   Arg9 )

   local Local1, Local2
   Local1 := tbrowsenew(Arg2, Arg3, Arg4, Arg5)
   Local1:autolite(.F.)
   Local1:headsep("")
   Local1:colsep("")
   Local1:skipblock({ |_1| tbskip(Local2, _1) })
   if ( ISARRAY( Arg1 ) )
      Local1:gotopbloc({ || Local2[ 4 ] := 1 })
      Local1:gobottomb({ || Local2[ 4 ] := Len(Local2[ 3 ]) })
   else
      Local1:gotopbloc({ || tbgotop(Local2) })
      Local1:gobottomb({ || tbgobot(Local2) })
   endif
   if ( ISCHARACTER( Arg6 ) )
      Local1:colorspec(Arg6)
   endif
   if ( ISCHARACTER( Arg7 ) )
      Local1:border(Arg7)
   endif
   if ( ISLOGICAL( Arg8 ) )
      Local1:setstyle(1, Arg8)
   else
      Arg8 := .F.
   endif
   if ( ISLOGICAL( Arg9 ) )
      Local1:setstyle(3, Arg9)
   else
      Arg9 := .F.
   endif
   if ( Arg9 )
      Local1:setkey(0, { |_1, _2| tbeditcell(_1, _2) })
   endif
   Local2 := array(8)
   Local2[ 1 ] := Local1
   Local2[ 2 ] := ""
   Local2[ 3 ] := Arg1
   Local2[ 8 ] := {}
   Local2[ 5 ] := { || .T. }
   if ( Set(40) == 3 .OR. ISNIL( Set(40) ) )
      Local2[ 2 ] := Chr(Local1:ntop()) + Chr(Local1:nleft()) + ;
         Chr(Local1:nbottom()) + Chr(Local1:nright()) + ;
         SaveScreen(Local1:ntop(), Local1:nleft(), Local1:nbottom(), ;
         Local1:nright())
   else
      Local2[ 2 ] := SaveScreen(Local1:ntop(), Local1:nleft(), ;
         Local1:nbottom(), Local1:nright())
      AAdd(Local2[ 2 ], Local1:ntop())
      AAdd(Local2[ 2 ], Local1:nleft())
      AAdd(Local2[ 2 ], Local1:nbottom())
      AAdd(Local2[ 2 ], Local1:nright())
   endif
   return Local2

//---------------------------------------------------[top]-
//  TBDELCOL( Arg1, Arg2 )
//
function TBDELCOL( Arg1, Arg2 )

   local Local1
   if ( Arg2 <= Arg1[ 1 ]:colcount() )
      Arg1[ 1 ]:delcolumn(Arg2)
      Local1 := Arg1[ 8 ]
      adel(Local1, Arg2)
      asize(Local1, Len(Local1) - 1)
   endif
   return Arg1

//---------------------------------------------------[top]-
//  TBDISPLAY( Arg1, Arg2 )
//
function TBDISPLAY( Arg1, Arg2 )

   if ( !( ISLOGICAL( Arg2 ) ) )
      Arg2 := .F.
   endif
   if ( Arg2 )
      Arg1[ 1 ]:invalidate()
   else
      Arg1[ 1 ]:refreshall()
   endif
   Arg1[ 1 ]:forcestabl()
   return Arg1

//---------------------------------------------------[top]-
//  TBEDITCELL( Arg1, Arg2 )
//
function TBEDITCELL( Arg1, Arg2 )

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8
   if ( !Arg1:setstyle(3) )
      return 1
   endif
   Local6 := Arg1:getcolumn(Arg1:colpos())
   if ( !Local6:setstyle(1) )
      return 1
   endif
   if ( Arg2 == 13 )
   elseif ( Arg2 < 32 )
      return 1
   elseif ( Arg2 > 255 )
      return 1
   endif
   if ( EOF() )
      Local3 := .T.
   else
      Local3 := Arg1:setstyle(2)
   endif
   Arg1:forcestabl()
   if ( Local3 )
      append blank
   endif
   Local8 := iif( Empty(indexkey()), Nil, &( indexkey() ) )
   Local4 := Arg1:colwidth(Arg1:colpos())
   keyboard Chr(Arg2)
   Local2 := {getnew(Row(), Col(), Local6:block(), Local6:heading(), ;
      Local6:picture(), Arg1:colorspec())}
   Local2[ 1 ]:preblock(Local6:preblock())
   Local2[ 1 ]:postblock(Local6:postblock())
   Local1 := SetKey(K_INS, { || instoggle() })
   Local5 := setcursor(iif( readinsert(), 2, 1 ))
   ReadModal(Local2)
   setcursor(Local5)
   SetKey(K_INS, Local1)
   Arg1:setstyle(2, .F.)
   Local7 := iif( Empty(indexkey()), Nil, &( indexkey() ) )
   Arg1:invalidate()
   Arg1:refreshall():forcestabl()
   if ( !( Local7 == Local8 ) .OR. Local3 .AND. Local7 != Nil )
      Arg1:refreshall():forcestabl()
   endif
   Arg2 := LastKey()
   if ( Arg2 == 5 .OR. Arg2 == 24 .OR. Arg2 == 18 .OR. Arg2 == 3 )
      keyboard Chr(Arg2)
   endif
   return 0

//---------------------------------------------------[top]-
//  INSTOGGLE
//
static function INSTOGGLE

   if ( readinsert() )
      readinsert(.F.)
      setcursor(1)
   else
      readinsert(.T.)
      setcursor(2)
   endif
   return Nil

//---------------------------------------------------[top]-
//  TBFBLOCK( Arg1, Arg2 )
//
function TBFBLOCK( Arg1, Arg2 )

   local Local1 := Arg1[ 5 ]
   if ( ISBLOCK( Arg2 ) )
      Arg1[ 5 ] := Arg2
   endif
   return Local1

//---------------------------------------------------[top]-
//  TBGOBOT( Arg1 )
//
function TBGOBOT( Arg1 )

   local Local1 := Arg1[ 7 ], Local2, Local3, Local4
   if ( ISNIL( Local1 ) )
      Local2 := Arg1[ 6 ]
      if ( Local2 != Nil )
         eval(Local2, Arg1)
         Local4 := Arg1[ 3 ]
         Local3 := Arg1[ 5 ]
         if ( !( Local4 )->( EOF() ) )
            do while ( .T. )
               ( Local4 )->( dbSkip(1) )
               if ( ( Local4 )->( EOF() ) .OR. !eval(Local3, Arg1) )
                  ( Local4 )->( dbSkip(-1) )
                  exit
               endif
            enddo
         endif
      else
         ( Arg1[ 3 ] )->( dbGoBottom() )
      endif
   else
      eval(Local1, Arg1)
   endif
   return Arg1

//---------------------------------------------------[top]-
//  TBGOTOP( Arg1 )
//
function TBGOTOP( Arg1 )

   local Local1 := Arg1[ 6 ]
   if ( ISNIL( Local1 ) )
      ( Arg1[ 3 ] )->( dbGoTop() )
   else
      eval(Local1, Arg1)
   endif
   return Arg1

//---------------------------------------------------[top]-
//  TBMODAL( Arg1 )
//
function TBMODAL( Arg1 )

   local Local1, Local2 := setcursor(0), Local3:= Arg1:autolite()
   Arg1:autolite(.T.)
   do while ( .T. )
      do while ( ( Local1 := InKey() ) == 0 .AND. !Arg1:stabilize() )
      enddo
      if ( Local1 == 0 )
         if ( Arg1:hitbottom() .AND. Arg1:setstyle(1) .AND. ;
               !Arg1:setstyle(2) )
            Arg1:setstyle(2, .T.)
            Local1 := 24
         else
            Local1 := InKey(0)
         endif
      endif
      if ( Local1 == 30 .OR. Local1 == 31 )
         Arg1:setstyle(2, .F.)
      elseif ( Local1 == 5 .OR. Local1 == 18 )
         if ( Arg1:setstyle(2) )
            Arg1:setstyle(2, .F.)
            Arg1:refreshall()
         endif
      elseif ( Local1 == 1002 .AND. Arg1:mrowpos() != Arg1:rowpos() ;
            .AND. Arg1:hittest(mrow(), mcol()) == -5121 .AND. ;
            Arg1:setstyle(2) )
         Arg1:setstyle(2, .F.)
         Arg1:refreshall()
      endif
      if ( Arg1:applykey(Local1) == -1 )
         exit
      endif
   enddo
   Arg1:autolite(Local3)
   Arg1:dehilite()
   setcursor(Local2)
   return Local1

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

   local Local1
   if ( Arg1:hittest(Arg2, Arg3) == -5121 )
      Local1 := Arg1:mrowpos() - Arg1:rowpos()
      do while ( Local1 < 0 )
         Local1++
         Arg1:up()
      enddo
      do while ( Local1 > 0 )
         Local1--
         Arg1:down()
      enddo
      Local1 := Arg1:mcolpos() - Arg1:colpos()
      do while ( Local1 < 0 )
         Local1++
         Arg1:left()
      enddo
      do while ( Local1 > 0 )
         Local1--
         Arg1:right()
      enddo
      return 0
   endif
   return 1

//---------------------------------------------------[top]-
//  TBSBLOCK( Arg1, Arg2 )
//
function TBSBLOCK( Arg1, Arg2 )

   local Local1 := Arg1[ 6 ]
   if ( ISBLOCK( Arg2 ) )
      Arg1[ 6 ] := Arg2
   endif
   return Local1

//---------------------------------------------------[top]-
//  TBSKIP( Arg1, Arg2 )
//
function TBSKIP( Arg1, Arg2 )

   local Local1, Local2, Local3, Local4, Local5, Local6 := Arg1[ 5 ], ;
      Local7
   Local7 := Arg1[ 1 ]:setstyle(2)
   if ( ISARRAY( Arg1[ 3 ] ) )
      Local1 := Arg1[ 4 ] + Arg2
      if ( Local1 < 1 )
         Arg2 := Arg2 + ( Abs(Local1) + 1 )
         Local1 := 1
      elseif ( Local1 > ( Local2 := Len(Arg1[ 3 ]) ) )
         Arg2 := Arg2 - ( Local2 - Local1 )
         Local1 := Local2
      endif
      Arg1[ 4 ] := Local1
   else
      Local3 := 0
      Local5 := Arg1[ 3 ]
      if ( LastRec() != 0 )
         if ( Arg2 == 0 )
            ( Local5 )->( dbSkip(0) )
         elseif ( Arg2 > 0 .AND. !( Local5 )->( EOF() ) )
            do while ( Local3 < Arg2 )
               ( Local5 )->( dbSkip(1) )
               if ( ( Local5 )->( EOF() ) .OR. !eval(Local6, Arg1) )
                  if ( Local7 )
                     if ( !( Local5 )->( EOF() ) )
                        ( Local5 )->( dbGoBottom() )
                        ( Local5 )->( dbSkip(1) )
                     endif
                     Local3++
                  else
                     ( Local5 )->( dbSkip(-1) )
                  endif
                  exit
               endif
               Local3++
            enddo
         elseif ( Arg2 < 0 )
            if ( ( Local5 )->( EOF() ) )
               eval(Arg1[ 1 ]:gobottombl())
               Local3--
            endif
            do while ( Local3 > Arg2 )
               ( Local5 )->( dbSkip(-1) )
               if ( ( Local5 )->( BOF() ) )
                  exit
               elseif ( !eval(Local6, Arg1) )
                  ( Local5 )->( dbSkip(1) )
                  exit
               endif
               Local3--
            enddo
         endif
      endif
      Arg1[ 4 ] := ( Local5 )->( RecNo() )
   endif
   return Local3

//---EOF


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