New FTDN January/Enero 2021 (FWH 21.01)
Posted: Sun Feb 07, 2021 9:10 am
January 2021
============
* TGET enhancements:
- New clause for getting VarChar text variables (variable length)
VARCHAR { nMin, nMax }
User can enter text upto nMax characters irrespective of the length
of the input string. Get finally returns a text with length between
nMin and nMax characters.
Useful in getting VarChar text in Sql databases.
- It is now possible to use a bSetGet codeblock as variable. This helps the
programmer to enhance the capabilities of Get.
Eg:
bSetGet := { |x| If( x == nil, nVal * 100, nVal := x / 100 ) }
@ r,c GET bSetGet <clauses,...>
* XBROWSE:
- oCol:bBmpData is expected to return a numeric values, which is the index into
a list of bitmaps already loaded with oCol:AddBitmap(...).
Now oCol:bBmpData can also return any source of image not already loaded. This
enables display of bitmaps/images at runtime which are not already included
in the bitmaps loaded.
Eg:
oCol:bBmpData := { || If( <cond1>, 1, If( <cond2>, 2, "c:\bitmaps\xyz.bmp" ) ) }
- See revised sample: \fwh\samples\xbrwdisk.prg and new sample zodiac.prg
- Automatic generation of TreeBrowse: After creating a browse with any ordered
datasource, calling oBrw:SetTree( nLevels, [aBitmaps] ) automatically generates
tree from the data and switches to Tree Browse.
This feature works for most datasources like arrays, dbf, rowsets but does not
work with ADO recordsets. Now it works with ADO recordsets also.
http://forums.fivetechsupport.com/viewt ... =3&t=39913
- In case of tree browses, COLUMNS clause can also have names of datas/methods of
treeitem class or hashkeys if treeitem:cargo is a hash.
- For tree browses, if the programmer does not specify any bitmaps, xbrowse provides
default bitmaps.
* TREES: (LinkList class)
- Inheritance from TTreeItem class.
It is now possible to derive class from TTreeItem and create trees with the same
command syntax using the new derived class.
- Usage:
- Create a derived class from TTreeItem class.
- Either set TLinkList():bTreeItemClass := { || tmynewitem() }
OR
use command TREE oTree USING { || tmynewitem() } while creating the tree at
the top level, where tmynewitem is the derived class
- All treeitems are created using the new class.
- This setting is automcatically cleared when the last ENDTREE command is executed
for the tree. Trees created subsequently will use the default TTreeItem class.
- TTreeItem class (classes\treeitem.prg) enhancements:
- New ACCESS DATA in TTreeItem :IsLast --> .t. when the item is the last in the tree.
- New SETGET DATA Visible: Setting .t./.f. opens/hides the item
- New SETGET DATA Value. User value to store and retrive.
- New DATA bSetGet. If assigned with a setget codeblock, this is used to
access and assign values to the setget data Value.
* Enhancement TTITLE.PRG: It is now possible to use any image source, not only
bmps.
* New function FW_RecSetHeaders( oRs ) --> aHeaders. (adofuncs.prg)
* New function FW_DrawShadow( hDC, aRect, nSize ) --> Draw shadow along the right
and bottom edge of the rectangle. (imgtxtio.prg)
* Enhancement: TXImage class (ximage.prg):
New DATA nShadowSize INIT 0. If assigned with a positive value, draws shadow
along the right and bottom edges of the control.
* New function ExcelBookSaveAs( oBook, cSaveAs, [lShow] ) --> cFileSavedWithFullPath
Source: \source\function\olefuncs.prg.
cSaveAS: File name with extention xls/xlsx/htm/html/csv/pdf.
lShow: Defaults to .f. If .t., html file will be displayed with function
HTMLVIEW( cFile ), CSV file will be displayed with notepad.exe and PDF file
will be displayed by Excel.
If the function succeeds, file name with full path is returned. Otherwise null
string is returned.
After generation of the file, the excel book is closed.
Notes: (1) Text values are not quoted.
(2) While generating pdf, width is truncated to fit pagesize.
This function is internally used by other functions eg. FW_DbfToExcel(),
FW_AdoToExcel(), etc.
* Enhancements to function
FW_DbfToExcel( [cFieldList], [bFor], [bWhile], [nNext], [nRec], [lRest], [cSaveTo], [lShow] )
Source: \source\function\dbffunc2.prg:
lShow: New optional parameter. Defaults to .f. when cSaveTo is specified and .t. otherwise.
- Alternative syntax:
- FW_DbfToExcel( [cFieldList], cSaveTo, [lShow] )
cSaveTo can be a filename with extention: xls/xlsx/htm/html/csv/pdf
Return value: If cSaveTo is specified, Filename saved with full path and empty
string in case of failure.
If cSaveTo is not specified, returns oSheet.
* Enhancement to function FW_AdoToExcel( cSql/oRs ) --> oSheet
Source: \source\function\adofuncs.prg.
New syntax: FW_AdoToExcel( cSqlOroRs, [cSaveAs], [lShow] )
New functionality of cSaveAs and lShow are similar to FW_DbfToExcel() function
explained above.
* New function FW_ArrayToCSV( aData, [aHead], [cDelimCol=','], [cDelimRow=CRLF], ;
[cTrue], [cFalse] ) --> cCsvData (valtostr.prg)
* New function FW_ArrayToHTML( aData, [aHead], [cTrue], [cFalse] ) --> cHTMLScript
(valtostr.prg)
* New ADO functions( adofuncs.prg )
- FW_ADORsToText( oRs, [nRows] ) --> Tab delimited text
- FW_AdoRsToHTML( oRs, [nRows] ) --> cHTML text to display the table
- FW_AdoRsToCSV( oRs, [nRows] ) --> CSV text
2nd parameter is optional. If provided, only nRows from the current record
poisition are exported and otherwise all rows from the beginning.
In all cases record position before call of the function is restored.
* New class TImageBase64: ( fwh\source\classes\imageb64.prg )
Utility class to Base64 encode an image to be used in webpages and
to extract image from Base64 encoded htmp tag or html file.
When any souce of image is provided as input using
New( uSource )
SetSource( uSource )
Paste() when an image is in clipboard
the class is ready with base64 encoding of the image.
The code can be queried with
SaveText( [cFile], [lUrlEncode], [lTag], [lHtml] ) --> cFile
CopyText( [lUrlEncode], [lTag], [lHtml] ) --> cText. Copies text to clipboard
Parameters lUrlEncode, lTag, lHtml default to the datas with the same names.
The code generated can also be tested using the method TestHTML()
If base64encoded text is provided as source, as file, text or url, the class extracts
the image immediately.
The image can be saved using:
method SaveImage()
- See new sample \fwh\samples\imgb64.prg
* TEdit class ( source\classes\edit.prg )
Added clauses UPDATE and LIMITTEXT [BY n CHARS] to REDEFINE EDIT
command providing the same functionality as @ r,c EDIT command
to edit controls created from resources also.
* TDatarow/FW_Record class:
Character values in arrays and hashes are treated as varchars.
* Samples: (new and revised samples)
xbrwdisk.prg (revised)
album.prg
imgb64.prg
zodiac.prg
FWH 20.12 revision 1
====================
* Enhancement: Class TCalendar Methods New() and Initiate() properly adjust the dimensions of the calendar control.
Many thanks to Antonino: http://forums.fivetechsupport.com/viewt ... p?p=237358
============
* TGET enhancements:
- New clause for getting VarChar text variables (variable length)
VARCHAR { nMin, nMax }
User can enter text upto nMax characters irrespective of the length
of the input string. Get finally returns a text with length between
nMin and nMax characters.
Useful in getting VarChar text in Sql databases.
- It is now possible to use a bSetGet codeblock as variable. This helps the
programmer to enhance the capabilities of Get.
Eg:
bSetGet := { |x| If( x == nil, nVal * 100, nVal := x / 100 ) }
@ r,c GET bSetGet <clauses,...>
* XBROWSE:
- oCol:bBmpData is expected to return a numeric values, which is the index into
a list of bitmaps already loaded with oCol:AddBitmap(...).
Now oCol:bBmpData can also return any source of image not already loaded. This
enables display of bitmaps/images at runtime which are not already included
in the bitmaps loaded.
Eg:
oCol:bBmpData := { || If( <cond1>, 1, If( <cond2>, 2, "c:\bitmaps\xyz.bmp" ) ) }
- See revised sample: \fwh\samples\xbrwdisk.prg and new sample zodiac.prg
- Automatic generation of TreeBrowse: After creating a browse with any ordered
datasource, calling oBrw:SetTree( nLevels, [aBitmaps] ) automatically generates
tree from the data and switches to Tree Browse.
This feature works for most datasources like arrays, dbf, rowsets but does not
work with ADO recordsets. Now it works with ADO recordsets also.
http://forums.fivetechsupport.com/viewt ... =3&t=39913
- In case of tree browses, COLUMNS clause can also have names of datas/methods of
treeitem class or hashkeys if treeitem:cargo is a hash.
- For tree browses, if the programmer does not specify any bitmaps, xbrowse provides
default bitmaps.
* TREES: (LinkList class)
- Inheritance from TTreeItem class.
It is now possible to derive class from TTreeItem and create trees with the same
command syntax using the new derived class.
- Usage:
- Create a derived class from TTreeItem class.
- Either set TLinkList():bTreeItemClass := { || tmynewitem() }
OR
use command TREE oTree USING { || tmynewitem() } while creating the tree at
the top level, where tmynewitem is the derived class
- All treeitems are created using the new class.
- This setting is automcatically cleared when the last ENDTREE command is executed
for the tree. Trees created subsequently will use the default TTreeItem class.
- TTreeItem class (classes\treeitem.prg) enhancements:
- New ACCESS DATA in TTreeItem :IsLast --> .t. when the item is the last in the tree.
- New SETGET DATA Visible: Setting .t./.f. opens/hides the item
- New SETGET DATA Value. User value to store and retrive.
- New DATA bSetGet. If assigned with a setget codeblock, this is used to
access and assign values to the setget data Value.
* Enhancement TTITLE.PRG: It is now possible to use any image source, not only
bmps.
* New function FW_RecSetHeaders( oRs ) --> aHeaders. (adofuncs.prg)
* New function FW_DrawShadow( hDC, aRect, nSize ) --> Draw shadow along the right
and bottom edge of the rectangle. (imgtxtio.prg)
* Enhancement: TXImage class (ximage.prg):
New DATA nShadowSize INIT 0. If assigned with a positive value, draws shadow
along the right and bottom edges of the control.
* New function ExcelBookSaveAs( oBook, cSaveAs, [lShow] ) --> cFileSavedWithFullPath
Source: \source\function\olefuncs.prg.
cSaveAS: File name with extention xls/xlsx/htm/html/csv/pdf.
lShow: Defaults to .f. If .t., html file will be displayed with function
HTMLVIEW( cFile ), CSV file will be displayed with notepad.exe and PDF file
will be displayed by Excel.
If the function succeeds, file name with full path is returned. Otherwise null
string is returned.
After generation of the file, the excel book is closed.
Notes: (1) Text values are not quoted.
(2) While generating pdf, width is truncated to fit pagesize.
This function is internally used by other functions eg. FW_DbfToExcel(),
FW_AdoToExcel(), etc.
* Enhancements to function
FW_DbfToExcel( [cFieldList], [bFor], [bWhile], [nNext], [nRec], [lRest], [cSaveTo], [lShow] )
Source: \source\function\dbffunc2.prg:
lShow: New optional parameter. Defaults to .f. when cSaveTo is specified and .t. otherwise.
- Alternative syntax:
- FW_DbfToExcel( [cFieldList], cSaveTo, [lShow] )
cSaveTo can be a filename with extention: xls/xlsx/htm/html/csv/pdf
Return value: If cSaveTo is specified, Filename saved with full path and empty
string in case of failure.
If cSaveTo is not specified, returns oSheet.
* Enhancement to function FW_AdoToExcel( cSql/oRs ) --> oSheet
Source: \source\function\adofuncs.prg.
New syntax: FW_AdoToExcel( cSqlOroRs, [cSaveAs], [lShow] )
New functionality of cSaveAs and lShow are similar to FW_DbfToExcel() function
explained above.
* New function FW_ArrayToCSV( aData, [aHead], [cDelimCol=','], [cDelimRow=CRLF], ;
[cTrue], [cFalse] ) --> cCsvData (valtostr.prg)
* New function FW_ArrayToHTML( aData, [aHead], [cTrue], [cFalse] ) --> cHTMLScript
(valtostr.prg)
* New ADO functions( adofuncs.prg )
- FW_ADORsToText( oRs, [nRows] ) --> Tab delimited text
- FW_AdoRsToHTML( oRs, [nRows] ) --> cHTML text to display the table
- FW_AdoRsToCSV( oRs, [nRows] ) --> CSV text
2nd parameter is optional. If provided, only nRows from the current record
poisition are exported and otherwise all rows from the beginning.
In all cases record position before call of the function is restored.
* New class TImageBase64: ( fwh\source\classes\imageb64.prg )
Utility class to Base64 encode an image to be used in webpages and
to extract image from Base64 encoded htmp tag or html file.
When any souce of image is provided as input using
New( uSource )
SetSource( uSource )
Paste() when an image is in clipboard
the class is ready with base64 encoding of the image.
The code can be queried with
SaveText( [cFile], [lUrlEncode], [lTag], [lHtml] ) --> cFile
CopyText( [lUrlEncode], [lTag], [lHtml] ) --> cText. Copies text to clipboard
Parameters lUrlEncode, lTag, lHtml default to the datas with the same names.
The code generated can also be tested using the method TestHTML()
If base64encoded text is provided as source, as file, text or url, the class extracts
the image immediately.
The image can be saved using:
method SaveImage()
- See new sample \fwh\samples\imgb64.prg
* TEdit class ( source\classes\edit.prg )
Added clauses UPDATE and LIMITTEXT [BY n CHARS] to REDEFINE EDIT
command providing the same functionality as @ r,c EDIT command
to edit controls created from resources also.
* TDatarow/FW_Record class:
Character values in arrays and hashes are treated as varchars.
* Samples: (new and revised samples)
xbrwdisk.prg (revised)
album.prg
imgb64.prg
zodiac.prg
FWH 20.12 revision 1
====================
* Enhancement: Class TCalendar Methods New() and Initiate() properly adjust the dimensions of the calendar control.
Many thanks to Antonino: http://forums.fivetechsupport.com/viewt ... p?p=237358