Mr leandro
If the RecSet has atleast one Row at the beginning, later even if all the rows are deleted also, the browse works well. But if we start with an empty RecordSet ( like an empty array ), the browse fails while trying to compute the datawidths.
Try writing code in the following manner. It worked for me here, with empty recordset.
- Code: Select all Expand view
DEFINE DIALOG oDlg SIZE 640,340 PIXEL
@ 10,10 XBROWSE oBrw ;
FIELDS ;
If( oRs:Eof, Space(20), oRs:Fields("First"):Value ), ;
If( oRs:Eof, Space(30), oRs:Fields("Second"):Value ) ;
HEADERS ;
"First", "Second" ;
OF oDlg SIZE 300,150 PIXEL
oBrw:SetADO( oRs )
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
Personally I use a wrapper class for recordset, which returns a equivalent blank value on eof() condition.
I guess we can improve the adogenblock to take care of eof situations. Also we can modify TXColumn's data width method not to compute datawidth if width is already specified.
We can make an improvement to the XBrowse class