James Bott wrote:Rao,
If we use the syntax, XBROWSE .... COLUMNS 'col1', 'col2' ... ALIAS <calias> or OBJECT <dataobj>,
Can you explain in more detail about using the OBJECT clause, perhaps by providing an example. I am particularly wondering about how you would specify only some fields--not all fields.
James
\fwh\samples\testxbr3.prg has two samples of using TDataBase object also. This program has samples for RDD, RecordSets, Trees, Arrays, Hashes, etc.
Here is a simplified sample using TDataBase object. Please compile and test this sample as it is and then try changing TDataBase to TData. I expect the same results:
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
REQUEST DBFCDX
function Main()
local oDbf, oDlg, oBrw
SET DATE ITALIAN
SET CENTURY ON
SET TIME FORMAT TO 'HH:MM:SS'
RDDSetDefault( 'DBFCDX' )
oDbf := TDataBase():Open( , 'CUSTOMER' )
oDbf:SetOrder( 'FIRST' )
DEFINE DIALOG oDlg SIZE 550,400 PIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
COLUMNS 'First', 'Married', 'HireDate', 'Salary', 'Age' ;
OBJECT oDbf ;
AUTOSORT CELL LINES NOBORDER
oBrw:Married:SetCheck()
oBrw:nStretchCol := 1
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
oDbf:Close()
return nil
I think TData class has a DATA aStruct, which is similar to DbStruct. If so, xBrowse ascertains the datatypes from oDbf:aStruct and if not, makes best guess by examining the ValType of the expressions.
If Mr. Tim is using TData class, he may try this sample with TData class. This example shows HireDate as Date but not as DateTime, because the fieldtype is 'D' and not 'T' or '@'.
