xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

TBrowseDB()

Creates a new TBrowse object to be used with a database.

Syntax

TBrowseDB( [<nTop>]   , ;
           [<nLeft>]  , ;
           [<nBottom>], ;
           [<nRight>]   ) --> oTBrowse

Arguments

<nTop> and <nLeft>
Numeric values indicating the screen coordinates for the upper left corner of the TBrowse() window. The default value for both parameters is zero.
<nBottom>
Numeric value indicating the bottom row screen coordinate. It defaults to MaxRow().
<nRight>
Numeric value indicating the right column screen coordinate. It defaults to MaxCol().

Return

TBrowseDB() returns new TBrowse object with the specified coordinate and a default :skipBlock, :goTopBlock and :goBottomBlock to browse a database.

Description

TBrowseDB() is a quick way to create a TBrowse object along with the minimal support needed to browse a database. Note that the returned TBrowse object contains no TBColumn objects. They must be added for each field to display in the browse window.

Info

See also:Browse(), DbEdit(), TBColumn(), TBrowse(), TBrowseNew()
Category: Object functions
Source:rtl\tbrowse.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example builds a simple TBrowse object for a database

   #include "TBrowse.ch"

   PROCEDURE Main
      LOCAL oTBrowse, aFields, cField, nKey

      USE Customer

      aFields := Array( FCount() )
      AEval( aFields, {|x,i| aFields[i] := FieldName(i) } )

      oTBrowse := TBrowseDB()

      WITH OBJECT oTBrowse
         FOR EACH cField IN aFields
            :addColumn( TBColumnNew( cField, FieldBlock( cField ) ) )
         NEXT
      END

      DO WHILE .T.
         oTBrowse:forceStable()
         nKey := Inkey(0)

         IF oTBrowse:applyKey( nKey ) == TBR_EXIT
            EXIT
         ENDIF
      ENDDO

      CLOSE Customer
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe