*** empty log message ***

This commit is contained in:
Antonio Linares
1999-08-07 11:05:59 +00:00
parent 316eb59f96
commit 069980257b
4 changed files with 49 additions and 3 deletions

View File

@@ -1,3 +1,11 @@
19990807-12:54 GMT+1 Antonio Linares <alinares@fivetech.com>
* source/rtl/tbrowse.prg
* improved
* source/rtl/tbcolumn.prg
* improved
* tests/working/TestBrw.prg
* improved
19990807-11:37 GMT+1 Antonio Linares <alinares@fivetech.com>
* source/rtl/tbrowse.prg
* Some methods added

View File

@@ -51,6 +51,7 @@ function TBColumnNew( cHeading, bBlock )
oCol:Heading = cHeading
oCol:block = bBlock
oCol:Width = If( cHeading != nil, Len( cHeading ), 10 )
return oCol

View File

@@ -46,6 +46,7 @@ CLASS TBrowse
DATA rowPos // Current cursor row position
DATA skipBlock // Code block used to reposition data source
DATA stable // Indicates if the TBrowse object is stable
DATA StabLevel // Stabilize() progressive level
METHOD New() // Constructor
METHOD Down() VIRTUAL // Moves the cursor down one row
@@ -93,7 +94,7 @@ CLASS TBrowse
METHOD SetColumn( nColumn, oCol ) INLINE If( 0 < nColumn .and. nColumn <= Len( ::aColumns ),;
::aColumns[ nColumn ] := oCol, nil ), oCol // Replaces one TBColumn object with another
METHOD Stabilize() VIRTUAL // Performs incremental stabilization
METHOD Stabilize() // Performs incremental stabilization
ENDCLASS
@@ -113,6 +114,7 @@ METHOD New() CLASS TBrowse
::ColSep = " "
::FootSep = ""
::HeadSep = ""
::StabLevel = 0
return Self
@@ -126,6 +128,28 @@ METHOD DelColumn( nPos ) CLASS TBrowse
return oCol
METHOD Stabilize() CLASS TBrowse
local n, lDisplay := .t.
@ ::nTop, ::nLeft SAY PadC( ::aColumns[ 1 ]:Heading, ::nRight - ::nLeft ) ;
COLOR ::ColorSpec
for n = 1 to ::nBottom - ::nTop
if lDisplay
@ ::nTop + n, ::nLeft SAY ;
PadC( SubStr( Eval( ::aColumns[ 1 ]:Block ), 1, ::aColumns[ 1 ]:Width ),;
::nRight - ::nLeft ) ;
COLOR ::ColorSpec
else
@ ::nTop + n, ::nLeft SAY Space( ::nRight - ::nLeft ) ;
COLOR ::ColorSpec
endif
lDisplay = Eval( ::SkipBlock, 1 ) != 0
next
return .t.
function TBrowseNew( nTop, nLeft, nBottom, nRight )
local oBrw := TBrowse():New()

View File

@@ -2,11 +2,24 @@
function Main()
local oBrowse := TBrowse():New()
local oBrowse := TBrowseNew( 5, 5, 15, 30 )
local aTest := { "This", "is", "a", "browse", "on", "an", "array", "test" }
local n := 1
oBrowse:AddColumn( TBColumnNew( "Test", { || "This is a test" } ) )
oBrowse:colorSpec = "W+/B, N/BG"
oBrowse:GoTopBlock = { || n := 1 }
oBrowse:GoBottomBlock = { || n := Len( aTest ) }
oBrowse:SkipBlock = { | nSkip, nPos | nPos := n,;
n := If( nSkip > 0, Min( Len( aTest ), n + nSkip ),;
Max( 1, n + nSkip )), n - nPos }
oBrowse:AddColumn( TBColumnNew( "Test", { || aTest[ n ] } ) )
Alert( oBrowse:ClassName() )
Alert( oBrowse:GetColumn( 1 ):ClassName() )
while ! oBrowse:Stabilize()
InKey( 0 )
end
return nil