Module: _listbox      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

//---------------------------------------------------[top]-
//  LBDEFINE
//
static function LBDEFINE

   local Local1 := __classnew("LISTBOX", 28)
   __classadd(Local1, "AddItem", "__lbAddItem")
   __classadd(Local1, "Close", "__lbClose")
   __classadd(Local1, "DelItem", "__lbDelItem")
   __classadd(Local1, "Display", "__lbDisplay")
   __classadd(Local1, "FindText", "__lbFindText")
   __classadd(Local1, "FindData", "__lbFindData")
   __classadd(Local1, "GetData", "__lbGetData")
   __classadd(Local1, "GetItem", "__lbGetItem")
   __classadd(Local1, "GetText", "__lbGetText")
   __classadd(Local1, "HitTest", "__lbHitTest")
   __classadd(Local1, "InsItem", "__lbInsItem")
   __classadd(Local1, "KillFocus", "__lbKillFocus")
   __classadd(Local1, "NextItem", "__lbNextItem")
   __classadd(Local1, "Open", "__lbOpen")
   __classadd(Local1, "PrevItem", "__lbPrevItem")
   __classadd(Local1, "Scroll", "__lbScroll")
   __classadd(Local1, "Select", "__lbSelect")
   __classadd(Local1, "SetData", "__lbSetData")
   __classadd(Local1, "SetFocus", "__lbSetFocus")
   __classadd(Local1, "SetItem", "__lbSetItem")
   __classadd(Local1, "SetText", "__lbSetText")
   __classadd(Local1, "Bitmap", "__lbBitmap")
   __classadd(Local1, "_Bitmap", "__lbBitmap")
   __classadd(Local1, "Bottom", "__lbBottom")
   __classadd(Local1, "_Bottom", "__lbBottom")
   __classadd(Local1, "Buffer", "__lbBuffer")
   __classadd(Local1, "_Buffer", "__lbBuffer")
   __classadd(Local1, "CapCol", "__lbCapCol")
   __classadd(Local1, "_CapCol", "__lbCapCol")
   __classadd(Local1, "CapRow", "__lbCapRow")
   __classadd(Local1, "_CapRow", "__lbCapRow")
   __classadd(Local1, "Caption", "__lbCaption")
   __classadd(Local1, "_Caption", "__lbCaption")
   __classadd(Local1, "Cargo", "__lbCargo")
   __classadd(Local1, "_Cargo", "__lbCargo")
   __classadd(Local1, "ColdBox", "__lbColdBox")
   __classadd(Local1, "_ColdBox", "__lbColdBox")
   __classadd(Local1, "ColorSpec", "__lbColorSpec")
   __classadd(Local1, "_ColorSpec", "__lbColorSpec")
   __classadd(Local1, "DropDown", "__lbDropDown")
   __classadd(Local1, "_DropDown", "__lbDropDown")
   __classadd(Local1, "fBlock", "__lbfBlock")
   __classadd(Local1, "_fBlock", "__lbfBlock")
   __classadd(Local1, "HasFocus", "__lbHasFocus")
   __classadd(Local1, "_HasFocus", "__lbHasFocus")
   __classadd(Local1, "HotBox", "__lbHotBox")
   __classadd(Local1, "_HotBox", "__lbHotBox")
   __classadd(Local1, "IsOpen", "__lbIsOpen")
   __classadd(Local1, "_IsOpen", "__lbIsOpen")
   __classadd(Local1, "ItemCount", "__lbItemCount")
   __classadd(Local1, "_ItemCount", "__lbItemCount")
   __classadd(Local1, "Left", "__lbLeft")
   __classadd(Local1, "_Left", "__lbLeft")
   __classadd(Local1, "Message", "__lbMessage")
   __classadd(Local1, "_Message", "__lbMessage")
   __classadd(Local1, "Right", "__lbRight")
   __classadd(Local1, "_Right", "__lbRight")
   __classadd(Local1, "sBlock", "__lbsBlock")
   __classadd(Local1, "_sBlock", "__lbsBlock")
   __classadd(Local1, "Style", "__lbStyle")
   __classadd(Local1, "_Style", "__lbStyle")
   __classadd(Local1, "TextValue", "__lbTextValue")
   __classadd(Local1, "_TextValue", "__lbTextValue")
   __classadd(Local1, "Top", "__lbTop")
   __classadd(Local1, "_Top", "__lbTop")
   __classadd(Local1, "TopItem", "__lbTopItem")
   __classadd(Local1, "_TopItem", "__lbTopItem")
   __classadd(Local1, "TypeOut", "__lbTypeOut")
   __classadd(Local1, "_TypeOut", "__lbTypeOut")
   __classadd(Local1, "VScroll", "__lbVScroll")
   __classadd(Local1, "_VScroll", "__lbVScroll")
   __classadd(Local1, "Value", "__lbValue")
   __classadd(Local1, "_Value", "__lbValue")
   return Local1

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

   local Local1, Local2, Local3, Local4, Local5
   do case
   case !( ISNUMBER( Arg1 ) )
      Local1 := Nil
   case !( ISNUMBER( Arg2 ) )
      Local1 := Nil
   case !( ISNUMBER( Arg3 ) )
      Local1 := Nil
   case !( ISNUMBER( Arg4 ) )
      Local1 := Nil
   otherwise
      if ( ValType(Static1) != "N" )
         Static1 := lbdefine()
      endif
      if ( !( ISLOGICAL( Arg5 ) ) )
         Arg5 := .F.
      endif
      Local1 := __classins(Static1)
      Local1[ 1 ] := Arg3
      Local1[ 2 ] := Nil
      Local1[ 3 ] := ""
      Local1[ 4 ] := Arg2
      Local1[ 5 ] := Arg1
      Local1[ 6 ] := Nil
      Local1[ 7 ] := "Ŀ"
      if ( isdefcolor() )
         Local1[ 8 ] := "W/N,W+/N,W+/N,N/W,W/N,W/N,W+/N,W/N"
      else
         Local4 := SetColor()
         Local1[ 8 ] := __guicolor(Local4, 5) + "," + ;
            __guicolor(Local4, 5) + "," + __guicolor(Local4, 5) + ;
            "," + __guicolor(Local4, 2) + "," + __guicolor(Local4, ;
            3) + "," + __guicolor(Local4, 1) + "," + ;
            __guicolor(Local4, 4)
      endif
      Local1[ 9 ] := {}
      Local1[ 10 ] := Arg5
      Local1[ 11 ] := Nil
      Local1[ 12 ] := .F.
      Local1[ 13 ] := "ͻȺ"
      Local1[ 14 ] := 0
      Local1[ 15 ] := Arg2
      Local1[ 16 ] := ""
      if ( !_isgraphic() )
         Local1[ 17 ] := Str(Arg1 + 1, 2) + Str(Arg2, 2) + Str(Arg3, ;
            2) + Str(Arg4, 2) + SaveScreen(Arg1 + 1, Arg2, Arg3, Arg4)
      else
         Local1[ 17 ] := SaveScreen(Arg1 + 1, Arg2, Arg3, Arg4)
         AAdd(Local1[ 17 ], Arg1 + 1)
         AAdd(Local1[ 17 ], Arg2)
         AAdd(Local1[ 17 ], Arg3)
         AAdd(Local1[ 17 ], Arg4)
      endif
      Local1[ 18 ] := !Arg5
      Local1[ 19 ] := Arg4
      Local1[ 20 ] := Nil
      Local1[ 21 ] := Nil
      Local1[ 22 ] := ""
      Local1[ 23 ] := ""
      Local1[ 24 ] := Arg1
      Local1[ 25 ] := 0
      Local1[ 26 ] := Nil
      Local1[ 27 ] := 0
      Local1[ 28 ] := "dropbox.bmu"
   endcase
   return Local1

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

   if ( !( ISCHARACTER( Arg1 ) ) )
   elseif ( ValType(Arg2) $ "CU" )
      AAdd(qself()[ 9 ], {Arg1, Arg2})
      qself()[ 14 ]++
      if ( qself()[ 14 ] == 1 .AND. ISOBJECT( ( qself()[ 25 ] := 1, ;
            qself()[ 26 ] ) ) )
         qself()[ 26 ]:total(qself()[ 14 ] - ( qself()[ 1 ] - ;
            qself()[ 24 ] - 2 ))
      endif
   endif
   return qself()

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

   if ( !qself()[ 10 ] )
   elseif ( !( ISNIL( Arg1 ) ) )
      qself()[ 28 ] := _einstvar(qself(), "BITMAP", Arg1, "C", 1001)
   endif
   return qself()[ 28 ]

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

   if ( !( ISNIL( Arg1 ) ) .AND. ISOBJECT( ( qself()[ 1 ] := ;
         _einstvar(qself(), "BOTTOM", Arg1, "N", 1001), ;
         qself()[ 26 ] ) ) )
      qself()[ 26 ]:end(Arg1 - 1)
   endif
   return qself()[ 1 ]

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

   return qself()[ 2 ]

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

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 4 ] := _einstvar(qself(), "CAPCOL", Arg1, "N", 1001)
   endif
   return qself()[ 4 ]

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

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 5 ] := _einstvar(qself(), "CAPROW", Arg1, "N", 1001)
   endif
   return qself()[ 5 ]

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

   if ( ( qself()[ 3 ] := _einstvar(qself(), "CAPTION", Arg1, "C", ;
         1001), !( ISNIL( Arg1 ) ) .AND. ISNIL( qself()[ 4 ] ) ) )
      qself()[ 5 ] := qself()[ 24 ]
      qself()[ 4 ] := qself()[ 15 ] - Len(Arg1)
   endif
   return qself()[ 3 ]

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

   if ( PCount() != 0 )
      qself()[ 6 ] := Arg1
   endif
   return qself()[ 6 ]

//---------------------------------------------------[top]-
//  __LBCLOSE
//
function __LBCLOSE

   local Local1, Local2, Local3, Local4, Local5
   if ( qself()[ 18 ] )
      if ( !_isgraphic() )
         RestScreen(Val(SubStr(qself()[ 17 ], 1, 2)), ;
            Val(SubStr(qself()[ 17 ], 3, 2)), ;
            Val(SubStr(qself()[ 17 ], 5, 2)), ;
            Val(SubStr(qself()[ 17 ], 7, 2)), SubStr(qself()[ 17 ], ;
            9))
      else
         Local1 := Len(qself()[ 17 ])
         Local2 := qself()[ 17 ][ Local1 - 3 ]
         Local3 := qself()[ 17 ][ Local1 - 2 ]
         Local4 := qself()[ 17 ][ Local1 - 1 ]
         Local5 := qself()[ 17 ][ Local1 ]
         adel(qself()[ 17 ], Local1)
         adel(qself()[ 17 ], Local1 - 1)
         adel(qself()[ 17 ], Local1 - 2)
         adel(qself()[ 17 ], Local1 - 3)
         RestScreen(Local2, Local3, Local4, Local5, qself()[ 17 ])
      endif
      qself()[ 18 ] := .F.
      qself()[ 17 ] := Nil
   endif
   return qself()

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

   local Local1
   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 7 ] := _einstvar(qself(), "COLDBOX", Arg1, "C", 1001, ;
         { |_1, _2| Len(_2) == 0 .OR. Len(_2) == 8 })
   endif
   return qself()[ 7 ]

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

   local Local1
   if ( !( ISNIL( Arg1 ) ) )
      if ( qself()[ 10 ] )
         Local1 := 8
      else
         Local1 := 7
      endif
      qself()[ 8 ] := _einstvar(qself(), "COLORSPEC", Arg1, "C", ;
         1001, { |_1, _2| !Empty(__guicolor(_2, Local1)) .AND. ;
         Empty(__guicolor(_2, Local1 + 1)) })
   endif
   return qself()[ 8 ]

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

   if ( Arg1 < 1 )
   elseif ( Arg1 <= qself()[ 14 ] )
      adel(qself()[ 9 ][ Arg1 ])
      asize(qself()[ 9 ], --qself()[ 14 ])
      if ( qself()[ 27 ] > qself()[ 14 ] )
         qself()[ 27 ] := qself()[ 14 ]
         if ( qself()[ 27 ] == 0 )
            qself()[ 23 ] := ""
         else
            qself()[ 23 ] := getdata(qself()[ 9 ][ qself()[ 14 ] ])
         endif
         if ( ISNIL( qself()[ 2 ] ) )
         elseif ( ISNUMBER( qself()[ 2 ] ) )
            qself()[ 2 ] := qself()[ 14 ]
         elseif ( qself()[ 27 ] > 0 )
            qself()[ 2 ] := qself()[ 23 ]
         endif
      endif
      if ( qself()[ 25 ] > qself()[ 14 ] )
         qself()[ 25 ] := qself()[ 14 ]
      endif
      if ( ISOBJECT( qself()[ 26 ] ) )
         qself()[ 26 ]:total(qself()[ 14 ] - ( qself()[ 1 ] - ;
            qself()[ 24 ] - 2 ))
      endif
   endif
   return qself()

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

   local Local1, Local2
   if ( Arg2 != Arg3 )
      Arg1[ 27 ] := Arg3
      if ( Arg1[ 27 ] == 0 )
         Arg1[ 23 ] := ""
      else
         Arg1[ 23 ] := getdata(Arg1[ 9 ][ Arg1[ 27 ] ])
      endif
      if ( ISNIL( Arg1[ 2 ] ) )
      elseif ( ISNUMBER( Arg1[ 2 ] ) )
         Arg1[ 2 ] := Arg1[ 27 ]
      elseif ( Arg1[ 27 ] > 0 )
         Arg1[ 2 ] := Arg1[ 23 ]
      endif
      if ( Empty(Arg1[ 13 ] + Arg1[ 7 ]) )
         Local2 := 0
      else
         Local2 := 2
      endif
      if ( Arg1[ 10 ] )
         Local2++
      endif
      Local1 := Arg1[ 27 ] - ( Arg1[ 1 ] - Arg1[ 24 ] - Local2 )
      if ( Arg1[ 25 ] > Arg1[ 27 ] )
         Arg1[ 25 ] := Arg1[ 27 ]
         if ( ISOBJECT( Arg1[ 26 ] ) )
            Arg1[ 26 ]:current(lbadjustcu(Arg1))
         endif
      elseif ( Arg1[ 25 ] <= Local1 .AND. ISOBJECT( ( Arg1[ 25 ] := ;
            Local1, Arg1[ 26 ] ) ) )
         Arg1[ 26 ]:current(lbadjustcu(Arg1))
      endif
      Arg1:display()
      if ( ISBLOCK( Arg1[ 20 ] ) )
         eval(Arg1[ 20 ])
      endif
   endif
   return Arg1

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

   if ( ISNIL( Arg1[ 2 ] ) )
      return Arg1[ 1 ]
   endif
   return Arg1[ 2 ]

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

   local Local1, Local2, Local3, Local4, Local5
   Local1 := Arg1[ 1 ] - Arg1[ 24 ] - iif( Arg1[ 10 ], 2, 1 )
   Local2 := Arg1[ 14 ]
   Local3 := Arg1[ 26 ]:barlength()
   Local4 := Arg1[ 25 ]
   Local5 := ( ( Local2 - Local3 ) * Local4 + Local3 - Local1 ) / ( ;
      Local2 - Local1 )
   return Local5

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

   local Local1, Local2, Local3, Local4, Local5
   if ( ISLOGICAL( Arg4 ) )
      Local2 := Set(_SET_EXACT, Arg4)
   endif
   Local4 := 1
   if ( ISNUMBER( Arg2 ) )
      Local4++
   else
      Arg2 := 1
   endif
   Local5 := Len(qself()[ 9 ]) - Arg2 + 1
   if ( !( ISLOGICAL( Arg3 ) ) )
      Arg3 := .T.
   endif
   for Local3 := 1 to Local4
      if ( Arg3 )
         if ( Set(_SET_EXACT) )
            Local1 := ascan(qself()[ 9 ], { |_1| getdata(_1) == Arg1 ;
               }, Arg2, Local5)
         else
            Local1 := ascan(qself()[ 9 ], { |_1| getdata(_1) = Arg1 ;
               }, Arg2, Local5)
         endif
      elseif ( Set(_SET_EXACT) )
         Local1 := ascan(qself()[ 9 ], { |_1| Lower(getdata(_1)) == ;
            Lower(Arg1) }, Arg2, Local5)
      else
         Local1 := ascan(qself()[ 9 ], { |_1| Lower(getdata(_1)) = ;
            Lower(Arg1) }, Arg2, Local5)
      endif
      if ( Local1 > 0 )
         exit
      endif
      Local5 := Arg2 - 1
      Arg2 := 1
   next
   if ( !( ISNIL( Local2 ) ) )
      set exact (Local2)
   endif
   return Local1

