Page 1 of 1

FUNCION XEDIT DE FWH

PostPosted: Wed Feb 03, 2021 3:50 pm
by jose_murugosa
Hola,

Me parece interesante el funcionamiento de la función referida.

Quisiera hacer algo similar pero pudiendo trabajar con un recorset principal que se despliega en el xedit y otros secundarios que se usan para comboboxes, así como un título
blocks de Código para antes y después de la ejecución de la función... etc.

Me interesa la forma en que xEdit() crea la ventana de datos y manipula la tabla.

¿Donde está esta función en el código disponible de FWH?

Cualquier sugerencia o ayuda es bienvenida....

Gracias

Re: FUNCION XEDIT DE FWH

PostPosted: Thu Feb 04, 2021 8:05 am
by Antonio Linares
José,

Revisa FWH\source\classes\datarow.prg

Re: FUNCION XEDIT DE FWH

PostPosted: Thu Feb 04, 2021 10:51 am
by jose_murugosa
El código de FW_Record, está disponible?

Sería interesante que manejara un array para los nombres a desplegar para los campos, a fin de que si este array contiene datos, en lugar de desplegar los nombres de los campos desplegara las descripciones de los mismos...

Una sugerencia..

Re: FUNCION XEDIT DE FWH

PostPosted: Thu Feb 04, 2021 10:54 am
by Antonio Linares
José,

Está todo en el mismo PRG

Le comento a Rao tu sugerencia, gracias :-)

Re: FUNCION XEDIT DE FWH

PostPosted: Thu Feb 04, 2021 1:30 pm
by nageswaragunupudi
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) :Defaults 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
 


Image

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" } } )
 


Image

Among many other things, you can have comboboxes like this:
Code: Select all  Expand view

   oRec:FieldCbxItems( "state", aStates )
 


Image

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.

Re: FUNCION XEDIT DE FWH

PostPosted: Thu Feb 04, 2021 2:05 pm
by jose_murugosa
Mr. Rao,

La verdad es mas potente de lo que creía, estaré investigándolo por unos días.

Muchas gracias por su ayuda y sugerencias y su excelente disposición de siempre.