New FTDN January/Enero 2021 (FWH 21.01)

New FTDN January/Enero 2021 (FWH 21.01)

Postby Antonio Linares » 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.
viewtopic.php?f=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: viewtopic.php?p=237358
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: New FTDN January/Enero 2021 (FWH 21.01)

Postby Antonio Linares » Sun Feb 07, 2021 9:15 am

Enero 2021
==========

* Mejoras en la clase TGET:
- Nueva cláusula para obtener variables de texto VarChar (longitud variable) VARCHAR {nMin, nMax}.
El usuario puede añadir texto hasta nMax caracteres independientemente de la longitud de la
cadena de entrada. El Get finalmente devuelve un texto con una longitud entre nMin y nMax caracteres.
Útil para obtener variables de texto VarChar en bases de datos SQL.

- Ahora es posible usar un bloque de código bSetGet como variable. Esto ayuda al programador a
mejorar las capacidades del Get.

Por ejemplo:
bSetGet := { |x| If( x == nil, nVal * 100, nVal := x / 100 ) }
@ r,c GET bSetGet <clauses,...>

* XBROWSE:
- Se espera que oCol:bBmpData devuelva un valor numérico, que es el índice en una lista de
imágenes de mapas de bits ya cargados con oCol:AddBitmap(...).
Ahora oCol:bBmpData también puede devolver cualquier fuente de imagen no cargada.
Esto permite la visualización de cualquier imagen de mapa de bits en tiempo de ejecución que
no haya sido incluida en la lista de imágenes de mapa de bits cargada.

Por ejemplo:
oCol:bBmpData := { || If( <cond1>, 1, If( <cond2>, 2, "c:\bitmaps\xyz.bmp" ) ) }

- Mira el ejemplo revisado y el nuevo: \fwh\samples\xbrwdisk.prg y \fwh\samples\zodiac.prg

- Generación automática de TreeBrowse: Después de crear un objeto Browse con cualquier fuente
de datos ordenada, llamar a oBrw:SetTree (nLevels, [aBitmaps]) genera automáticamente un árbol
a partir de los datos y cambia a TreeBrowse.
Esta característica funciona para la mayoría de las fuentes de datos como matrices, ficheros dbf,
conjuntos de filas, pero no funciona con conjuntos de registros ADO.
Ahora también funciona con conjuntos de registros ADO.
viewtopic.php?f=3&t=39913

- En el caso de TreeBrowse, la claúsula COLUMNS también puede tener nombre de las DATAS/METODOS de la
clase TTreeItem o claves de atrices asociativos si treeitem:cargo es una matriz asociativa.

- Para los Tree Browses, si el programador no especifica ninguna imagen de mapa de bits, xBrowse
proporciona imágenes de mapas de bits por defecto.

* TREES: (Clase LinkList)
- Hereda de la clase TTreeItem.
Ahora es posible derivar la clase de TTreeItem y crear árboles con la misma sintaxis de comando usando
la nueva clase derivada.
- Uso:
- Crea una clase derivada de la clase TTreeItem.
- Cualquiera de las dos TLinkList():bTreeItemClass := { || tmynewitem() }
OR
usando el comando TREE oTree USING { || tmynewitem() }
al crear el árbol en el nivel superior, donde tmynewitem es la clase derivada.
- Todos los elementos del árbol se crean utilizando la nueva clase.
- Esta configuración se borra automáticamente cuando se ejecuta el último comando ENDTREE para el árbol.
Los árboles creados posteriormente utilizarán la clase TreeItem por defecto.

- Clase TTreeItem (classes\treeitem.prg) mejoras:
- Nueva ACCESS DATA en TTreeItem :IsLast --> .T., cuando el artículo es el último en el árbol.
- Nueva SETGET DATA Visible: Configurando .T./.F. muestra/oculta el artículo
- Nueva SETGET DATA Value. Valor definido por el usuario para almacenar y recuperar.
- Nueva DATA bSetGet. Si se le asigna un bloque de código setget, se utiliza para acceder y asignar valores
al valor de la DATA setget.

* Mejora en la clase TTITLE.PRG: Ahora es posible usar cualquier fuente de imagen, no sólo
imágenes de mapas de bits.

* Nueva función FW_RecSetHeaders( oRs ) --> aHeaders. (adofuncs.prg)

* Nueva función FW_DrawShadow( hDC, aRect, nSize ) --> Dibuja una sombra a lo largo del borde
derecho e inferior del rectángulo. (imgtxtio.prg)

* Mejora en la clase TXImage (ximage.prg):
Nueva DATA nShadowSize INIT 0. Si se le asigna un valor positivo, dibuja sombras a lo largo
de los bordes derecho e inferior del control.