//---------------------------------------------------[top]-
//  __LBNEXTIT
//
function __LBNEXTIT

   local Local1, Local2
   if ( !qself()[ 12 ] )
   elseif ( qself()[ 14 ] > 0 )
      if ( ( Local1 := qself()[ 27 ] ) == qself()[ 14 ] )
         Local2 := Local1
      else
         Local2 := Local1 + 1
      endif
      changeitem(qself(), Local1, Local2)
   endif
   return qself()

//---------------------------------------------------[top]-
//  __LBPREVIT
//
function __LBPREVIT

   local Local1, Local2
   if ( !qself()[ 12 ] )
   elseif ( qself()[ 14 ] > 0 )
      if ( ( Local1 := qself()[ 27 ] ) == 0 )
         Local2 := 1
      elseif ( Local1 == 1 )
         Local2 := Local1
      else
         Local2 := Local1 - 1
      endif
      changeitem(qself(), Local1, Local2)
   endif
   return qself()

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

   local Local1, Local2, Local3, Local4, Local5, Local6, Local7, ;
      Local8, Local9, Local10, Local11, Local12
   do case
   case Arg1 == -3074
      if ( qself()[ 25 ] > 1 )
         qself()[ 25 ]--
         qself()[ 26 ]:current(lbadjustcu(qself()))
         qself():display()
      endif
   case Arg1 == -3075
      if ( qself()[ 25 ] + qself()[ 1 ] - qself()[ 24 ] <= ;
            qself()[ 14 ] + iif( qself()[ 10 ], 2, 1 ) )
         qself()[ 25 ]++
         qself()[ 26 ]:current(lbadjustcu(qself()))
         qself():display()
      endif
   case Arg1 == -3077
      Local1 := qself()[ 1 ] - qself()[ 24 ] - iif( qself()[ 10 ], 2, ;
         1 )
      Local3 := qself()[ 14 ]
      Local2 := qself()[ 25 ] + Local1
      if ( qself()[ 25 ] < Local3 - Local1 + 1 )
         if ( Local2 + Local1 - 1 > Local3 )
            Local2 := Local3 - Local1 + 1
         endif
         qself()[ 25 ] := Local2
         qself()[ 26 ]:current(lbadjustcu(qself()))
         qself():display()
      endif
   case Arg1 == -3076
      Local1 := qself()[ 1 ] - qself()[ 24 ] - iif( qself()[ 10 ], 2, ;
         1 )
      Local3 := qself()[ 14 ]
      Local2 := qself()[ 25 ] - Local1
      if ( qself()[ 25 ] > 1 )
         if ( Local2 < 1 )
            Local2 := 1
         endif
         qself()[ 25 ] := Local2
         qself()[ 26 ]:current(lbadjustcu(qself()))
         qself():display()
      endif
   case Arg1 == -3073
      Local10 := mrow()
      do while ( ( Local11 := InKey(0) ) != 1003 )
         if ( Local11 == 1001 )
            Local9 := mrow()
            if ( Local9 <= qself()[ 26 ]:start() )
               Local9 := qself()[ 26 ]:start() + 1
            endif
            if ( Local9 >= qself()[ 26 ]:end() )
               Local9 := qself()[ 26 ]:end() - 1
            endif
            if ( Local9 != Local10 )
               Local4 := qself()[ 26 ]:thumbpos() + ( Local9 - ;
                  Local10 )
               Local6 := qself()[ 26 ]:barlength()
               Local7 := qself()[ 26 ]:total()
               Local8 := ( Local4 * ( Local7 - Local6 - 2 ) + 2 * ;
                  Local6 + 1 - Local7 ) / ( Local6 - 1 )
               if ( Local8 < 1 )
                  Local8 := 1
               endif
               if ( Local8 > Local7 )
                  Local8 := Local7
               endif
               Local5 := qself()[ 26 ]:current()
               if ( Local8 - Local5 > 0 )
                  for Local12 := 1 to Local8 - Local5
                     qself():scroll(-3075)
                  next
               else
                  for Local12 := 1 to Local5 - Local8
                     qself():scroll(-3074)
                  next
               endif
               Local10 := Local9
            endif
         endif
      enddo
   endcase
   return qself()

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

   local Local1, Local2, Local3, Local4
   do case
   case ( Local3 := ValType(Arg1) ) == "C"
      Local4 := qself():finddata(Arg1)
      if ( !( ValType(qself()[ 2 ]) $ "CU" ) )
         qself()[ 2 ] := Local4
      elseif ( qself()[ 27 ] == 0 )
         qself()[ 2 ] := Arg1
      else
         qself()[ 2 ] := getdata(qself()[ 9 ][ Local4 ])
      endif
   case !( Local3 == "N" )
      return qself()[ 27 ]
   case Arg1 < 1
      return qself()[ 27 ]
   case Arg1 > qself()[ 14 ]
      return qself()[ 27 ]
   case Arg1 == qself()[ 27 ]
      return qself()[ 27 ]
   otherwise
      Local4 := Arg1
      if ( ValType(qself()[ 2 ]) $ "NU" )
         qself()[ 2 ] := Local4
      elseif ( Local4 == 0 )
         qself()[ 2 ] := ""
      else
         qself()[ 2 ] := getdata(qself()[ 9 ][ Local4 ])
      endif
   endcase
   qself()[ 27 ] := Local4
   if ( Local4 == 0 )
      qself()[ 23 ] := ""
   else
      qself()[ 23 ] := getdata(qself()[ 9 ][ Local4 ])
   endif
   if ( Empty(qself()[ 13 ] + qself()[ 7 ]) )
      Local2 := 0
   else
      Local2 := 2
   endif
   if ( qself()[ 10 ] )
      Local2++
   endif
   Local1 := qself()[ 27 ] - ( qself()[ 1 ] - qself()[ 24 ] - Local2 )
   if ( qself()[ 25 ] <= Local1 )
      qself()[ 25 ] := Local1
      if ( ISOBJECT( qself()[ 26 ] ) )
         qself()[ 26 ]:current(lbadjustcu(qself()))
      endif
   elseif ( qself()[ 27 ] == 0 )
   elseif ( qself()[ 25 ] > qself()[ 27 ] .AND. ISOBJECT( ( ;
         qself()[ 25 ] := qself()[ 27 ], qself()[ 26 ] ) ) )
      qself()[ 26 ]:current(lbadjustcu(qself()))
   endif
   qself():display()
   if ( ISBLOCK( qself()[ 20 ] ) )
      eval(qself()[ 20 ])
   endif
   return qself()[ 27 ]

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

   local Local1, Local2
   if ( !( ISNIL( Arg1 ) ) )
      _einstvar(qself(), "TOPITEM", Arg1, "N", 1001, { |_1, _2| Arg1 ;
         > 0 .AND. Arg1 <= qself()[ 14 ] })
      if ( Empty(qself()[ 13 ] + qself()[ 7 ]) )
         Local2 := 0
      else
         Local2 := 2
      endif
      Local1 := qself()[ 14 ] - ( qself()[ 1 ] - qself()[ 24 ] - ;
         Local2 )
      if ( Arg1 > Local1 )
         Arg1 := Local1
      endif
      if ( qself()[ 25 ] != Arg1 )
         qself()[ 25 ] := Arg1
         if ( ISOBJECT( qself()[ 26 ] ) )
            qself()[ 26 ]:current(lbadjustcu(qself()))
         endif
         qself():display()
      endif
   endif
   return qself()[ 25 ]

//---------------------------------------------------[top]-
//  __LBDISPLA
//
function __LBDISPLA

   local Local1 := Row(), Local2:= Col(), Local3:= SetColor(), ;
      Local4, Local5, Local6, Local7, Local8 := qself()[ 24 ], ;
      Local9 := qself()[ 15 ], Local10, Local11, Local12, Local13, ;
      Local14, Local15, Local16, Local17, Local18, Local19
   Local10 := qself()[ 19 ] - Local9 + 1
   if ( qself()[ 12 ] )
      Local11 := qself()[ 13 ]
      Local7 := __guicolor(qself()[ 8 ], 3)
      Local6 := __guicolor(qself()[ 8 ], 4)
      if ( qself()[ 18 ] )
         Local14 := __guicolor(qself()[ 8 ], 2)
      else
         Local14 := __guicolor(qself()[ 8 ], 4)
      endif
   else
      Local11 := qself()[ 7 ]
      Local7 := __guicolor(qself()[ 8 ], 1)
      Local6 := __guicolor(qself()[ 8 ], 2)
      Local14 := __guicolor(qself()[ 8 ], 2)
   endif
   Local18 := msetcursor(.F.)
   dispbegin()
   Local5 := qself()[ 25 ] + qself()[ 1 ] - qself()[ 24 ]
   if ( qself()[ 10 ] )
      set color to (Local14)
      SetPos(Local8++, Local9)
      if ( qself()[ 27 ] == 0 )
         ?? Space(Local10 - 1)
      else
         ?? padr(qself()[ 9 ][ qself()[ 27 ] ][ 1 ], Local10 - 1)
      endif
      set color to (__guicolor(qself()[ 8 ], 8))
      if ( !_isgraphic() )
         ?? Left(qself()[ 22 ], 1)
      else
         Local17 := _getnumcol(__guicolor(qself()[ 8 ], 5))
         Local16 := _getnumcol(Local6)
         Local19 := gmode()[ 5 ]
         gframe(Local9 * 8 - 2, ( Local8 - 1 ) * Local19 - 1, ( ;
            Local9 + Local10 - 1 ) * 8, Local8 * Local19, Local16, ;
            Local17, Local17, 1, 1, 1, 1, -1, .F.)
         Local15 := gbmpload(qself()[ 28 ])
         if ( ISNIL( Local15 ) )
         elseif ( !( ISNIL( Local15[ 1 ] ) ) .AND. !( ISNIL( ;
               Local15[ 2 ] ) ) )
            gbmpdisp(Local15, ( Local9 + Local10 - 1 ) * 8 + 3, ( ;
               Local8 - 1 ) * Local19)
         endif
      endif
      Local5--
   endif
   if ( qself()[ 18 ] )
      if ( !Empty(Local11) )
         set color to (__guicolor(qself()[ 8 ], 5))
         @ Local8, Local9 clear to qself()[ 1 ], qself()[ 19 ]
         @ Local8, Local9, qself()[ 1 ], qself()[ 19 ] box Local11
         if ( ISOBJECT( qself()[ 26 ] ) )
            qself()[ 26 ]:display()
         endif
         Local8++
         Local9++
         Local10 := Local10 - 2
         Local5 := Local5 - 2
      endif
      if ( Local5 > qself()[ 14 ] )
         Local5 := qself()[ 14 ]
      endif
      for Local4 := qself()[ 25 ] to Local5
         if ( Local4 == qself()[ 27 ] )
            set color to (Local6)
         else
            set color to (Local7)
         endif
         SetPos(Local8++, Local9)
         ?? padr(qself()[ 9 ][ Local4 ][ 1 ], Local10)
      next
   endif
   if ( !Empty(Local12 := qself()[ 3 ]) )
      if ( ( Local13 := At("&", Local12) ) == 0 )
      elseif ( Local13 == Len(Local12) )
         Local13 := 0
      else
         Local12 := stuff(Local12, Local13, 1, "")
      endif
      set color to (__guicolor(qself()[ 8 ], 6))
      SetPos(qself()[ 5 ], qself()[ 4 ] - 1)
      ?? Local12
      if ( Local13 != 0 )
         set color to (__guicolor(qself()[ 8 ], 7))
         SetPos(qself()[ 5 ], qself()[ 4 ] + Local13 - 2)
         ?? SubStr(Local12, Local13, 1)
      endif
   endif
   dispend()
   msetcursor(Local18)
   set color to (Local3)
   SetPos(Local1, Local2)
   return qself()

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

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 10 ] := _einstvar(qself(), "DROPDOWN", Arg1, "L", ;
         1001, Nil)
      if ( Arg1 )
      elseif ( !qself()[ 18 ] )
         qself()[ 18 ] := .T.
      endif
      qself():display()
   endif
   return qself()[ 10 ]

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

   if ( PCount() == 0 )
   elseif ( ISNIL( Arg1 ) )
      qself()[ 11 ] := Arg1
   else
      qself()[ 11 ] := _einstvar(qself(), "FBLOCK", Arg1, "B", 1001)
   endif
   return qself()[ 11 ]

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

   local Local1, Local2, Local3, Local4, Local5
   if ( ISLOGICAL( Arg4 ) )
      Local2 := Set(_SET_EXACT, Arg4)
   endif
   Local4 := 1
   if ( ISNUMBER( Arg2 ) )
      Local4++
   else
      Arg2 := 1
   endif
   Local5 := Len(qself()[ 9 ]) - Arg2 + 1
   if ( !( ISLOGICAL( Arg3 ) ) )
      Arg3 := .T.
   endif
   for Local3 := 1 to Local4
      if ( Arg3 )
         if ( Set(_SET_EXACT) )
            Local1 := ascan(qself()[ 9 ], { |_1| _1[ 1 ] == Arg1 }, ;
               Arg2, Local5)
         else
            Local1 := ascan(qself()[ 9 ], { |_1| _1[ 1 ] = Arg1 }, ;
               Arg2, Local5)
         endif
      elseif ( Set(_SET_EXACT) )
         Local1 := ascan(qself()[ 9 ], { |_1| Lower(_1[ 1 ]) == ;
            Lower(Arg1) }, Arg2, Local5)
      else
         Local1 := ascan(qself()[ 9 ], { |_1| Lower(_1[ 1 ]) = ;
            Lower(Arg1) }, Arg2, Local5)
      endif
      if ( Local1 > 0 )
         exit
      endif
      Local5 := Arg2 - 1
      Arg2 := 1
   next
   if ( !( ISNIL( Local2 ) ) )
      set exact (Local2)
   endif
   return Local1

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

   local Local1 := Nil
   if ( Arg1 < 1 )
   elseif ( Arg1 <= qself()[ 14 ] )
      Local1 := qself()[ 9 ][ Arg1 ][ 2 ]
   endif
   return Local1

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

   local Local1 := Nil
   if ( Arg1 < 1 )
   elseif ( Arg1 <= qself()[ 14 ] )
      Local1 := qself()[ 9 ][ Arg1 ]
   endif
   return Local1

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

   local Local1 := Nil
   if ( Arg1 < 1 )
   elseif ( Arg1 <= qself()[ 14 ] )
      Local1 := qself()[ 9 ][ Arg1 ][ 1 ]
   endif
   return Local1

