New FTDN March / Marzo 2008 (8.03)
Posted: Wed Mar 12, 2008 7:27 pm
March 2008
=========
* Enhancement: Class TMsgBar, the hand cursor is only shown when a MsgItem contains an action to be fired.
* Enhancement: The recent added function GetGuiResources() has been modified to be dynamically linked. This fixes an uncompatibility problem with Windows NT.
* New: command REDEFINE XBROWSE already available for Class TXBrowse. This will help to Class TWBrowse and similars to migrate to Class TXBrowse.
* Enhancement: Class TXBrowse scrolling and painting.
* Enhancement: Class TGet proper support for '@!' and spanish and other countries special chars like "ñ", etc.
* Fix: Class TOutLook Method EndPaint() minor fix.
* New: Class TComboBox Method End() to properly hide and destroy the dropdown editable comboboxes.
* Enhancement: Class TTabs allows to set bRClicked to disable the default shown popup menu.
* New: FiveWin.ch support for TRY ... CATCH ... END for Harbour. Not needed for xHarbour users.
* Enhancement: function aOData( <oObject> ) --> aData returns the proper DATA names if Harbour/xHarbour are used.
* Enhancement: Tooltips can now have user defined header, icon and colors, by specifying the tooltip as an array in the format { cToolTipText, [cHeader, [nIcon]], [nForeColor], [nBackColor] }. If the tooltip is specified as a codeblock, it can evaluate to a character value or an array.
* Enhancement: Improved XBrowse Commands:
Commands for xbrowse and xbrowse columns are greatly improved to provide compatibility with the commands for TWBrowse and TCBrowse and at the same time providing greater enhanced functionality. We favor using commands over the earlier detailed coding because the commands extremely simplify complex tasks, greatly reduce coding effort and provide easier maintenance of the code.
@ row, col XBROWSE and REDEFINE XBROWSE are comapatible with LISTBOX commands.
* Enhancement: for XBrowse commands:
In FIELDS <expressionlist,...>, the expressions need not evaluate to character value and can evaluate their native data type. This is recommended over the earlier practice of providing expressions to return character values. Browse object will automatically justify and format the values depending on the data type appropriately.
Optionally PICTURES <picturelist,...> and JUSTIFY <ajust,...> can be specified in line overriding default formatting and justification.
When the fields list does not involve complex expressions, COLUMNS <namesoffields,...> can also be used. For arrays COLUMNS <columnnumbers,...> can be given.
Arrays, recordsets and oDbf can be specified inline as ARRAY aData or RECORDSET oRs or OBJECT oDbf in the place of ALIAS cAliasName. There is no need to call SetArray, SetAdo, SetOdbf methods separately.
Examples:
RDD.1
@ 10, 10 XBROWSE oBrw ; // or REDEFINE XBROWSE oBrw ID 101
COLUMNS "First", "Age". "HireDate" ;
ALIAS "CUST"
oBrw:CreateFromCode() // oBrw:CreateFromResource(nID) is not required if REDEFINE is used.
ACTIVATE WINDOW / DIALOG ....
RDD.2
@ r, c XBROWSE oBrw ;
COLUMNS "First", "Age" ;
FIELDS (cAlias)->Salary + 1000 ; // both columns and fields are shown
PICTURES nil, "99", "9999999.99" ; // optional
HEADERS nil, nil, "NewSalary" ; // where nil, column names are default headers
JUSTIFY .F., AL_CENTER, .T. ; // logical values or numbers can be used
ALIAS "CUST" ;
AUTOSORT // Auto sorting if index exists on column name
Simple columns can be specified with COLUMNS and complex expressions can be specified with FIELDS.
oBrw:oCol( "NewSalary" ):cSortOrder := "SALARY" // for sorting the third column
RDD.3
REDEFINE XBROWSE oBrw ALIAS cAlias AUTOCOLS AUTOSORT
Arrays.1:
REDEFINE XBROWSE oBrw ;
COLUMNS 3, 2, 5 ; // optional if only these three columns are to be browsed ;
HEADERS "Third", "Second", "Fifth" ;
ARRAY aData ;
AUTOSORT
Arrays.2
@ 10,10 XBROWSE oBrw ARRAY aData AUTOSORT AUTOCOLS
ADO RecordSets:
ADO.1
@ 10,10 XBROWSE oBrw RECORDSET oRs AUTOCOLS AUTOSORT
ADO.2
REDEFINE XBROWSE oBrw ;
COLUMNS "First", "Last", "Salary", "HireDate" ;
[ HEADERS, PICTURES, JUSTIFY can also be used to override defaults ] ;
RECSET oRs ;
AUTOSORT
Note: Now browsing of blank recordsets is supported.
DataBase objects like TDataBase (FWH) or any object having navigational methods compatible with TDataBase.
ODBF:
@ 10,10 XBROWSE oBrw ;
[ COLUMNS "First", "Salary", ... ] ;
[ FIELDS oDbf:Age, oDbf:City ] ;
OBJECT oDbf
Autosort and AutoCols are not supported for database objects.
In addition, columns can also be added with ADD TO oBrw command similar to TCBrowse commands:
Examples:
ADD TO oBrw DATA <expr> PICTURE <pic> etc.
Editable and bOnPostEdit can be specified inline.
ADD TO oBrw ARRAY ELEMENT 4 PICTURE .... etc
* TXBrowse Enhancements: (please review samples\TestXBr3.prg)
a) bStrData: Deprecated, Users are advised to assign a codeblock returning the data in its native type ( 'N', "C", "D", "L" ) and optionally assigining the picture to oCol:cEditPicture. Browse class will automatically derive the bStrData from the bEditValue and cEditPicture, if specified, and in addition the Browse can appropriately handle the values for alignment, formatting, copy / export to excel and reports.
b) Transparent Browse: Specifying oBrw:lTransparent := .t. and oBrw:oBrw := oBrush will paint the browse transparently over the background.
c) New Method: ToExcel( [bProgress] )
Exports data in the visible columns to Excel. The method works with Excel 2003. The columns are formatted justified according to the data types and totalled of the new data lTotal of the TXBrwColumn object is set to true. If specified, bProgress codeblock is evaluated with nCompletedRows, nTotalRows.
d) Improved: SetArray: Improved to specify individual columns in user
specified order.
Syntax:
oBrw:SetArray(aData, lAutoOrder, nInitialORder, aCols )
Example:
oBrw:SetArray( aData, .t., 1, { 3, 2, 6, 1 } )
The browse will show only columns 3,2,6 and 1 of the array in that order.
e) Improved: SetRDD( [lAddColumns], [lAutoSort], [aFldNames] )
If lAutoSort parameter is set to True, the browse will sort the data on the index order having the same name as the fieldname on LeftClick on the header. It is not necessary to specify the codeblock oCol:bLClickHeader unlike earlier.
If an array containing the field names is given in the parameter aFldNames, only those fields are added to the browse.
Example: oBrw:SetRDD( .t., .t., { "First", "Last", "Salary" } )
f) Improved: SetADO( oRs, [lAddColumns], [lAutoSort], [aFldNames] ).
Functionality is similar to SetRDD.
It is now possible to browse empty recordsets.
g) New: SetODbf( oDbf, [ aCols ] ). Optionally aCols can be an array of
fieldnames. oDbf can be any object based on any data source having
navigational methods similar to TDatabase class.
h) Improvements common to SetRDD, SetAdo, etc.
Automatic justification. Numbers and Dates are automatically justified
Right by default. Values are automatically formatted based on the data
type, field length and decimals, unless overridden specifically. These
improvements simplify tedious coding in case of simple browses. Still
columns with complex data can be handled in the standard manner.
i) New Method Copy(): Pressing Ctrl+C invokes the new method Copy(). This method copies the value in the selected cell, in case of celled browses, or the entire selected row in case of row browses and all the selected rows in case multiple rows are selected to ClipBoard. Cell values are delmited by chr(9) and rows are delimited by CRLF. The text is copied in a format compatible to be pasted in Excel sheet. If oCol:bEditvalue is
specified the data type is approrpiately handled. This default behaviour can be disabled by setting oBrw:lAllowCopy := .f.
j) New Methods: DrawSelect() and RefreshCurrent() are mapped to DrawLine( .t. ) to be compatible with TWBrowse / TCBrowse syntax.
k) New Method: RefreshFooters(). This method refreshes footers only, evaluating the codeblocks if necessary, without having to Refresh the entire browse. This results fast response in case of large browses.
l) New Method: aRow() returns ::aArrayData[ ::nArrayAt ].
m) New Method: oCol( cHeader ) returns the column object matching the given header. If numberic value is passed as parameter this method is equivalent to ::aCols[ nCol ].
Example:
WITH OBJECT oBrw:oCol( "Amount" ) // column object having header "amount"
:nEditTyoe := .t.
..... etc ...
END
n) Browsing empty array:
SetArray method may be called with the array containing atleast one dummy row. This dummy row enables the browse object to assign columns with proper datatypes and widths.
After oBrw:CreateFromCode(), add the two lines ASize( aData, 0 ), oBrw:Keycount().
* TXBrwColumn enhancements:
a) New DATA nArrayCol. It is now enough to write oCol:nArrayCol := 3, instead of the earlier method of oCol:bStrData := { || cValToChar( oBrw:aArrayData[ oBrw:nArrayAt, 3 ] ) }.
Browse object automatically generates the necessary code.
b) New DATA cSortOrder. It is now not necessary to do the tedious coding of oCol:bLclickHeader to enable sorting of data in response the Left Click on the header.
Assiging the name of index order in case of RDD, column names in case of ADO or the column number of array to the Data cSortOrder is all that is needed.
c) New DATA cDataType. Internally used. Data type is automatically derived from bEditValue if specified. The datatype is internally used for formatting, alignment, reporting, export to excel and copy to clipboard methods.
d) New DATA bEditWhen. If assigned, column Edit is not invoked if the codeblock evaluates to false.
e) New DATA cEditKeys. If a character sting is specified, only key press matching one of the characters in cEditKeys will invoke Edit method in case oBrw:lFastEdit := .t..
The default behaviour is Enter Key or Double Click on the cell invokes Edit and when oBrw:lFastEdit is .t., for dates and numerics digit key and for others alphadigit key invokes edit.
f) DATAs cFooter / bFooter. Now cFooter need not be character type only. bFooter can evaluate to any data type. Footers will be formatted automatically.
g) New METHOD SetCheck ( aBitMaps/aResource, bOnPostEdit ). Logical values can be displayed as bitmaps with this method. First parameter is an array with two or three bitmaps or resource names. First bitmap is used for showing True and second bitmap is used for showing false. If bOnPostEdit parameter is specified, the column is set in edit mode. Pressing space bar or double clicking on the cell toggles the logical value.
h) New METHOD RefreshFooter(). Refreshes footer of the specified column only, evaluating bFooter, if specified.
i) If a numeric column is edited, in addition to redrawing the selected row, footer of column also is refreshed automatically if cFooter or bFooter is specified. It is no more necessary to code for refreshing the footers.
j) Number formatting. Numeric values having decimals are automatically formatted with thousand separators and right justified. This behaviour can be changed globally with xbrNumFormat( "A" or "E", .t. or .f. ). When first parameter is "E" thousand separators are dots ( "." ) and decimal separators are commans and otherwise the thousand separators are commas and decimal separators are ".". If logical value in the second parameter decides whether thousand separators are to be used or not.
* fix: Minor change in source\errsysw.prg
=========
* Enhancement: Class TMsgBar, the hand cursor is only shown when a MsgItem contains an action to be fired.
* Enhancement: The recent added function GetGuiResources() has been modified to be dynamically linked. This fixes an uncompatibility problem with Windows NT.
* New: command REDEFINE XBROWSE already available for Class TXBrowse. This will help to Class TWBrowse and similars to migrate to Class TXBrowse.
* Enhancement: Class TXBrowse scrolling and painting.
* Enhancement: Class TGet proper support for '@!' and spanish and other countries special chars like "ñ", etc.
* Fix: Class TOutLook Method EndPaint() minor fix.
* New: Class TComboBox Method End() to properly hide and destroy the dropdown editable comboboxes.
* Enhancement: Class TTabs allows to set bRClicked to disable the default shown popup menu.
* New: FiveWin.ch support for TRY ... CATCH ... END for Harbour. Not needed for xHarbour users.
* Enhancement: function aOData( <oObject> ) --> aData returns the proper DATA names if Harbour/xHarbour are used.
* Enhancement: Tooltips can now have user defined header, icon and colors, by specifying the tooltip as an array in the format { cToolTipText, [cHeader, [nIcon]], [nForeColor], [nBackColor] }. If the tooltip is specified as a codeblock, it can evaluate to a character value or an array.
* Enhancement: Improved XBrowse Commands:
Commands for xbrowse and xbrowse columns are greatly improved to provide compatibility with the commands for TWBrowse and TCBrowse and at the same time providing greater enhanced functionality. We favor using commands over the earlier detailed coding because the commands extremely simplify complex tasks, greatly reduce coding effort and provide easier maintenance of the code.
@ row, col XBROWSE and REDEFINE XBROWSE are comapatible with LISTBOX commands.
* Enhancement: for XBrowse commands:
In FIELDS <expressionlist,...>, the expressions need not evaluate to character value and can evaluate their native data type. This is recommended over the earlier practice of providing expressions to return character values. Browse object will automatically justify and format the values depending on the data type appropriately.
Optionally PICTURES <picturelist,...> and JUSTIFY <ajust,...> can be specified in line overriding default formatting and justification.
When the fields list does not involve complex expressions, COLUMNS <namesoffields,...> can also be used. For arrays COLUMNS <columnnumbers,...> can be given.
Arrays, recordsets and oDbf can be specified inline as ARRAY aData or RECORDSET oRs or OBJECT oDbf in the place of ALIAS cAliasName. There is no need to call SetArray, SetAdo, SetOdbf methods separately.
Examples:
RDD.1
@ 10, 10 XBROWSE oBrw ; // or REDEFINE XBROWSE oBrw ID 101
COLUMNS "First", "Age". "HireDate" ;
ALIAS "CUST"
oBrw:CreateFromCode() // oBrw:CreateFromResource(nID) is not required if REDEFINE is used.
ACTIVATE WINDOW / DIALOG ....
RDD.2
@ r, c XBROWSE oBrw ;
COLUMNS "First", "Age" ;
FIELDS (cAlias)->Salary + 1000 ; // both columns and fields are shown
PICTURES nil, "99", "9999999.99" ; // optional
HEADERS nil, nil, "NewSalary" ; // where nil, column names are default headers
JUSTIFY .F., AL_CENTER, .T. ; // logical values or numbers can be used
ALIAS "CUST" ;
AUTOSORT // Auto sorting if index exists on column name
Simple columns can be specified with COLUMNS and complex expressions can be specified with FIELDS.
oBrw:oCol( "NewSalary" ):cSortOrder := "SALARY" // for sorting the third column
RDD.3
REDEFINE XBROWSE oBrw ALIAS cAlias AUTOCOLS AUTOSORT
Arrays.1:
REDEFINE XBROWSE oBrw ;
COLUMNS 3, 2, 5 ; // optional if only these three columns are to be browsed ;
HEADERS "Third", "Second", "Fifth" ;
ARRAY aData ;
AUTOSORT
Arrays.2
@ 10,10 XBROWSE oBrw ARRAY aData AUTOSORT AUTOCOLS
ADO RecordSets:
ADO.1
@ 10,10 XBROWSE oBrw RECORDSET oRs AUTOCOLS AUTOSORT
ADO.2
REDEFINE XBROWSE oBrw ;
COLUMNS "First", "Last", "Salary", "HireDate" ;
[ HEADERS, PICTURES, JUSTIFY can also be used to override defaults ] ;
RECSET oRs ;
AUTOSORT
Note: Now browsing of blank recordsets is supported.
DataBase objects like TDataBase (FWH) or any object having navigational methods compatible with TDataBase.
ODBF:
@ 10,10 XBROWSE oBrw ;
[ COLUMNS "First", "Salary", ... ] ;
[ FIELDS oDbf:Age, oDbf:City ] ;
OBJECT oDbf
Autosort and AutoCols are not supported for database objects.
In addition, columns can also be added with ADD TO oBrw command similar to TCBrowse commands:
Examples:
ADD TO oBrw DATA <expr> PICTURE <pic> etc.
Editable and bOnPostEdit can be specified inline.
ADD TO oBrw ARRAY ELEMENT 4 PICTURE .... etc
* TXBrowse Enhancements: (please review samples\TestXBr3.prg)
a) bStrData: Deprecated, Users are advised to assign a codeblock returning the data in its native type ( 'N', "C", "D", "L" ) and optionally assigining the picture to oCol:cEditPicture. Browse class will automatically derive the bStrData from the bEditValue and cEditPicture, if specified, and in addition the Browse can appropriately handle the values for alignment, formatting, copy / export to excel and reports.
b) Transparent Browse: Specifying oBrw:lTransparent := .t. and oBrw:oBrw := oBrush will paint the browse transparently over the background.
c) New Method: ToExcel( [bProgress] )
Exports data in the visible columns to Excel. The method works with Excel 2003. The columns are formatted justified according to the data types and totalled of the new data lTotal of the TXBrwColumn object is set to true. If specified, bProgress codeblock is evaluated with nCompletedRows, nTotalRows.
d) Improved: SetArray: Improved to specify individual columns in user
specified order.
Syntax:
oBrw:SetArray(aData, lAutoOrder, nInitialORder, aCols )
Example:
oBrw:SetArray( aData, .t., 1, { 3, 2, 6, 1 } )
The browse will show only columns 3,2,6 and 1 of the array in that order.
e) Improved: SetRDD( [lAddColumns], [lAutoSort], [aFldNames] )
If lAutoSort parameter is set to True, the browse will sort the data on the index order having the same name as the fieldname on LeftClick on the header. It is not necessary to specify the codeblock oCol:bLClickHeader unlike earlier.
If an array containing the field names is given in the parameter aFldNames, only those fields are added to the browse.
Example: oBrw:SetRDD( .t., .t., { "First", "Last", "Salary" } )
f) Improved: SetADO( oRs, [lAddColumns], [lAutoSort], [aFldNames] ).
Functionality is similar to SetRDD.
It is now possible to browse empty recordsets.
g) New: SetODbf( oDbf, [ aCols ] ). Optionally aCols can be an array of
fieldnames. oDbf can be any object based on any data source having
navigational methods similar to TDatabase class.
h) Improvements common to SetRDD, SetAdo, etc.
Automatic justification. Numbers and Dates are automatically justified
Right by default. Values are automatically formatted based on the data
type, field length and decimals, unless overridden specifically. These
improvements simplify tedious coding in case of simple browses. Still
columns with complex data can be handled in the standard manner.
i) New Method Copy(): Pressing Ctrl+C invokes the new method Copy(). This method copies the value in the selected cell, in case of celled browses, or the entire selected row in case of row browses and all the selected rows in case multiple rows are selected to ClipBoard. Cell values are delmited by chr(9) and rows are delimited by CRLF. The text is copied in a format compatible to be pasted in Excel sheet. If oCol:bEditvalue is
specified the data type is approrpiately handled. This default behaviour can be disabled by setting oBrw:lAllowCopy := .f.
j) New Methods: DrawSelect() and RefreshCurrent() are mapped to DrawLine( .t. ) to be compatible with TWBrowse / TCBrowse syntax.
k) New Method: RefreshFooters(). This method refreshes footers only, evaluating the codeblocks if necessary, without having to Refresh the entire browse. This results fast response in case of large browses.
l) New Method: aRow() returns ::aArrayData[ ::nArrayAt ].
m) New Method: oCol( cHeader ) returns the column object matching the given header. If numberic value is passed as parameter this method is equivalent to ::aCols[ nCol ].
Example:
WITH OBJECT oBrw:oCol( "Amount" ) // column object having header "amount"
:nEditTyoe := .t.
..... etc ...
END
n) Browsing empty array:
SetArray method may be called with the array containing atleast one dummy row. This dummy row enables the browse object to assign columns with proper datatypes and widths.
After oBrw:CreateFromCode(), add the two lines ASize( aData, 0 ), oBrw:Keycount().
* TXBrwColumn enhancements:
a) New DATA nArrayCol. It is now enough to write oCol:nArrayCol := 3, instead of the earlier method of oCol:bStrData := { || cValToChar( oBrw:aArrayData[ oBrw:nArrayAt, 3 ] ) }.
Browse object automatically generates the necessary code.
b) New DATA cSortOrder. It is now not necessary to do the tedious coding of oCol:bLclickHeader to enable sorting of data in response the Left Click on the header.
Assiging the name of index order in case of RDD, column names in case of ADO or the column number of array to the Data cSortOrder is all that is needed.
c) New DATA cDataType. Internally used. Data type is automatically derived from bEditValue if specified. The datatype is internally used for formatting, alignment, reporting, export to excel and copy to clipboard methods.
d) New DATA bEditWhen. If assigned, column Edit is not invoked if the codeblock evaluates to false.
e) New DATA cEditKeys. If a character sting is specified, only key press matching one of the characters in cEditKeys will invoke Edit method in case oBrw:lFastEdit := .t..
The default behaviour is Enter Key or Double Click on the cell invokes Edit and when oBrw:lFastEdit is .t., for dates and numerics digit key and for others alphadigit key invokes edit.
f) DATAs cFooter / bFooter. Now cFooter need not be character type only. bFooter can evaluate to any data type. Footers will be formatted automatically.
g) New METHOD SetCheck ( aBitMaps/aResource, bOnPostEdit ). Logical values can be displayed as bitmaps with this method. First parameter is an array with two or three bitmaps or resource names. First bitmap is used for showing True and second bitmap is used for showing false. If bOnPostEdit parameter is specified, the column is set in edit mode. Pressing space bar or double clicking on the cell toggles the logical value.
h) New METHOD RefreshFooter(). Refreshes footer of the specified column only, evaluating bFooter, if specified.
i) If a numeric column is edited, in addition to redrawing the selected row, footer of column also is refreshed automatically if cFooter or bFooter is specified. It is no more necessary to code for refreshing the footers.
j) Number formatting. Numeric values having decimals are automatically formatted with thousand separators and right justified. This behaviour can be changed globally with xbrNumFormat( "A" or "E", .t. or .f. ). When first parameter is "E" thousand separators are dots ( "." ) and decimal separators are commans and otherwise the thousand separators are commas and decimal separators are ".". If logical value in the second parameter decides whether thousand separators are to be used or not.
* fix: Minor change in source\errsysw.prg