FUNCION XEDIT DE FWH

FUNCION XEDIT DE FWH

Postby jose_murugosa » Wed Feb 03, 2021 3:50 pm

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
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1144
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: FUNCION XEDIT DE FWH

Postby Antonio Linares » Thu Feb 04, 2021 8:05 am

José,

Revisa FWH\source\classes\datarow.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FUNCION XEDIT DE FWH

Postby jose_murugosa » Thu Feb 04, 2021 10:51 am

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..
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1144
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: FUNCION XEDIT DE FWH

Postby Antonio Linares » Thu Feb 04, 2021 10:54 am

José,

Está todo en el mismo PRG

Le comento a Rao tu sugerencia, gracias :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: FUNCION XEDIT DE FWH

Postby nageswaragunupudi » Thu Feb 04, 2021 1:30 pm

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FUNCION XEDIT DE FWH

Postby jose_murugosa » Thu Feb 04, 2021 2:05 pm

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.
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1144
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests