Please see fwh\source\classes\datarow.prg.
- Code: Select all Expand view
function XEdit( uSource, cFieldList, lNew )
return FW_Record():New( uSource, cFieldList, lNew ):Edit()
function xEdit() is a quick way to call FW_Record():New(...):Edit()
Params:
1) uSource (optional): Defaults to the selected alias()
Values can be Alias name, ADO RecordSet object, FWH Maria RowSet, Dolphin Query, xBrowse Object, Array, Hash.
2) cFieldList (optional): Defaults to all fields.
3) lAppend: (optional)
efaults to current record.
FW_Record and TDataRow are two names of the same class.
oRec := FW_Record():New(...) is identical to
oRec := TDataRow():New(...)
Datarow.prg contains full code of the class. You may study. Actually without programmers knowledge, xbrowse internall uses this class for editing records.
FW_Record/TDataRow class has many features and you will know when you study the entire source.
Sample program: Build and run in \fwh\samples folder:
- Code: Select all Expand view
function TestDataRow
local oCn, oRs, oRec, aStates
USE STATES
aStates := FW_DbfToArray()
CLOSE STATES
oCn := FW_OpenAdoConnection( "xbrtest.mdb" )
oRs := FW_OpenRecordSet( oCn, "SELECT ID,FIRST,LAST,CITY,STATE FROM CUSTOMER" )
oRec := FW_Record():New( oRs )
oRec:Edit()
oRec:SetPrompt( { { "first", "Name" }, { "Last", "Surname" }, ;
{ "CITY", "City" }, { "State", "State Name" } } )
oRec:Edit()
oRec:FieldCbxItems( "state", aStates )
oRec:Edit()
oRs:Close()
oCn:Close()
return nil
What you are asking is achieved by using oRec:SetPrompt( aPrompts )
- Code: Select all Expand view
oRec:SetPrompt( { { "first", "Name" }, { "Last", "Surname" }, ;
{ "CITY", "City" }, { "State", "State Name" } } )
Among many other things, you can have comboboxes like this:
- Code: Select all Expand view
oRec:FieldCbxItems( "state", aStates )
You will find many other featues, if you keep exploring.
Please also note that the dialog is made on scroll panel and therefore there is no limit for the number of fields.
This dialog also provides for navigation of the database.