//---------------------------------------------------[top]-
//  __LBHASFOC
//
function __LBHASFOC

   return qself()[ 12 ]

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

   local Local1, Local2 := 0, Local3, Local4
   if ( !qself()[ 18 ] )
   elseif ( !( ISOBJECT( qself()[ 26 ] ) ) )
   elseif ( ( Local2 := qself()[ 26 ]:hittest(Arg1, Arg2) ) != 0 )
      return Local2
   endif
   if ( !qself()[ 18 ] .OR. Empty(qself()[ 13 ] + qself()[ 7 ]) )
      Local1 := 0
   else
      Local4 := qself()[ 24 ]
      if ( qself()[ 10 ] )
         Local4++
      endif
      do case
      case Arg1 == Local4
         if ( Arg2 == qself()[ 15 ] )
            return -1
         elseif ( Arg2 == qself()[ 19 ] )
            return -3
         elseif ( Arg2 >= qself()[ 15 ] .AND. Arg2 <= qself()[ 19 ] )
            return -2
         endif
      case Arg1 == qself()[ 1 ]
         if ( Arg2 == qself()[ 15 ] )
            return -7
         elseif ( Arg2 == qself()[ 19 ] )
            return -5
         elseif ( Arg2 >= qself()[ 15 ] .AND. Arg2 <= qself()[ 19 ] )
            return -6
         endif
      case Arg2 == qself()[ 15 ]
         if ( Arg1 >= qself()[ 24 ] .AND. Arg1 <= qself()[ 1 ] )
            return -8
         else
            return 0
         endif
      case Arg2 == qself()[ 19 ]
         if ( Arg1 >= qself()[ 24 ] .AND. Arg1 <= qself()[ 1 ] )
            return -4
         else
            return 0
         endif
      endcase
      Local1 := 1
   endif
   do case
   case !qself()[ 18 ]
   case Arg1 < Local4 + Local1
   case Arg1 > qself()[ 1 ] - Local1
   case Arg2 < qself()[ 15 ] + Local1
   case Arg2 <= qself()[ 19 ] - Local1
      return qself()[ 25 ] + Arg1 - ( Local4 + Local1 )
   endcase
   do case
   case _isgraphic()
      do case
      case !qself()[ 10 ]
      case Arg1 != qself()[ 24 ]
      case Arg2 < qself()[ 15 ]
      case Arg2 < qself()[ 19 ]
         return -2049
      case Arg2 == qself()[ 19 ] + 1
         return -4097
      endcase
   case !qself()[ 10 ]
   case Arg1 != qself()[ 24 ]
   case Arg2 < qself()[ 15 ]
   case Arg2 < qself()[ 19 ]
      return -2049
   case Arg2 == qself()[ 19 ]
      return -4097
   endcase
   do case
   case Empty(qself()[ 3 ])
   case Arg1 != qself()[ 5 ]
   case Arg2 < qself()[ 4 ]
   case Arg2 < qself()[ 4 ] + __caplengt(qself()[ 3 ])
      return -1025
   endcase
   return 0

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

   local Local1
   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 13 ] := _einstvar(qself(), "HOTBOX", Arg1, "C", 1001, ;
         { |_1, _2| Len(_2) == 0 .OR. Len(_2) == 8 })
   endif
   return qself()[ 13 ]

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

   if ( !( ISCHARACTER( Arg2 ) ) )
   elseif ( !( ISNUMBER( Arg1 ) ) )
   elseif ( Arg1 < qself()[ 14 ] )
      asize(qself()[ 9 ], ++qself()[ 14 ])
      ains(qself()[ 9 ], Arg1)
      qself()[ 9 ][ Arg1 ] := {Arg2, Arg3}
      if ( qself()[ 14 ] == 1 )
         qself()[ 25 ] := 1
      endif
      if ( ISOBJECT( qself()[ 26 ] ) )
         qself()[ 26 ]:total(qself()[ 14 ] - ( qself()[ 1 ] - ;
            qself()[ 24 ] - 2 ))
      endif
   endif
   return qself()