* Nueva función ExcelBookSaveAs( oBook, cSaveAs, [lShow] ) --> cFileSavedWithFullPath
Fuente: \source\function\olefuncs.prg.
cSaveAS: Nombre de fichero con extensión xls/xlsx/htm/html/csv/pdf.
lShow: Por defecto a .F. Si es .T. , entonces el fichero html es mostrado con la función
HTMLVIEW( cFile ), el fichero CSV se mostrará con Notepad y el fichero PDF se mostrará con Excel.
Si la función tiene éxito, se devuelve el nombre del fichero con la ruta completa. De lo contrario, nulo.
Después de la generación del fichero, el libro Excel es cerrado.
Notas:
(1) Los valores de texto no se citan.
(2) Mientras se genera el fichero pdf, el ancho se trunca para adaptarse al tamaño de la página.
Esta función es internamente usada por otras funciones, por ejemplo: FW_DbfToExcel(),
FW_AdoToExcel(), etc.

* Mejoras en la función FW_DbfToExcel()
FW_DbfToExcel( [cFieldList], [bFor], [bWhile], [nNext], [nRec], [lRest], [cSaveTo], [lShow] )
Fuente: \source\function\dbffunc2.prg:
lShow: Nuevo parámetro opcional. Por defecto es .F., cuando se especifica cSaveTo y .T. en caso contrario.
- Sintaxis alternativa:
- FW_DbfToExcel( [cFieldList], cSaveTo, [lShow] )
cSaveTo puede ser un fichero con extensión: xls/xlsx/htm/html/csv/pdf
Valor devuelto: Si se especifica cSaveTo, el nombre de archivo se guarda con la ruta completa
una cadena vacía en caso de falla.
Si no se especifica cSaveTo, devuelve oSheet.

* Mejoras en la función FW_AdoToExcel( cSql/oRs ) --> oSheet
Fuente: \source\function\adofuncs.prg.
Nueva sintaxis: FW_AdoToExcel( cSqlOroRs, [cSaveAs], [lShow] )
Nueva funcionalidad de cSaveAs y lShow son similares a la función FW_DbfToExcel() explicada arriba.

* Nueva función FW_ArrayToCSV( aData, [aHead], [cDelimCol=','], [cDelimRow=CRLF], ;
[cTrue], [cFalse] ) --> cCsvData (valtostr.prg)

* Nueva función FW_ArrayToHTML( aData, [aHead], [cTrue], [cFalse] ) --> cHTMLScript
(valtostr.prg)

* Nuevas funciones ADO ( adofuncs.prg )
- FW_ADORsToText( oRs, [nRows] ) --> Testo delimitado por tabulaciones
- FW_AdoRsToHTML( oRs, [nRows] ) --> Testo cHTML mostrar la tabla
- FW_AdoRsToCSV( oRs, [nRows] ) --> Testo CSV
El segundo parámetro es opcional. Si se proporciona, sólo se exporta nRows desde la posición de registro actual
y de lo contrario, todas las filas desde el principio.
En todos los casos se restablece la posición de registro antes de la llamada de la función.

* Nueva clase TImageBase64: ( fwh\source\classes\imageb64.prg )

La utilidad de la clase es codificar en Base64 una imagen para ser usada en páginas web y para extraer la imagen
de una etiqueta htm codificada en Base64 o de un fichero html.

Cuando se proporciona cualquier fuente de imagen como entrada utilizando
New( uSource )
SetSource( uSource )
Paste() cuando una imagen está en el portapapeles la clase está lista con la codificación base64 de la imagen.

El código se puede consultar con
SaveText( [cFile], [lUrlEncode], [lTag], [lHtml] ) --> cFile
CopyText( [lUrlEncode], [lTag], [lHtml] ) --> cText. Copia el texto al portapapeles.

Los parámetros lUrlEncode, lTag, lHtml por defecto a las datas con los mismos nombres.

El código generado también se puede probar usando el método TestHTML()

Si se proporciona texto codificado en base64 como fuente, como fichero, texto o url, la clase extrae
la imagen inmediatamente.
La imagen se puede guardar usando:
Method SaveImage()

- Mira el ejemplo nuevo: \fwh\samples\imgb64.prg

* Clase TEdit ( source\classes\edit.prg )
Añadidas las claúsulas UPDATE y LIMITTEXT [BY n CHARS] al comando REDEFINE EDIT para proporcionarle la misma funcionalidad que al comando @ r,c EDIT para editar controles también creados desde recursos.

* Clase TDatarow/FW_Record:
Los valores de tipo carácter en matrices y en matrices asociativas (hashes) son tratados como de tipo varchar.

* Ejemplos: (Nuevos y revisados)
xbrwdisk.prg (revised)
album.prg
imgb64.prg
zodiac.prg

FWH 20.12 revision 1
====================

* Mejora: En la clase TCalendar, en los métodos New() e Initiate(), se ajusta correctamente a las dimensiones del control
calendario. Muchas gracias a Antonino: viewtopic.php?p=237358
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to WhatsNew / Novedades

Who is online

Users browsing this forum: No registered users and 26 guests