New FTDN December/Diciembre 2020 (FWH 20.12)
Posted: Mon Dec 28, 2020 10:16 am
September to December 2020
==========================
* New: In Class TCalendar Method HandleEvent(), Change(), GetMinReqRect(), SizeRectToMin( aSize ),
SetCurrentView and GetCurrentView have been added and/or modified. Many thanks to AntoninoP
in the forums: http://forums.fivetechsupport.com/viewt ... 15&start=0
* Enhancement: New ACCESS/ASSIGN "cPrompt" method for Class TTVItem
* New: samples\pim.prg a personal information manager using TreeViews
* Fix: samples\xmltree.prg had an error loading the XML file. Already fixed.
* New: Class TTVItem Method Edit() allows inline editing on a TreeView item
* New: Class TTreeView Method EditItem( oItem ) allows inline editing on a TreeView item
* New: Class TTreeView Method GoBottom(), GoNext(), GoPrev(), SwapUp() and SwapDown().
Please review samples\pim.prg for an example of use.
* Fix: Functions FW_AdoPivotArray() and FW_AdoPivotRS() (source\function\adofuncs.prg)
are raising runtime error if the 2nd parameter is a table name but not
an sql query.
http://forums.fivetechsupport.com/viewt ... 38#p236838
Fixed. Now the 2nd parameter can be either a table name or sql query.
* Fix: method SayImage() in printer.prg:
Due to a bug in versions 2007 and 2008, this method raises a runtime
error when executed. Fixed now.
For details and recommended fix for earlier versions please see:
http://forums.fivetechsupport.com/viewt ... 45#p236845
* CLASS TRichEdt5
- Modified / New METHOD SaveAs()
- Added New METHOD RtfBarEdit( nR, nC, nT )
Show / Hide ButtonBar
- Added ButtonBar to control RichEdt5 definition
#command @ <nTop>, <nLeft> RICHEDIT5 [ <oRTF> VAR ] <uVar> ;
[ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ FONT <oFont> ] ;
[ <pixel: PIXEL> ] ;
[ MESSAGE <cMsg> ] ;
[ <lHScroll: HSCROLL> ] ;
[ <readonly: READONLY, NO MODIFY> ] ;
[ WHEN <uWhen> ] ;
[ VALID <uValid> ] ;
[ ON CHANGE <uChange> ] ;
[ <lDesign: DESIGN> ] ;
[ <lHighlight: HIGHLIGHT> ] ;
[ <file: FILE, FILENAME> <cFileName> ] ;
[ RTFSIZE <nRTFSize> ] ;
[ <lNoURL: NO URL> ] ;
[ <lNoScroll: NO SCROLL> ] ;
[ <lNoBorder: NOBORDER, NO BORDER> ] ;
[ MARGINLEFT <nLeftMargin> ] ;
[ <lBar: BARBUTTON> ] ;
- Added New Method SetPageRotate( n ) // 0 - 90 - 180 - 270
* TTreeView Class:
- Added TVN_BEGINLABELEDIT and TVN_ENDLABELEDIT, allow Edit TVItem.
* MEMOEDIT.PRG
- Changes for better use and implementation of the TRichEdt5 control
* BITMAPS.C
- Added new bitmap: closebn
* Support for Matrix calculations:
http://forums.fivetechsupport.com/viewt ... =3&t=39736
* New CLASS FW_Matrix (for matrix calculations)
CLASS FW_Matrix:
READ ONLY DATAS AND ACCESS METHODS:
DATA aMatrix READONLY
DATA nRows, nCols READONLY
ACCESS lSquare INLINE ( ::nRows == ::nCols )
ACCESS Determinant INLINE If( ::nRows == ::nCols, m_determinant( ::aMatrix ), 0 )
ACCESS IsIdentity
CONSTRUCTOR METHODS:
METHOD New( aArray ) CONSTRUCTOR
METHOD Identity( nSize ) CONSTRUCTOR
// --> Identity matrix of nSize rows and nSize cols.
METHOD Random( nRows, nCols, nMin, nMax, lInteger ) CONSTRUCTOR
nMin and nMax default to -1 and +1
Returns a matrix with size nRows,nCols with each element initialized with a random value between nMin and nMax. If lInteger is .t., all the values are integers.
METHODS TO PRINT OR VIEW:
METHOD View( [cTitle] ) // Displays the array in xbrowse
METHOD AsText( [lCrlf := .f.] ) // --> string as box or single line
METHODS FOR CALCULATIONS:
METHOD Calc( bCalc, u ) // or ( u, bCalc )
Returns a new matrix object, evaluating bCalc on every element of the
matrix using the operand "u". "u" can be a scalar number of a matrix.
bCalc is evaluated with two params |x,y| where
x is ::aMatrix[ nRow, nCol ] for each row col and
y is the operand if numeric or corresponding u[ nRow, nCol ] if matrix and
nil if u is nil
METHOD Add( u ) INLINE ::Calc( { |x,y| x + y }, u )
METHOD Subtract( u ) INLINE ::Calc( { |x,y| x - y }, u )
METHOD SubtractFrom( u ) INLINE ::Calc( { |x,y| y - x }, u )
METHOD Negative() INLINE ::Calc( { |x| -x } )
METHOD ScalarInverse() INLINE ::Calc( { |x| 1 / x } )
METHOD Exp() INLINE ::Calc( { |x| Exp( x ) } )
METHOD Sigmoid() INLINE ::Calc( { |x| 1 / ( 1 + Exp( -x ) ) } )
METHOD Sigmoid_derivative() INLINE ::Calc( { |x| x * ( 1 - x ) } )
METHOD DevideBy( u )
METHOD DevideFrom( u )
METHOD Transpose()
METHOD SumOfRows()
METHOD LinearMultiply( u ) INLINE ::Calc( { |x,y| x * y }, u )
MESSAGE MatrixMultiply METHOD mmult
METHOD mmult( u )
METHOD Multiply( u )
// Linear multiply if u is numeric or matrix multiply if u is matrix
METHOD Linear( lSet ) INLINE ( ::plLinear := If( lSet == nil, .t., lSet ), Self )
matrix:Linear() operator operand always performs a linear calculation.
METHOD Invert()
METHOD Inverse() INLINE ::Invert()
OPERATOR "+" ARG u INLINE ::Add( u )
OPERATOR "-" ARG u INLINE ::Subtract( u )
OPERATOR "*" ARG u INLINE ::Multiply( u )
OPERATOR "/" ARG u INLINE ::DevideBy( u )
OPERATOR "==" ARG u INLINE ::IsEqual( u )
OPERATOR "^" ARG u INLINE If( u == -1, ::Inverse(), ::Calc( { |x,y| x ^ y }, u ) )
METHOD ByIndex( i ) OPERATOR "[]"
matrix[ nRow ] --> row as a single dimentional array.
Same as ::aMatrix[ nRow ]
matrix[ nRow, nCol ] --> value of ::aMatrix at nRow, nCol
It is recommended to use operators +-*/^ and == instead of calling the
corresponding methods.
OPERATOR *:
matrix1 * matrix2 --> result matrix of matrix multiplication of
matrix1 and matrix2
matrix1 * number --> new matrix with all elements of matrix1
multiplied the number.
matrix1:Linear() * matrix2 --> new matrix with all elements of
matrix1 multiplied by each corresponding element in matrix2
* A library of C functions is provided to build highly efficient
C level programs. These functions are independent of FW_Matrix class.
In this library, matrix is stored in the following structure:
typedef struct _MATRIX
{
int rows;
int cols;
int len;
int xlen;
double * array;
} MATRIX, * PMATRIX;
- Harbour level functions to access the C level functions:
MATRIX_CREATE( aArray ) --> Pointer to Matrix structure using aArray
MATRIX_IDENTITY( nSize ) --> pIdentityMatrix
MATRIX_RANDOM ( nRows, nCols, nMin = -1.0, nMax = 1.0, lIntegers )
--> pRandomMatrix
MATRIX_RELEASE( pMatrix )
MATRIX_TRANSPOSE( pMatrix ) --> pTransposedMatrix
MATRIX_VAL( pMatrix, nRow, nCol ) --> Value
MATRIX_ROW( pMatrix, nRow ) --> aRow
MATRIX_ARRAY( pMatrix ) --> aMatrix
MATRIX_INVERT( pMatrix ) --> Inverse of pMatrix
MATRIX_REFLECT( pMatrix ) --> Transposes the same Square Matrix
MATRIX_CALC( pmatrix1, cOp, double/pmatrix2, [lReverse], [presultmatrix] )
--> pResultMatrix
MATRIX_MMULT( pmatrix1, pmatrix2 ) --> pProductMatrix
MATRIX_DETERMINANT( pMatrix ) --> determinant
MATRIX_SUMOFROWS( matrix, [result] ) --> result
- C functions that can be used in an application program written in C.
double calc( double x, char cOp, double y, HB_BOOL inverse );
PMATRIX matrix_new( int iRows, int iCols );
void matrix_release( MATRIX * matrix );
PMATRIX matrix_check( PMATRIX matrix, int iRows, int iCols );
PMATRIX matrix_clone( MATRIX * matrix );
void matrix_copyfrom( PMATRIX dst, PMATRIX src );
PMATRIX matrix_identity( int iSize );
PMATRIX matrix_random( int iRows, int iCols, double dMin, double dMax,
HB_BOOL bInteger );
PMATRIX matrix_transpose( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_scalar_calc( PMATRIX m1, char cOp, double operand,
HB_BOOL inverse, PMATRIX result );
PMATRIX matrix_sigmoid( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_sigmoid_derivative( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_linear_calc( PMATRIX m1, char cOp, PMATRIX m2, PMATRIX result );
PMATRIX matrix_sumofrows( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_mmult( PMATRIX m1, PMATRIX m2, PMATRIX result );
double array_determinant( double * array, int iSize );
double matrix_determinant( PMATRIX matrix );
PMATRIX matrix_invert( PMATRIX matrix );
In the above functions, if the parameter PMATRIX result is NULL,
a new matrix of the required size is created and returned. This needs
to be released using matrix_release(). If result is a valid matrix pointer,
then this matrix is used to fill the result and returned, after resizing
if necessary. This avoids the overhead of creating a new matrix and
releasing it.
Normally, FW_Matrix class should be enough for most applications.
Where large computations are to be performed in large loops writing the
code in C using these C functions improves the execution speed considerably.
==========================
* New: In Class TCalendar Method HandleEvent(), Change(), GetMinReqRect(), SizeRectToMin( aSize ),
SetCurrentView and GetCurrentView have been added and/or modified. Many thanks to AntoninoP
in the forums: http://forums.fivetechsupport.com/viewt ... 15&start=0
* Enhancement: New ACCESS/ASSIGN "cPrompt" method for Class TTVItem
* New: samples\pim.prg a personal information manager using TreeViews
* Fix: samples\xmltree.prg had an error loading the XML file. Already fixed.
* New: Class TTVItem Method Edit() allows inline editing on a TreeView item
* New: Class TTreeView Method EditItem( oItem ) allows inline editing on a TreeView item
* New: Class TTreeView Method GoBottom(), GoNext(), GoPrev(), SwapUp() and SwapDown().
Please review samples\pim.prg for an example of use.
* Fix: Functions FW_AdoPivotArray() and FW_AdoPivotRS() (source\function\adofuncs.prg)
are raising runtime error if the 2nd parameter is a table name but not
an sql query.
http://forums.fivetechsupport.com/viewt ... 38#p236838
Fixed. Now the 2nd parameter can be either a table name or sql query.
* Fix: method SayImage() in printer.prg:
Due to a bug in versions 2007 and 2008, this method raises a runtime
error when executed. Fixed now.
For details and recommended fix for earlier versions please see:
http://forums.fivetechsupport.com/viewt ... 45#p236845
* CLASS TRichEdt5
- Modified / New METHOD SaveAs()
- Added New METHOD RtfBarEdit( nR, nC, nT )
Show / Hide ButtonBar
- Added ButtonBar to control RichEdt5 definition
#command @ <nTop>, <nLeft> RICHEDIT5 [ <oRTF> VAR ] <uVar> ;
[ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ FONT <oFont> ] ;
[ <pixel: PIXEL> ] ;
[ MESSAGE <cMsg> ] ;
[ <lHScroll: HSCROLL> ] ;
[ <readonly: READONLY, NO MODIFY> ] ;
[ WHEN <uWhen> ] ;
[ VALID <uValid> ] ;
[ ON CHANGE <uChange> ] ;
[ <lDesign: DESIGN> ] ;
[ <lHighlight: HIGHLIGHT> ] ;
[ <file: FILE, FILENAME> <cFileName> ] ;
[ RTFSIZE <nRTFSize> ] ;
[ <lNoURL: NO URL> ] ;
[ <lNoScroll: NO SCROLL> ] ;
[ <lNoBorder: NOBORDER, NO BORDER> ] ;
[ MARGINLEFT <nLeftMargin> ] ;
[ <lBar: BARBUTTON> ] ;
- Added New Method SetPageRotate( n ) // 0 - 90 - 180 - 270
* TTreeView Class:
- Added TVN_BEGINLABELEDIT and TVN_ENDLABELEDIT, allow Edit TVItem.
* MEMOEDIT.PRG
- Changes for better use and implementation of the TRichEdt5 control
* BITMAPS.C
- Added new bitmap: closebn
* Support for Matrix calculations:
http://forums.fivetechsupport.com/viewt ... =3&t=39736
* New CLASS FW_Matrix (for matrix calculations)
CLASS FW_Matrix:
READ ONLY DATAS AND ACCESS METHODS:
DATA aMatrix READONLY
DATA nRows, nCols READONLY
ACCESS lSquare INLINE ( ::nRows == ::nCols )
ACCESS Determinant INLINE If( ::nRows == ::nCols, m_determinant( ::aMatrix ), 0 )
ACCESS IsIdentity
CONSTRUCTOR METHODS:
METHOD New( aArray ) CONSTRUCTOR
METHOD Identity( nSize ) CONSTRUCTOR
// --> Identity matrix of nSize rows and nSize cols.
METHOD Random( nRows, nCols, nMin, nMax, lInteger ) CONSTRUCTOR
nMin and nMax default to -1 and +1
Returns a matrix with size nRows,nCols with each element initialized with a random value between nMin and nMax. If lInteger is .t., all the values are integers.
METHODS TO PRINT OR VIEW:
METHOD View( [cTitle] ) // Displays the array in xbrowse
METHOD AsText( [lCrlf := .f.] ) // --> string as box or single line
METHODS FOR CALCULATIONS:
METHOD Calc( bCalc, u ) // or ( u, bCalc )
Returns a new matrix object, evaluating bCalc on every element of the
matrix using the operand "u". "u" can be a scalar number of a matrix.
bCalc is evaluated with two params |x,y| where
x is ::aMatrix[ nRow, nCol ] for each row col and
y is the operand if numeric or corresponding u[ nRow, nCol ] if matrix and
nil if u is nil
METHOD Add( u ) INLINE ::Calc( { |x,y| x + y }, u )
METHOD Subtract( u ) INLINE ::Calc( { |x,y| x - y }, u )
METHOD SubtractFrom( u ) INLINE ::Calc( { |x,y| y - x }, u )
METHOD Negative() INLINE ::Calc( { |x| -x } )
METHOD ScalarInverse() INLINE ::Calc( { |x| 1 / x } )
METHOD Exp() INLINE ::Calc( { |x| Exp( x ) } )
METHOD Sigmoid() INLINE ::Calc( { |x| 1 / ( 1 + Exp( -x ) ) } )
METHOD Sigmoid_derivative() INLINE ::Calc( { |x| x * ( 1 - x ) } )
METHOD DevideBy( u )
METHOD DevideFrom( u )
METHOD Transpose()
METHOD SumOfRows()
METHOD LinearMultiply( u ) INLINE ::Calc( { |x,y| x * y }, u )
MESSAGE MatrixMultiply METHOD mmult
METHOD mmult( u )
METHOD Multiply( u )
// Linear multiply if u is numeric or matrix multiply if u is matrix
METHOD Linear( lSet ) INLINE ( ::plLinear := If( lSet == nil, .t., lSet ), Self )
matrix:Linear() operator operand always performs a linear calculation.
METHOD Invert()
METHOD Inverse() INLINE ::Invert()
OPERATOR "+" ARG u INLINE ::Add( u )
OPERATOR "-" ARG u INLINE ::Subtract( u )
OPERATOR "*" ARG u INLINE ::Multiply( u )
OPERATOR "/" ARG u INLINE ::DevideBy( u )
OPERATOR "==" ARG u INLINE ::IsEqual( u )
OPERATOR "^" ARG u INLINE If( u == -1, ::Inverse(), ::Calc( { |x,y| x ^ y }, u ) )
METHOD ByIndex( i ) OPERATOR "[]"
matrix[ nRow ] --> row as a single dimentional array.
Same as ::aMatrix[ nRow ]
matrix[ nRow, nCol ] --> value of ::aMatrix at nRow, nCol
It is recommended to use operators +-*/^ and == instead of calling the
corresponding methods.
OPERATOR *:
matrix1 * matrix2 --> result matrix of matrix multiplication of
matrix1 and matrix2
matrix1 * number --> new matrix with all elements of matrix1
multiplied the number.
matrix1:Linear() * matrix2 --> new matrix with all elements of
matrix1 multiplied by each corresponding element in matrix2
* A library of C functions is provided to build highly efficient
C level programs. These functions are independent of FW_Matrix class.
In this library, matrix is stored in the following structure:
typedef struct _MATRIX
{
int rows;
int cols;
int len;
int xlen;
double * array;
} MATRIX, * PMATRIX;
- Harbour level functions to access the C level functions:
MATRIX_CREATE( aArray ) --> Pointer to Matrix structure using aArray
MATRIX_IDENTITY( nSize ) --> pIdentityMatrix
MATRIX_RANDOM ( nRows, nCols, nMin = -1.0, nMax = 1.0, lIntegers )
--> pRandomMatrix
MATRIX_RELEASE( pMatrix )
MATRIX_TRANSPOSE( pMatrix ) --> pTransposedMatrix
MATRIX_VAL( pMatrix, nRow, nCol ) --> Value
MATRIX_ROW( pMatrix, nRow ) --> aRow
MATRIX_ARRAY( pMatrix ) --> aMatrix
MATRIX_INVERT( pMatrix ) --> Inverse of pMatrix
MATRIX_REFLECT( pMatrix ) --> Transposes the same Square Matrix
MATRIX_CALC( pmatrix1, cOp, double/pmatrix2, [lReverse], [presultmatrix] )
--> pResultMatrix
MATRIX_MMULT( pmatrix1, pmatrix2 ) --> pProductMatrix
MATRIX_DETERMINANT( pMatrix ) --> determinant
MATRIX_SUMOFROWS( matrix, [result] ) --> result
- C functions that can be used in an application program written in C.
double calc( double x, char cOp, double y, HB_BOOL inverse );
PMATRIX matrix_new( int iRows, int iCols );
void matrix_release( MATRIX * matrix );
PMATRIX matrix_check( PMATRIX matrix, int iRows, int iCols );
PMATRIX matrix_clone( MATRIX * matrix );
void matrix_copyfrom( PMATRIX dst, PMATRIX src );
PMATRIX matrix_identity( int iSize );
PMATRIX matrix_random( int iRows, int iCols, double dMin, double dMax,
HB_BOOL bInteger );
PMATRIX matrix_transpose( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_scalar_calc( PMATRIX m1, char cOp, double operand,
HB_BOOL inverse, PMATRIX result );
PMATRIX matrix_sigmoid( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_sigmoid_derivative( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_linear_calc( PMATRIX m1, char cOp, PMATRIX m2, PMATRIX result );
PMATRIX matrix_sumofrows( PMATRIX matrix, PMATRIX result );
PMATRIX matrix_mmult( PMATRIX m1, PMATRIX m2, PMATRIX result );
double array_determinant( double * array, int iSize );
double matrix_determinant( PMATRIX matrix );
PMATRIX matrix_invert( PMATRIX matrix );
In the above functions, if the parameter PMATRIX result is NULL,
a new matrix of the required size is created and returned. This needs
to be released using matrix_release(). If result is a valid matrix pointer,
then this matrix is used to fill the result and returned, after resizing
if necessary. This avoids the overhead of creating a new matrix and
releasing it.
Normally, FW_Matrix class should be enough for most applications.
Where large computations are to be performed in large loops writing the
code in C using these C functions improves the execution speed considerably.