Necesito ejemplo xBrowse.

Necesito ejemplo xBrowse.

Postby fernandomoralesdr » Tue May 04, 2010 4:30 pm

Hola.
Necesitaria un ejemplo de definición de un xbrowse con columnas compuestas por datos de varios archivos, por ejemplo: si el archivo del xbrowse es FACTURAS:
FACTURAS->NUMERO, CLIENTES->NOMBRE, CLIENTES->PROVINCIA, FACTURAS->IMPORTE
...y de qué manera totalizar por la columna FACTURAS->IMPORTE.
También tengo una duda: ¿cuándo utilizar FIELDS y cuándo COLUMNS? En los ejemplos de FWH no lo tengo demasiado claro.
Un saludo,
Fernando Morales
Un saludo,
Fernando
Las Palmas de Gran Canaria
fernandomoralesdr
 
Posts: 139
Joined: Sun Apr 23, 2006 9:00 am

Re: Necesito ejemplo xBrowse.

Postby JavierVital » Wed May 05, 2010 3:09 am

Fernando
Yo lo hago asi :

oBrow1:aCols[03]:bStrData := {|| RetornaProvedor(COMPRAENC->PROVEDOR)}
User avatar
JavierVital
 
Posts: 105
Joined: Thu Feb 26, 2009 4:08 pm

Re: Necesito ejemplo xBrowse.

Postby nageswaragunupudi » Wed May 05, 2010 4:25 am

COLUMNS CLAUSE is a list of column names of the Alias assigned to the browse.
FIELDS clause is for any expressions. FIELDS clause is to be used for data from other related Aliases or any complext expressions.

When we want to display any field of the alias assigned to XBrowse, it is desirable to use COLUMNS clause but not FIELDS clause. When we use COLUMNS clause, XBrowse automatically reconginses fieldtype,fieldlen, fielddec and suitably decides, alignment, picture clauses and also automatically generates bOnPostEdit blocks and cSortOrder. We forgo this advantage if we use FIELDS clause or use OOPS syntax of creating columns by oBrw:AddCol(), etc. methods. We deirve the maximum power of XBrowse when we use the COMMAND syntax.

When both COLUMNS and FIELDS clauses are speicified, XBrowse places the columns first and then the fields. We can later rearrange the sequence of xbrowse columns.

Here is an example assuming 2 DBFs BILLS and CUSTOMER.


Code: Select all  Expand view

USE BILLS
USE CUSTOMER ALIAS CUST
SET ORDER TO CUSTID
SELECT BILLS
SET RELATION TO CUSTID INTO CUST

@ 10,10 XBROWSE oBrw SIZE 400,300 PIXEL OF oDlg ;
  COLUMNS 'NUMBER', 'CUSTID', 'QUANTITY', 'RATE' ;
  FIELDS CUST->CUSTNAME, CUST->STATE, BILLS->QUANTITY * BILLS->RATE ;
  HEADERS 'BillNo', 'ID', 'Quantity', 'Rate', 'Customer', 'State', 'Amount' ;
  PICTURES nil, nil, nil, nil, nil, nil, '999,999.99' ;
  ALIAS BILLS

  // we defined picture clause only for the last calculated column.
  // XBrowse automatically decides picture clauses for NUMBER,CUSTID,QUANITY and RATE
  // based on the DbStruct() of BILLS.

  oBrw:ReArrangeCols( 'BillNo', 'ID', 'Customer', 'State', 'Quantity', 'Rate', 'Amount' )
  oBrw:nStretchCol := STRETCHCOL_WIDEST

 


bStrData
FiveWin discourages use of bStrData directly. This should be left for internal use by the XBrowse column object. Instead, it is desirable to assign the codeblock to oCol:bEditValue and specify the picture in oCol:cEditPicture. Still it is a lot more advantageous to use the COMMAND syntax rather than the OOPS style.
Regards

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

Gracias por las respuestas.

Postby fernandomoralesdr » Wed May 05, 2010 6:57 am

Gracias por sus respuestas.
Bueno, con lo que me han contestado ya me voy haciendo una idea del funcionamiento porque la que he encontrado en el wiki y los ejemplos es un tanto "difusa" y no está 100% documentada. Al ser un control nuevo para mi me encuentro con mucha data y métodos nuevos.
Gracias de nuevo y un saludo,
Fernando Morales
Las Palmas de Gran Canaria
Un saludo,
Fernando
Las Palmas de Gran Canaria
fernandomoralesdr
 
Posts: 139
Joined: Sun Apr 23, 2006 9:00 am


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 27 guests