The Initiate method of xBrowse executes SetRDD, because nDataType is DATATYPE_RDD, though SetArray or SetADO is already used. Execution of SetRDD in such cases is not necessary and seems logically not so appropriate, though SetRDD does not disturb the existing assignments of codeblocks. The relevant part of the Initiate method is given below
- Code: Select all Expand view
do case
case ::nDataType == DATATYPE_RDD
::SetRDD()
otherwise
MsgStop("Data type not supported", "TXBrowse class")
end case
I may be wrong, but it is possible that this was the code written in the initial stages of development before methods like SetArray / SetAdo were incorporated. Programmers can use xBrowse even for other data sources like TData / TDatabase or any data source for that matter.
Keeping this in view, it is suggested for consideration that the above lines in the initiate method may be changed as :
- Code: Select all Expand view
if ::nDataType == DATATYPE_RDD
::SetRDD()
endif
The defines for DATATYPE_RDD and DATATYPE_ARRAY already exist in the xbrowse.prg.
New defines :
#define DATATYPE_ADO 2
#define DATATYPE_USER 9
can be added and SetArray can assign ::nDataType := DATAYPE_ARRAY and SetAdo can assign ::nDataType := DATATYPE_ADO.
This will also help the application program to retrieve the value of ::nDataType for meaningful use as may be appropriate.