//---------------------------------------------------[top]-
//  __LBISOPEN
//
function __LBISOPEN

   return qself()[ 18 ]

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

   return qself()[ 14 ]

//---------------------------------------------------[top]-
//  __LBKILLFO
//
function __LBKILLFO

   local Local1
   if ( qself()[ 12 ] )
      qself()[ 12 ] := .F.
      if ( ISBLOCK( qself()[ 11 ] ) )
         eval(qself()[ 11 ])
      endif
      Local1 := msetcursor(.F.)
      dispbegin()
      if ( qself()[ 10 ] .AND. qself()[ 18 ] )
         qself():close()
      endif
      qself():display()
      dispend()
      msetcursor(Local1)
      setcursor(qself()[ 21 ])
   endif
   return qself()

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

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 15 ] := _einstvar(qself(), "LEFT", Arg1, "N", 1001)
   endif
   return qself()[ 15 ]

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

   if ( !( ISNIL( Arg1 ) ) )
      qself()[ 16 ] := _einstvar(qself(), "MESSAGE", Arg1, "C", 1001)
   endif
   return qself()[ 16 ]

//---------------------------------------------------[top]-
//  __LBOPEN
//
function __LBOPEN

   if ( !qself()[ 18 ] )
      if ( !_isgraphic() )
         qself()[ 17 ] := Str(qself()[ 24 ] + 1, 2) + ;
            Str(qself()[ 15 ], 2) + Str(qself()[ 1 ], 2) + ;
            Str(qself()[ 19 ], 2) + SaveScreen(qself()[ 24 ] + 1, ;
            qself()[ 15 ], qself()[ 1 ], qself()[ 19 ])
      else
         qself()[ 17 ] := SaveScreen(qself()[ 24 ] + 1, ;
            qself()[ 15 ], qself()[ 1 ], qself()[ 19 ] + 2)
         AAdd(qself()[ 17 ], qself()[ 24 ] + 1)
         AAdd(qself()[ 17 ], qself()[ 15 ])
         AAdd(qself()[ 17 ], qself()[ 1 ])
         AAdd(qself()[ 17 ], qself()[ 19 ] + 2)
      endif
      qself()[ 18 ] := .T.
      qself():display()
   endif
   return qself()

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

   if ( !( ISNIL( Arg1 ) ) .AND. ISOBJECT( ( qself()[ 19 ] := ;
         _einstvar(qself(), "RIGHT", Arg1, "N", 1001), qself()[ 26 ] ;
         ) ) )
      qself()[ 26 ]:offset(Arg1)
   endif
   return qself()[ 19 ]

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

   if ( PCount() == 0 )
   elseif ( ISNIL( Arg1 ) )
      qself()[ 20 ] := Arg1
   else
      qself()[ 20 ] := _einstvar(qself(), "SBLOCK", Arg1, "B", 1001)
   endif
   return qself()[ 20 ]

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

   if ( !( Arg1 < 1 ) )
   elseif ( Arg1 <= qself()[ 14 ] )
      qself()[ 9 ][ Arg1 ][ 2 ] := Arg2
   endif
   return qself()

