See changelog 2000-10-26 22:10 GMT -3
This commit is contained in:
3181
harbour/ChangeLog
3181
harbour/ChangeLog
File diff suppressed because it is too large
Load Diff
3166
harbour/ChangeLog.009
Normal file
3166
harbour/ChangeLog.009
Normal file
File diff suppressed because it is too large
Load Diff
282
harbour/doc/en/tbrowse.txt
Normal file
282
harbour/doc/en/tbrowse.txt
Normal file
@@ -0,0 +1,282 @@
|
||||
|
||||
/* $CLASSDOC$
|
||||
* $FUNCNAME$
|
||||
* TBROWSENew()
|
||||
* $CATEGORY$
|
||||
* Class
|
||||
* $ONELINER$
|
||||
* 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$
|
||||
* SetKey() Add an New key to the Keyboard dictionary
|
||||
*
|
||||
* Applykey() Perform the Browse Key movement
|
||||
* $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
|
||||
*
|
||||
* AddColumn( oCol ) Adds an new TBColumn object to the current Browse
|
||||
*
|
||||
* 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
|
||||
* $TESTS$
|
||||
* See tests/testbrw.prg
|
||||
* $STATUS$
|
||||
* S
|
||||
* $COMPLIANCE$
|
||||
* This functions is Compatible with Ca-Clipper 5.2. The applykey() and
|
||||
* Setkey() methods are only visible if HB_COMPAT_C53 is defined.
|
||||
* $PLATFORMS$
|
||||
* All
|
||||
* $FILES$
|
||||
* Library is rtl
|
||||
* $SEEALSO$
|
||||
* TBROWSENEW(),TBCOLUMNNEW()
|
||||
* $END$
|
||||
*/
|
||||
|
||||
|
||||
/* $CLASSDOC$
|
||||
* $METHOD$
|
||||
* SetKey()
|
||||
* $CATEGORY$
|
||||
* Class methods
|
||||
* $ONELINER$
|
||||
* Get an optionaly Set an new Code block associated to a inkey value
|
||||
* $SYNTAX$
|
||||
* SetKey(<nKey>[,<bBlock>]) --> bOldBlock
|
||||
* $ARGUMENTS$
|
||||
* <nKey> An valid inkey Code
|
||||
*
|
||||
* <bBlock> An optional action to associate to the inkey value.
|
||||
* $RETURNS$
|
||||
* <bOldBlock> If an Keypress has it code block changes, it will return
|
||||
* the previus one; otherwise, it will return the current one
|
||||
* $DESCRIPTION$
|
||||
* This method Get an optionaly set an code block that is associated to
|
||||
* an inkey value.
|
||||
* The table below show the default keypress/Code Block definitions
|
||||
*
|
||||
* <table>
|
||||
* Inkey Value Code Block
|
||||
*
|
||||
* K_DOWN {|Ob,nKey| Ob:Down(),0}
|
||||
* K_END {|Ob,nKey| Ob:End(),0}
|
||||
* K_CTRL_PGDN {|Ob,nKey| Ob:GoBottom(),0}
|
||||
* K_CTRL_PGUP {|Ob,nKey| Ob:GoTop(),0}
|
||||
* K_HOME {|Ob,nKey| Ob:Home(),0}
|
||||
* K_LEFT {|Ob,nKey| Ob:Left(),0}
|
||||
* K_PGDN {|Ob,nKey| Ob:PageDown(),0}
|
||||
* K_PGUP {|Ob,nKey| Ob:PageUp(),0}
|
||||
* K_CTRL_END {|Ob,nKey| Ob:PanEnd(),0}
|
||||
* K_CTRL_HOME {|Ob,nKey| Ob:PanHome(),0}
|
||||
* K_CTRL_LEFT {|Ob,nKey| Ob:PanLeft(),0}
|
||||
* K_CTRL_RIGHT {|Ob,nKey| Ob:PanRight(),0}
|
||||
* K_RIGHT {|Ob,nKey| Ob:Right(),0}
|
||||
* K_UP {|Ob,nKey| Ob:Up(),0}
|
||||
* K_ESC {|Ob,nKey| -1 }
|
||||
* </table>
|
||||
*
|
||||
* The keys handlers can be queried,added and replace an removed from
|
||||
* the internal keyboard dictionary. See the example.
|
||||
*
|
||||
* oTb:SETKEY( K_TAB,{|oTb,nKey| -1})
|
||||
*
|
||||
* An default key handler can be declared by specifyin a value of 0
|
||||
* for <nKey>.It associate code block will be evaluated each time
|
||||
* TBrowse:Applykey() is called with an key value that is not contained
|
||||
* in the dictionary. For example
|
||||
*
|
||||
* oTb:SetKey(0,{|oTb,nKey| DefKeyHandler(otb,nkey})
|
||||
* This call the a function named DefKeyHandler() when nKey is not
|
||||
* contained in the dictionary.
|
||||
*
|
||||
* To remove an keypress/code block definition, specify NIL for <bBlock>
|
||||
* oTb:SetKey(K_ESC,nil)
|
||||
* $EXAMPLES$
|
||||
* oTb:SeyKey(K_F10,{|otb,nkey| ShowListByname(otb)}
|
||||
* $END$
|
||||
*/
|
||||
|
||||
/* $CLASSDOC$
|
||||
* $METHOD$
|
||||
* Applykey()
|
||||
* $CATEGORY$
|
||||
* Class Method
|
||||
* $ONELINER$
|
||||
* Evaluates an code block associated with an specific key
|
||||
* $SYNTAX$
|
||||
* ApplyKey(<nKey>) --> nResult
|
||||
* $ARGUMENTS$
|
||||
* <nKey> An valid Inkey code
|
||||
* $RETURNS$
|
||||
* <nResult> Value returned from the evaluated Code Block
|
||||
* See Table Below
|
||||
*
|
||||
* <table>
|
||||
* Value Meaning
|
||||
* -1 User request for the browse lost input focus
|
||||
* 0 Code block associated with <nkey> was evaluated
|
||||
* 1 Unable to locate <nKey> in the dictionary,Key was not processed
|
||||
* </table>
|
||||
* $DESCRIPTION$
|
||||
* This method evaluate an code block associated with <nkey> that is
|
||||
* contained in the TBrowse:setkey() dictionary.
|
||||
* $EXAMPLES$
|
||||
* while .t.
|
||||
* oTb:forceStable()
|
||||
* if (oTb:applykey(inkey(0))==-1)
|
||||
* exit
|
||||
* endif
|
||||
* enddo
|
||||
* $END$
|
||||
*/
|
||||
|
||||
@@ -42,3 +42,4 @@ en\strotype.txt
|
||||
en\garbage.txt
|
||||
en\idle.txt
|
||||
en\cmdline.txt
|
||||
en\tbrowse.txt
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
#include "common.ch"
|
||||
#include "hbclass.ch"
|
||||
#include "color.ch"
|
||||
|
||||
#include "inkey.ch"
|
||||
CLASS TBrowse
|
||||
|
||||
DATA aColumns // Array to hold all browse columns
|
||||
@@ -98,7 +98,9 @@ CLASS TBrowse
|
||||
DATA lFooters // Internal variable which indicates whether there are column footers to paint
|
||||
DATA aRect // The rectangle specified with ColorRect()
|
||||
DATA aRectColor // The color positions to use in the rectangle specified with ColorRect()
|
||||
|
||||
#ifdef HB_COMPAT_C53
|
||||
DATA aKeys
|
||||
#endif
|
||||
METHOD New(nTop, nLeft, nBottom, nRight) // Constructor
|
||||
METHOD Down() // Moves the cursor down one row
|
||||
METHOD End() // Moves the cursor to the rightmost visible data column
|
||||
@@ -150,7 +152,12 @@ CLASS TBrowse
|
||||
METHOD Stabilize() // Performs incremental stabilization
|
||||
|
||||
METHOD DispCell( nColumn, cColor ) // Displays a single cell
|
||||
|
||||
#ifdef HB_COMPAT_C53
|
||||
method SetKey(nKey,bBlock)
|
||||
method applykey(nKey)
|
||||
method initKeys(Self)
|
||||
method tapplykey(nKey,o)
|
||||
#endif
|
||||
ENDCLASS
|
||||
|
||||
METHOD New(nTop, nLeft, nBottom, nRight) CLASS TBrowse
|
||||
@@ -879,8 +886,62 @@ METHOD DispCell( nColumn, cColor ) CLASS TBrowse
|
||||
DispOut( Space( nCol + ::aColumns[ nColumn ]:Width - Col() ), ::ColorSpec )
|
||||
|
||||
return Self
|
||||
#ifdef HB_COMPAT_C53
|
||||
method applykey(nKey) CLASS TBrowse
|
||||
return ::tapplykey(nKey, self)
|
||||
|
||||
method initKeys(o) CLASS TBROWSE
|
||||
|
||||
Default o:aKeys to {{K_DOWN,{|Ob,nKey| Ob:Down(),0}},;
|
||||
{K_END,{|Ob,nKey| Ob:End(),0}},;
|
||||
{K_CTRL_PGDN,{|Ob,nKey| Ob:GoBottom(),0}},;
|
||||
{K_CTRL_PGUP,{|Ob,nKey| Ob:GoTop(),0}},;
|
||||
{K_HOME,{|Ob,nKey| Ob:Home(),0}},;
|
||||
{K_LEFT,{|Ob,nKey| Ob:Left(),0}},;
|
||||
{K_PGDN,{|Ob,nKey| Ob:PageDown(),0}},;
|
||||
{K_PGUP,{|Ob,nKey| Ob:PageUp(),0}},;
|
||||
{K_CTRL_END,{|Ob,nKey| Ob:PanEnd(),0}},;
|
||||
{K_CTRL_HOME,{|Ob,nKey| Ob:PanHome(),0}},;
|
||||
{K_CTRL_LEFT,{|Ob,nKey| Ob:PanLeft(),0}},;
|
||||
{K_CTRL_RIGHT,{|Ob,nKey| Ob:PanRight(),0}},;
|
||||
{K_RIGHT,{|Ob,nKey| Ob:Right(),0}},;
|
||||
{K_UP,{|Ob,nKey| Ob:Up(),0}},;
|
||||
{K_ESC,{|Ob,nKey| -1 }}}
|
||||
return o
|
||||
|
||||
Method SetKey(nKey,bBlock) CLASS TBrowse
|
||||
local bReturn,nPos
|
||||
::initKeys(self)
|
||||
if (nPos:=ascan(::aKeys,{|x| x[1]==nkey}))==0
|
||||
if ( ISBLOCK( bBlock ) )
|
||||
bReturn:= bBlock
|
||||
aadd(::aKeys,{nKey,bBlock})
|
||||
endif
|
||||
bReturn:=bBlock
|
||||
elseif (ISBLOCK(bBlock))
|
||||
::aKeys[npos][2]:=bBlock
|
||||
bReturn:=bBlock
|
||||
elseif PCOUNT()==1
|
||||
bReturn:= ::aKeys[npos][2]
|
||||
elseif ( bReturn:= ::aKeys[ nPos ][ 2 ], PCount() == 2 .AND. ;
|
||||
ISNIL( bBlock ) .AND. nKey != 0 )
|
||||
adel(::aKeys, nPos)
|
||||
asize(::akeys, Len(::aKeys) - 1)
|
||||
endif
|
||||
return bReturn
|
||||
method TAPPLYKEY( nKey, oBrowse ) CLASS tBrowse
|
||||
|
||||
local bBlock := oBrowse:setkey(nKey), nReturn
|
||||
default bBlock to oBrowse:setkey(0)
|
||||
if ( ISNIL( bBlock ) )
|
||||
nReturn := 1
|
||||
else
|
||||
nReturn := eval(bBlock, oBrowse, nKey)
|
||||
endif
|
||||
return nReturn
|
||||
|
||||
|
||||
#endif
|
||||
function TBrowseNew(nTop, nLeft, nBottom, nRight)
|
||||
|
||||
return TBrowse():New(nTop, nLeft, nBottom, nRight)
|
||||
|
||||
@@ -50,11 +50,17 @@ function Main()
|
||||
nRow := Row()
|
||||
nCol := Col()
|
||||
@ 4,4,17,31 BOX "ÚÄ¿³ÙÄÀ³ "
|
||||
|
||||
while ! lEnd
|
||||
|
||||
oBrowse:Setkey(0,{|ob,nkey| Defproc(ob,nKey)})
|
||||
while .t.
|
||||
oBrowse:ForceStable()
|
||||
if (oBrowse:applykey(inkey(0))== -1)
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
/*
|
||||
oBrowse:ForceStable()
|
||||
|
||||
|
||||
nKey = InKey( 0 )
|
||||
|
||||
do case
|
||||
@@ -111,10 +117,21 @@ function Main()
|
||||
DevPos( nTmpRow, nTmpCol )
|
||||
|
||||
endcase
|
||||
|
||||
end
|
||||
|
||||
*/
|
||||
DevPos( nRow, nCol )
|
||||
SetColor( cColor )
|
||||
SetCursor( nCursor )
|
||||
|
||||
return nil
|
||||
function defproc(ob,nkey)
|
||||
|
||||
if nKey = K_TAB
|
||||
nTmpRow := ROW()
|
||||
nTmpCol := COL()
|
||||
@ 0, 0 SAY TIME()
|
||||
DevPos( nTmpRow, nTmpCol )
|
||||
ob:Refreshall()
|
||||
endif
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user