TBrowseDB
TBrowseNew
TFileRead
THtml
TNortonGuide
TOs2
TRtf
TTroff
Tag Archives: TBrowseNew()
Harbour All Functions – T
Harbour TBrowse Functions
TBrowseNew()
TBrowseNew()
Create a Browse Object
Constructor
TBrowseNew(<nTop>, <nLeft>, <nBottom>, <nRight>) –> <oBrowse>
Arguments
<nTop> Top Row <nLeft> Top Left Column <nBottom> Bottom Row <nRight> Bottom Right Column
Returns
<oBrowse> An new Browse Object
Description
This function set up a browsing window at top-left coordinates of <nTop>, <nLeft> to bottom-right coordinates of <nBottom>, <nRight>.
To browse Database files use TBrowseDB() function insted.
Datanolink
:aColumns Array to hold all browse columns :autoLite Logical value to control highlighting :cargo User-definable variable :colorSpec Color table for the TBrowse display :colPos Current cursor column position :colSep Column separator character :footSep Footing separator character :freeze Number of columns to freeze :goBottomBlock Code block executed by TBrowse:goBottom() :goTopBlock Code block executed by TBrowse:goTop() :headSep Heading separator character :hitBottom Indicates the end of available data :hitTop Indicates the beginning of available data :leftVisible Indicates position of leftmost unfrozen column in display :nBottom Bottom row number for the TBrowse display :nLeft Leftmost column for the TBrowse display :nRight Rightmost column for the TBrowse display :nTop Top row number for the TBrowse display :rightVisible Indicates position of rightmost unfrozen column in display :rowCount Number of visible data rows in the TBrowse display :rowPos Current cursor row position :skipBlock Code block used to reposition data source :stable Indicates if the TBrowse object is stable :aRedraw Array of logical items indicating, is appropriate row need to be redraw :RelativePos Indicates record position relatively position of first record on the screen :lHeaders Internal variable which indicates whether there are column footers to paint :lFooters Internal variable which indicates whether there are column footers to paint :aRect The rectangle specified with ColorRect() :aRectColor The color positions to use in the rectangle specified with ColorRect() :aKeys Holds the Default movement keys
Methodslink
AddColumn() Adds an new TBColumn object to the current Browse Applykey() Perform the Browse Key movement SetKey() Add an New key to the Keyboard dictionary
Methodsnolink
New(nTop, nLeft, nBottom, nRight) Create an new Browse class and set the default values
Down() Moves the cursor down one row End() Moves the cursor to the rightmost visible data column GoBottom() Repositions the data source to the bottom of file GoTop() Repositions the data source to the top of file Home() Moves the cursor to the leftmost visible data column Left() Moves the cursor left one column PageDown() Repositions the data source downward PageUp() Repositions the data source upward PanEnd() Moves the cursor to the rightmost data column PanHome() Moves the cursor to the leftmost visible data column PanLeft() Pans left without changing the cursor position PanRight() Pans right without changing the cursor position Right() Moves the cursor right one column Up() Moves the cursor up one row ColCount() Return the Current number of Columns ColorRect() Alters the color of a rectangular group of cells ColWidth( nColumn ) Returns the display width of a particular column Configure( nMode ) Reconfigures the internal settings of the TBrowse object nMode is an undocumented parameter in CA-Cl*pper LeftDetermine() Determine leftmost unfrozen column in display DeHilite() Dehighlights the current cell DelColumn( nPos ) Delete a column object from a browse ForceStable() Performs a full stabilization GetColumn( nColumn ) Gets a specific TBColumn object Hilite() Highlights the current cell InsColumn( nPos, oCol ) Insert a column object in a browse Invalidate() Forces entire redraw during next stabilization RefreshAll() Causes all data to be recalculated during the next stabilize RefreshCurrent() Causes the current row to be refilled and repainted on next stabilize SetColumn( nColumn, oCol ) Replaces one TBColumn object with another Stabilize() Performs incremental stabilization DispCell( nColumn, cColor ) Displays a single cell
Examples
See tests/testbrw.prg
Compliance
This functions is Compatible with CA-Cl*pper 5.2. The applykey() and SetKey() methods are only visible if HB_COMPAT_C53 is defined.
Platforms
All
Files
Library is core
Seealso
TBrowseNew(), TBColumnNew()
TBrowseDB()
TBrowseDB()
Create a new TBrowse object to be used with database file
Syntax
TBrowseDB( [<nTop>], [<nLeft>], [<nBottom>], [<nRight>] ) --> oBrowse
Arguments
<nTop> coordinate for top row display.
<nLeft> coordinate for left column display.
<nBottom> coordinate for bottom row display.
<nRight> coordinate for right column display.
Returns
TBrowseDB() return new TBrowse object with the specified coordinate and a default :SkipBlock, :GoTopBlock and :GoBottomBlock to browse a database file.
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 contain no TBColumn objects and you need to add column for each field by your self.
Examples
For a good example, look at the source code for Browse() function at src/rtl/browse.prg
Compliance
Harbour
Files
Library is core
Seealso
Browse(), TBColumn class, TBrowse class, TBrowseNew()
SP_AASKIP
AASKIP() Short: ------ AASKIP() Use for skipblock for arrays in Tbrowse Returns: -------- <nSkipcount> => number skipped, forward or backward Syntax: ------- AASKIP(nSkip,@nElement,nMaxRows) Description: ------------ Use this to create the SKIPBLOCK for a tbrowse that browses an array, as in : aTbrowseObject:SKIPBLOCK := {|n|aaskip(n,@nElement,len(aArray)} <nSkip> is passed in by Tbrowse as a +- value, or as zero. <nElement> is the current array element number. PASSED IN BY REFERENCE! <nMaxrows> refers to the length of the array being browsed Examples: --------- // this example browses the fields in a database local nLastKey, nElement := 1 local aArray := dbstruct() local oTb := tBrowseNew(2,2,20,78) oTb:addcolumn(tbcolumnew("Name",{||aArray[nElement,1]})) oTb:addcolumn(tbcolumnew("Type", {||aArray[nElement,2]})) oTb:addcolumn(tbcolumnew("Len " , {||aArray[nElement,3]})) oTb:addcolumn(tbcolumnew("Deci", {||aArray[nElement,4]})) oTb:Skipblock := {|n|aaskip(n,@nElement,len(aArray)} oTb:goTopBlock := {||nElement := 1} oTb:goBottomBlock := {||nElement := len(aArray)} while .t. while !oTb:stabilize() end nLastKey := inkey(0) do case /// various actions..... endcase end Notes: ------- Aaskip() is used by a lot of SuperLib functions, but is very useful by itself for creating array tbrowses. Source: ------- S_AASKIP.PRG
C5 TBrowse Class
Overwiev Provides objects for browsing table-oriented data ------------------------------------------------------------------------------ Description A TBrowse object is a general purpose browsing mechanism for table-oriented data. TBrowse objects provide a sophisticated architecture for acquiring, formatting, and displaying data. Data retrieval and file positioning are performed via user-supplied code blocks, allowing a high degree of flexibility and interaction between the browsing mechanism and the underlying data source. The format of individual data items can be precisely controlled via the TBColumn data retrieval code blocks; overall display formatting and attributes can be controlled by sending appropriate messages to the TBrowse object. A TBrowse object relies on one or more TBColumn objects. A TBColumn object contains the information necessary to define a single column of the browse table (see TBColumn class in this chapter). During operation, a TBrowse object retrieves data by evaluating code blocks. The data is organized into rows and columns and displayed within a specified rectangular region of the screen. The TBrowse object maintains an internal browse cursor. The data item on which the browse cursor rests is displayed in a highlighted color. (The actual screen cursor is also positioned to the first character of this data item.) Initially, the browse cursor is placed on the data item at the top left of the browse display. Messages can then be sent to the TBrowse object to navigate the displayed data, causing the browse cursor to move. These messages are normally sent in response to user keystrokes. New data is automatically retrieved as required by navigation requests. When navigation proceeds past the edge of the visible rectangle, rows or columns beyond that edge are automatically brought into view. When new rows are brought into view, the underlying data source is repositioned by evaluating a code block. Note: TBrowse objects do not clear the entire window before output during redisplay operations. Part of the window may still be cleared when data from the existing display is scrolled. Examples For fully operational examples of a TBrowse object, refer to the TBrowse introduction chapter in the Programming and Utilities guide and to TbDemo.prg located in \CLIPPER5\SOURCE\SAMPLE. Class Functions TBrowseNew() Create a new TBrowse object TBrowseNew(<nTop>, <nLeft>, <nBottom>, <nRight>) --> objTBrowse Returns a new TBrowse object with the specified coordinate settings. The TBrowse object is created with no columns and no code blocks for data positioning. These must be provided before the TBrowse object can be used. TBrowseDB() Create a new TBrowse object for browsing a database file
TBrowseDB(<nTop>, <nLeft>, <nBottom>, <nRight>)
--> objTBrowse Returns a new TBrowse object with the specified coordinate settings and default code blocks for data source positioning within database files. The default code blocks execute the GO TOP, GO BOTTOM, and SKIP operations. Note that TBrowseDB() creates an object with no column objects. To make the TBrowse object usable, you must add a column for each field to be displayed.
See Also: BROWSE()* DBEDIT()* SETCOLOR() TBColumn