//---------------------------------------------------[top]-
//  __LBSETFOC
//
function __LBSETFOC

   local Local1
   if ( !qself()[ 12 ] )
      qself()[ 21 ] := setcursor(0)
      qself()[ 12 ] := .T.
      Local1 := msetcursor(.F.)
      dispbegin()
      qself():display()
      dispend()
      msetcursor(Local1)
      if ( ISBLOCK( qself()[ 11 ] ) )
         eval(qself()[ 11 ])
      endif
   endif
   return qself()

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

   do case
   case Arg1 < 1
   case Arg1 > qself()[ 14 ]
   case Len(Arg2) != 2
   case ISCHARACTER( Arg2[ 1 ] )
      qself()[ 9 ][ Arg1 ] := Arg2
   endcase
   return qself()

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

   if ( Arg1 < 1 )
   elseif ( Arg1 <= qself()[ 14 ] )
      qself()[ 9 ][ Arg1 ][ 1 ] := Arg2
   endif
   return qself()

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

   if ( !qself()[ 10 ] )
   elseif ( !( ISNIL( Arg1 ) ) )
      qself()[ 22 ] := _einstvar(qself(), "STYLE", Arg1, "C", 1001, { ;
         |_1, _2| Len(_2) == 1 })
   endif
   return qself()[ 22 ]

//---------------------------------------------------[top]-
//  __LBTEXTVA
//
function __LBTEXTVA

   return qself()[ 23 ]

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

   if ( !( ISNIL( Arg1 ) ) .AND. ISOBJECT( ( qself()[ 24 ] := ;
         _einstvar(qself(), "TOP", Arg1, "N", 1001), qself()[ 26 ] ) ;
         ) )
      qself()[ 26 ]:start(Arg1 + 1)
   endif
   return qself()[ 24 ]

//---------------------------------------------------[top]-
//  __LBTYPEOU
//
function __LBTYPEOU

   return qself()[ 14 ] == 0

//---------------------------------------------------[top]-
//  __LBVALUE
//
function __LBVALUE

   return qself()[ 27 ]

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

   local Local1
   if ( PCount() == 0 )
   elseif ( ISNIL( Arg1 ) )
      qself()[ 26 ] := Arg1
   else
      qself()[ 26 ] := _einstvar(qself(), "VSCROLL", Arg1, "O", 1001, ;
         { |_1, _2| _2:classname() == "SCROLLBAR" .AND. _2:orient() ;
         == 1 })
      Arg1:total(qself()[ 14 ])
   endif
   return qself()[ 26 ]

//---EOF


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