New FTDN August / Agosto 2008 (8.08)
Posted: Wed Aug 20, 2008 6:23 pm
August 2008
===========
* Fix: Class TDbCombo minor change in Method KeyChar().
* New: An interesting example showing how to manage a non modal dialogbox from a Tree. Please review samples\TestTre4.prg
* New: An interesting example showing how to dinamically change the alias of a xbrowse in runtime. Please review samples\XBrwAlias.prg.
* New: An interesting example showing how to use a folder with two XBrowses working on arrays, with different editing capabilities in each one. Please review samples\FoldXBrw.prg.
* New: FWPPC, Class TControl Method GetDlgCode(). Now controls can set its DATA nDlgCode and its properly processed, the same way as in FWH.
* New: FWPPC: OleAuto support is already available for FiveWin for Pocket PC. You can use CreateObject() or TOleAuto():New().
* Enhancement: Class TXBrowse Method KeyDown() and KeyChar() have been modified so pressing escape will cancel a current editing operation but will not close the container dialog.
* New function SetDialogEsc( lOnOff ) lets you control if your applications dialogs could be closed pressing ESC. FiveWin allows this behavior by default. In case that you want to change it, simply call SetDialogEsc( .F. ) from the beginning of your application. SetDialogEsc() also returns the
previous state, so you can store it and change it dynamically along the execution of your application.
* New: An interesting example showing how to build a values inspector using a TXBrowse object. Please review samples\Inspect.prg
* New: Class TComboBox DATA lIncSearch, false by default, lets use or not the incremental search. When lIncSearch is .F., then Class TComboBox uses Windows API standard behavior.
* New: New clauses ACTION ... [ BITMAP ... ] for GETs. FiveWin automatically creates a themed button on the GET which fires an ACTION, and you can change the GET contents from it too. Please review samples\getbtn.prg and getbtnr.prg. No need to change your current resources files!
* New: REDEFINE SAY ... TRANSPARENT already available. No need to declare a variable to hold the SAY object to set its transparency.
* New: A new example showing how to use gradient colors with dialogs and folders. Please review samples\FoldGrad.prg
* New: In the folder FWH\UEStudio we have included the config file to build applications using xHarbour and FWH. Previously only Harbour config file was provided.
* Fix: Class TButton Method Click() was not properly setting the focus before to executing its action.
* New: font.ch, added STRIKEOUT clause for creation of fonts
* New: font.prg new Methods: Bold( lOnOff ), Italic( lOnOff ), UnderLine( lOnOff ), StrikeOff( lOnOff ), Escapement( nNew ), Rotate( nRotateBy ), Modify( lBold, lItalic, lUnderline, lStrikeOut, nNewEsc ) return new font object with the modification.
Example:
DEFINE FONT oFont NAME 'ARIAL' SIZE 0,-10
oFontB := oFont:Bold() // defaults to .t.
oFontS := oFont:StrikeOut( .t. )
oFontLeft := oFont:Escapement( 2700 )
oFont2 := oFont:Rotate( 900 )
Overloaded "==": oFont1 == oFont2 --> .t. or .f.
* Enhancements in BUTTONBAR:
- Improvement: Bar is painted properly in 2007 style, irrespective of l3D setting.
- Fix: In 2007 style, position of buttons was shifted by 8 pixels to the right after any readjustment/relocation of the bar. Now fixed.
- Improvement: Change of gradient colors at runtime are now propagated to buttons also, unless a different gradient is assigned to the button.
* Enhancements in BTNBMP:
- New: 2007 style :Individual buttons can now be created with 2007 style. Default gradient colors can be overridden by assinging new gradient colors and can be changed at runtime.
- Bitmaps can be positioned TOP, LEFT, RIGHT, BOTTOM in 2007 style also. This works for both buttons on bars and individual buttons
* Class TDataBase:
1) Improved New( [ncArea], [cDbfFile], [cDriver], [lShared], [lReadOnly] )
TDataBase():new() or TDataBase():New( nSelectArea ) works the same way as in the earlier versions with an already open dbf.
(a) TDataBase():New( cAlias ) also works on an already open dbf.
(b) New method called with 2 or more paramters constructs the instance without opening the table. Use() method should be used to open the table.
(c) cDriver, lShared and lReadOnly default to RddSetDefault(), !Set(_SET_EXCLUSIVE) and .f.
2) New() can be called with 0 or "" as the only parameter to instantiate an object without assigning any table. Data cFile, etc. can be directly assigned and Use() can be called to open the table.
3) New Method Use() to Open table specfied with New(..) method or by directly assigning datas
4) New method Open( ... ) with the same parameters is equivalent to calling New() and use() methods. Success of opening the table can be checked with Used() method.
5) Datas cFile, lShared, lReadOnly, cDriver return the correct values if the table is opened and otherwise use the values assigned to Open the file.
6) Improved: RecLock( nRecNo ) now uses DBRLock(), to facilitate additive record locking.
7) New: RecUnLock( [nRecNo] ): If nRecNo is specified, unlocks the specified record only and otherwise unlocks all records.
New:IsRecLocked( nRecNo ): Returns true if the specifed record is locked or the tentire file is locked.
9) Delete, Recall, FieldPut, Save methods locks the record automatically if not already locked. After the action, the record is left in the original locked condition before calling the method.
10) New Methods: KeyNo, KeyGoTo( nKey ), KeyCount() are mapped to OrdkeyNo, OrdkeyGoTo, OrdkeyCount()
11) Improved: Blank(): Now uses uValBlank to improve speed.
12) Improved: DBEval() now works without having to save and restore lBuffer values.
13) New Method: RollBack(): In (x)Harbour applications, this command rollsback uncommited changes to DBF and in all cases it reloads the buffer, cancelling the changes made to the buffer (Equivalent to calling :Load() )
14) Modified(): Returns .t. only when :lBuffer is true and buffered values are different from the dbf field values
15) New Method: Updated(): Returns .t. when either Modified() is true or any dbf fields are changed but not yet committed. RollBack() can be called to restore the original record.
16) Improved: SetRelation( cnoArea, cExp, [lScoped] ). First parameter can be another tdatbase object. Added new optional parameter lScoped ( defaults to .f. )
17) SetFilter( <cFilter> )
Class TXBrowse:
1) Improved Refresh(): Now Refresh method checks if the current record is deleted and if deleted, repositions the display row to the next record. If the deleted record is the last record, the row is positioned on the last record. This applies only to RDDs. XBrowse is the only browse at present doing this automatically.
2) ReArrangeCols( aSeq, lRetainRest )
This method is useful to rearrange the order of selected columns to appear in the beginning, after creating a browse ( very likely after including all columns automatically ). if the second parameter is true ( default ) remaining columns are retained after the given sequence and otherwie the remaining columns are totally deleted.
aSeq is an array containing either Headers or Creationorder of the columns and they can be intermixed.
3) New Method: CurrentRow() returns an object containing values of the row at the time of call. Even for some unexpected reasons the browse navigates to any other row, the values returned by the object remain static. The values of the object can be accessed and assigned with the names of headers, eg: oRow:First, oRow:City, etc.
In addition, the row object provides the following data and methods:
DATA:
oBrw .. Parent XBrowse object
nRecNo .. RecordNo ( In case of ADO BookMark )
nKeyNo .. OrdKeyNo ( In case of ADO AbsolutePosition )
aHeaders.. Array of Headers
aOriginals Array of Values of columns at the time of creation of the object
Values of this array may not be changed by the programmer directly aValues .. Array of Values ., These values can be changed / edited in dialog
bSave .. User provided optional codeblock, which is evaluated with oBrw as parameter while executing the Save method
METHODS:
1. Modified() . Returns .t. if the data is edited / changed. This can be used for enabling or disabling Save / Undo buttons.
2. Undo() .. Copies original values to aValues, undoing any edit / changes to values
3. Save() .. Repositions the data source to nRecNo, if necessary, and saves modified data. For saving data, this method compares the edited values with the originals and evaluates bOnPostEdit block if defined and
if bOnPostEdit is nil, evaluates bEditValue ( in case this is a setget block ) only for the changed values. After evaluating for each column, the bSave codeblock is evaluated if provided, where the user can specify any other logic. Since this method saves data only if different from the original values and only the changed values, the programmer need not include logic to check if the data is edited.
Locking and unlocking is automatically taken care by evaluating oBrw:bLock and oBrw:bUnlock data.
The purpose of this method is to provide data of the browse for editing in dialogs, which will not change even in the rare circumstances of the browse getting refreshed due to unexpected reasons.
This object can not be directly created by the user, since the class is declared static to xbrowse.prg. It is not also desirable.
4) Displaying xBrowse without defining any columns was resulting in runtime error. Now in such cases, one blank column displayed, avoiding runtime error.
5) Improvements to SetODbf():
(a) New 4th parameter lAutoCols, defaults to .f. f the object has data cAlias and nArea or oRs or oRecSet, lAutoCols can be used optionally to add all column data automatically to the browse.
(b) If the data object has defined methods 'KeyNo', 'KeyGoTo', 'KeyCount', these methods are used for browse navigation consistant with SetRDD and SetADO methods. Revised TDataBase class maps these methods to OrdKeyNo,
OrdKeyGoTo and OrdKeyCount. In case of DataClasses for ADO RecordSets, defining the 'Key' methods to be based on AbsolutePosition and 'Rec' methods to be based on BookMark give the proper results for browse.
6) XBrowse function Improvements:
XBrowse function works as Quick XBrowse of any datasource. By using the third paramter bSetUp, full power of xBrowse can be exploited. Syntax:
XBrowse( [uData], [cTitle], [lAutoSort], [bSetUp], [bSelect] )
(a) Now XBrowse function works with TDatabase ( or similar objects ) also.
(b) By default XBrowse function provides three buttons Print, Excel and Close. If a fifth parameter bSelect is specified, 'Select' button also is displayed and when pressed bSelect codeblock is evaluated with oBrw and SelectedCol as parameters. This is useful to make Quick Pick Lists from any datasource.
* New: Class TTreeItem: New data bAction added. Now the action defined by TREEITEM command is assigned to this data.
* Fix: Class TTimePick now displays Time properly and returns correctly formatted time value.
* New: XBROWSE Commands:
1. @ 0,0 XBROWSE and REDEFINE XBROWSE:
Now list of columns, fields, headers, etc. can also be specified as arrays in line or array variables can be used. Example:
REDEFINE XBROWSE <clauses> HEADERS 'First', 'Last', ....
can also be written as
REDEFINE XBROWSE <clauses> HEADERS aHdrs .... ( where aHdrs := { 'First', 'Last', .... } )
This applies to all lists in xbrowse creation commands.
2. New command: XBROWSER
Very quick way to create xbrowse of any data and picklists. This is the command syntax using the XBrowse( ... ) function. This command automatically creates appropriate dialog and presents the fully functional browse.
Syntax:
XBROWSER [ <cAlias>/<oDbf>/<oRs>/<aArray> ] ; // defaults to active alias
[ TITLE <cTitle> ] ;
[ AUTOSORT ] ; // default false
[ SETUP <fnSetUp(oBrw)> ] ; // optional function for user specified setup
[ COLUMNS <listof columns> ] ; // optionally specify columns to be shown
[ SELECT <fnSelect(oBrw,oCol)> ] // optional function for pick lists
Examples:
1. Use Sales
XBROWSER // shows xbrowse of Sales table in a dialog
or
XBROWSER 'Sales'
2. Use Customer
DATABASE oDbf
XBROWSER oDbf TITLE 'Customers' ;
SETUP oBrw:SetBackGround( '\fwh\bitmaps\backgrnd\beige2.bmp' ) ;
COLUMNS 'State', 'City', 'First'
3. To create a quick pick list
USE States
XBROWSER TITLE 'Select State' SELECT cState := Field->State
or
States->( XBrowse( , 'Select State', , , , { || cState := States->State } ) )
This creates a browse of States.dbf and presents in a dialog sized to fit the width of browse at the center of the screen, with buttons 'Select' and 'Close'. Click on 'Select' button evaluates the bSelect codeblock.
* New: functions nRGBReset( nClr, nRed, nGreen, nBlue ) and nRGBAdd( nClr, nRed, nGreen, nBlue ) New colors can be derived from existing colors by chaging or modifiying individual color components.
* Enhancement: Improved cGenPrg() methods in TFont and TBrush.
* New: cClrtoChar( uClr ) this function accepts any color constant, color pair array, array of color gradient or codeblock evaluating to any of the above and generates compilable code.
===========
* Fix: Class TDbCombo minor change in Method KeyChar().
* New: An interesting example showing how to manage a non modal dialogbox from a Tree. Please review samples\TestTre4.prg
* New: An interesting example showing how to dinamically change the alias of a xbrowse in runtime. Please review samples\XBrwAlias.prg.
* New: An interesting example showing how to use a folder with two XBrowses working on arrays, with different editing capabilities in each one. Please review samples\FoldXBrw.prg.
* New: FWPPC, Class TControl Method GetDlgCode(). Now controls can set its DATA nDlgCode and its properly processed, the same way as in FWH.
* New: FWPPC: OleAuto support is already available for FiveWin for Pocket PC. You can use CreateObject() or TOleAuto():New().
* Enhancement: Class TXBrowse Method KeyDown() and KeyChar() have been modified so pressing escape will cancel a current editing operation but will not close the container dialog.
* New function SetDialogEsc( lOnOff ) lets you control if your applications dialogs could be closed pressing ESC. FiveWin allows this behavior by default. In case that you want to change it, simply call SetDialogEsc( .F. ) from the beginning of your application. SetDialogEsc() also returns the
previous state, so you can store it and change it dynamically along the execution of your application.
* New: An interesting example showing how to build a values inspector using a TXBrowse object. Please review samples\Inspect.prg
* New: Class TComboBox DATA lIncSearch, false by default, lets use or not the incremental search. When lIncSearch is .F., then Class TComboBox uses Windows API standard behavior.
* New: New clauses ACTION ... [ BITMAP ... ] for GETs. FiveWin automatically creates a themed button on the GET which fires an ACTION, and you can change the GET contents from it too. Please review samples\getbtn.prg and getbtnr.prg. No need to change your current resources files!
* New: REDEFINE SAY ... TRANSPARENT already available. No need to declare a variable to hold the SAY object to set its transparency.
* New: A new example showing how to use gradient colors with dialogs and folders. Please review samples\FoldGrad.prg
* New: In the folder FWH\UEStudio we have included the config file to build applications using xHarbour and FWH. Previously only Harbour config file was provided.
* Fix: Class TButton Method Click() was not properly setting the focus before to executing its action.
* New: font.ch, added STRIKEOUT clause for creation of fonts
* New: font.prg new Methods: Bold( lOnOff ), Italic( lOnOff ), UnderLine( lOnOff ), StrikeOff( lOnOff ), Escapement( nNew ), Rotate( nRotateBy ), Modify( lBold, lItalic, lUnderline, lStrikeOut, nNewEsc ) return new font object with the modification.
Example:
DEFINE FONT oFont NAME 'ARIAL' SIZE 0,-10
oFontB := oFont:Bold() // defaults to .t.
oFontS := oFont:StrikeOut( .t. )
oFontLeft := oFont:Escapement( 2700 )
oFont2 := oFont:Rotate( 900 )
Overloaded "==": oFont1 == oFont2 --> .t. or .f.
* Enhancements in BUTTONBAR:
- Improvement: Bar is painted properly in 2007 style, irrespective of l3D setting.
- Fix: In 2007 style, position of buttons was shifted by 8 pixels to the right after any readjustment/relocation of the bar. Now fixed.
- Improvement: Change of gradient colors at runtime are now propagated to buttons also, unless a different gradient is assigned to the button.
* Enhancements in BTNBMP:
- New: 2007 style :Individual buttons can now be created with 2007 style. Default gradient colors can be overridden by assinging new gradient colors and can be changed at runtime.
- Bitmaps can be positioned TOP, LEFT, RIGHT, BOTTOM in 2007 style also. This works for both buttons on bars and individual buttons
* Class TDataBase:
1) Improved New( [ncArea], [cDbfFile], [cDriver], [lShared], [lReadOnly] )
TDataBase():new() or TDataBase():New( nSelectArea ) works the same way as in the earlier versions with an already open dbf.
(a) TDataBase():New( cAlias ) also works on an already open dbf.
(b) New method called with 2 or more paramters constructs the instance without opening the table. Use() method should be used to open the table.
(c) cDriver, lShared and lReadOnly default to RddSetDefault(), !Set(_SET_EXCLUSIVE) and .f.
2) New() can be called with 0 or "" as the only parameter to instantiate an object without assigning any table. Data cFile, etc. can be directly assigned and Use() can be called to open the table.
3) New Method Use() to Open table specfied with New(..) method or by directly assigning datas
4) New method Open( ... ) with the same parameters is equivalent to calling New() and use() methods. Success of opening the table can be checked with Used() method.
5) Datas cFile, lShared, lReadOnly, cDriver return the correct values if the table is opened and otherwise use the values assigned to Open the file.
6) Improved: RecLock( nRecNo ) now uses DBRLock(), to facilitate additive record locking.
7) New: RecUnLock( [nRecNo] ): If nRecNo is specified, unlocks the specified record only and otherwise unlocks all records.
New:IsRecLocked( nRecNo ): Returns true if the specifed record is locked or the tentire file is locked.
9) Delete, Recall, FieldPut, Save methods locks the record automatically if not already locked. After the action, the record is left in the original locked condition before calling the method.
10) New Methods: KeyNo, KeyGoTo( nKey ), KeyCount() are mapped to OrdkeyNo, OrdkeyGoTo, OrdkeyCount()
11) Improved: Blank(): Now uses uValBlank to improve speed.
12) Improved: DBEval() now works without having to save and restore lBuffer values.
13) New Method: RollBack(): In (x)Harbour applications, this command rollsback uncommited changes to DBF and in all cases it reloads the buffer, cancelling the changes made to the buffer (Equivalent to calling :Load() )
14) Modified(): Returns .t. only when :lBuffer is true and buffered values are different from the dbf field values
15) New Method: Updated(): Returns .t. when either Modified() is true or any dbf fields are changed but not yet committed. RollBack() can be called to restore the original record.
16) Improved: SetRelation( cnoArea, cExp, [lScoped] ). First parameter can be another tdatbase object. Added new optional parameter lScoped ( defaults to .f. )
17) SetFilter( <cFilter> )
Class TXBrowse:
1) Improved Refresh(): Now Refresh method checks if the current record is deleted and if deleted, repositions the display row to the next record. If the deleted record is the last record, the row is positioned on the last record. This applies only to RDDs. XBrowse is the only browse at present doing this automatically.
2) ReArrangeCols( aSeq, lRetainRest )
This method is useful to rearrange the order of selected columns to appear in the beginning, after creating a browse ( very likely after including all columns automatically ). if the second parameter is true ( default ) remaining columns are retained after the given sequence and otherwie the remaining columns are totally deleted.
aSeq is an array containing either Headers or Creationorder of the columns and they can be intermixed.
3) New Method: CurrentRow() returns an object containing values of the row at the time of call. Even for some unexpected reasons the browse navigates to any other row, the values returned by the object remain static. The values of the object can be accessed and assigned with the names of headers, eg: oRow:First, oRow:City, etc.
In addition, the row object provides the following data and methods:
DATA:
oBrw .. Parent XBrowse object
nRecNo .. RecordNo ( In case of ADO BookMark )
nKeyNo .. OrdKeyNo ( In case of ADO AbsolutePosition )
aHeaders.. Array of Headers
aOriginals Array of Values of columns at the time of creation of the object
Values of this array may not be changed by the programmer directly aValues .. Array of Values ., These values can be changed / edited in dialog
bSave .. User provided optional codeblock, which is evaluated with oBrw as parameter while executing the Save method
METHODS:
1. Modified() . Returns .t. if the data is edited / changed. This can be used for enabling or disabling Save / Undo buttons.
2. Undo() .. Copies original values to aValues, undoing any edit / changes to values
3. Save() .. Repositions the data source to nRecNo, if necessary, and saves modified data. For saving data, this method compares the edited values with the originals and evaluates bOnPostEdit block if defined and
if bOnPostEdit is nil, evaluates bEditValue ( in case this is a setget block ) only for the changed values. After evaluating for each column, the bSave codeblock is evaluated if provided, where the user can specify any other logic. Since this method saves data only if different from the original values and only the changed values, the programmer need not include logic to check if the data is edited.
Locking and unlocking is automatically taken care by evaluating oBrw:bLock and oBrw:bUnlock data.
The purpose of this method is to provide data of the browse for editing in dialogs, which will not change even in the rare circumstances of the browse getting refreshed due to unexpected reasons.
This object can not be directly created by the user, since the class is declared static to xbrowse.prg. It is not also desirable.
4) Displaying xBrowse without defining any columns was resulting in runtime error. Now in such cases, one blank column displayed, avoiding runtime error.
5) Improvements to SetODbf():
(a) New 4th parameter lAutoCols, defaults to .f. f the object has data cAlias and nArea or oRs or oRecSet, lAutoCols can be used optionally to add all column data automatically to the browse.
(b) If the data object has defined methods 'KeyNo', 'KeyGoTo', 'KeyCount', these methods are used for browse navigation consistant with SetRDD and SetADO methods. Revised TDataBase class maps these methods to OrdKeyNo,
OrdKeyGoTo and OrdKeyCount. In case of DataClasses for ADO RecordSets, defining the 'Key' methods to be based on AbsolutePosition and 'Rec' methods to be based on BookMark give the proper results for browse.
6) XBrowse function Improvements:
XBrowse function works as Quick XBrowse of any datasource. By using the third paramter bSetUp, full power of xBrowse can be exploited. Syntax:
XBrowse( [uData], [cTitle], [lAutoSort], [bSetUp], [bSelect] )
(a) Now XBrowse function works with TDatabase ( or similar objects ) also.
(b) By default XBrowse function provides three buttons Print, Excel and Close. If a fifth parameter bSelect is specified, 'Select' button also is displayed and when pressed bSelect codeblock is evaluated with oBrw and SelectedCol as parameters. This is useful to make Quick Pick Lists from any datasource.
* New: Class TTreeItem: New data bAction added. Now the action defined by TREEITEM command is assigned to this data.
* Fix: Class TTimePick now displays Time properly and returns correctly formatted time value.
* New: XBROWSE Commands:
1. @ 0,0 XBROWSE and REDEFINE XBROWSE:
Now list of columns, fields, headers, etc. can also be specified as arrays in line or array variables can be used. Example:
REDEFINE XBROWSE <clauses> HEADERS 'First', 'Last', ....
can also be written as
REDEFINE XBROWSE <clauses> HEADERS aHdrs .... ( where aHdrs := { 'First', 'Last', .... } )
This applies to all lists in xbrowse creation commands.
2. New command: XBROWSER
Very quick way to create xbrowse of any data and picklists. This is the command syntax using the XBrowse( ... ) function. This command automatically creates appropriate dialog and presents the fully functional browse.
Syntax:
XBROWSER [ <cAlias>/<oDbf>/<oRs>/<aArray> ] ; // defaults to active alias
[ TITLE <cTitle> ] ;
[ AUTOSORT ] ; // default false
[ SETUP <fnSetUp(oBrw)> ] ; // optional function for user specified setup
[ COLUMNS <listof columns> ] ; // optionally specify columns to be shown
[ SELECT <fnSelect(oBrw,oCol)> ] // optional function for pick lists
Examples:
1. Use Sales
XBROWSER // shows xbrowse of Sales table in a dialog
or
XBROWSER 'Sales'
2. Use Customer
DATABASE oDbf
XBROWSER oDbf TITLE 'Customers' ;
SETUP oBrw:SetBackGround( '\fwh\bitmaps\backgrnd\beige2.bmp' ) ;
COLUMNS 'State', 'City', 'First'
3. To create a quick pick list
USE States
XBROWSER TITLE 'Select State' SELECT cState := Field->State
or
States->( XBrowse( , 'Select State', , , , { || cState := States->State } ) )
This creates a browse of States.dbf and presents in a dialog sized to fit the width of browse at the center of the screen, with buttons 'Select' and 'Close'. Click on 'Select' button evaluates the bSelect codeblock.
* New: functions nRGBReset( nClr, nRed, nGreen, nBlue ) and nRGBAdd( nClr, nRed, nGreen, nBlue ) New colors can be derived from existing colors by chaging or modifiying individual color components.
* Enhancement: Improved cGenPrg() methods in TFont and TBrush.
* New: cClrtoChar( uClr ) this function accepts any color constant, color pair array, array of color gradient or codeblock evaluating to any of the above and generates compilable code.