En un xBrowse es posible tener estas tres líneas de encabezados?, como en la imagen adjunta
Gracias

estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero

function TestHeader
local oWnd, oBrw, oBold
local cAlias := cGetNewAlias( 'CUST' )
USE "..\data\CUSTOMER" NEW SHARED Alias ( cAlias )
DEFINE FONT oBold NAME 'VERDANA' SIZE 0,-14 BOLD
DEFINE WINDOW oWnd MDICHILD OF WndMain()
@ 0, 0 XBROWSE oBrw OF oWnd ;
COLUMNS 'First', 'Last', 'Street', 'City', 'State', ;
'Zip', 'HireDate', 'Married', 'Age' ;
/* HEADERS 'First' + CRLF + 'Name', 'Last' + CRLF + 'Name'*/ ;
COLSIZES 100,100,100,100 ;
ALIAS cAlias CELL LINES ;
FOOTERS AUTOSORT
WITH OBJECT oBrw
:SetGroupHeader( 'EMPLOYEE' + CRLF + 'NAME', 1, 2, oBold )
:SetGroupHeader( 'ADDRESS', 3, 6, oBold )
:SetGroupHeader( 'OTHER', 8, 9, oBold )
:Married:SetCheck()
:nStretchCol := :Street:nCreationOrder
END
AEval( oBrw:aCols, { |o| o:nHeadStrAlign := AL_CENTER } )
WITH OBJECT oBrw:aCols[ 6 ]
:AddBmpFile( '..\bitmaps\mail.bmp' )
:nGrpBmpNo := 1
END
oBrw:bRClicked := { || oBrw:SetGroupHeader( 'CITY', 5, 6, oBold ) }
oBrw:lAllowColReGroup := .t.
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd ;
ON INIT oBrw:SetFocus() ;
VALID( oBold:End(), .t. )
return nilEl componente
El mecanismo principal para múltiples cabeceras es el método
Archivo: source/classes/xbrowse.prg (L519-519)
METHOD SetGroupHeader( cGrpHdr, nFrom, nUpto, oFont, nAlign, nHeight )Este método acepta seis parámetros: el texto de la cabecera de grupo (
Archivo: whatsnew.txt (L2908-2913)
- GroupHeaders:
- When group headers are specified, oBrw:nHeaderHeight assigned by the programmer
was being ignored. Now this value is considered.
- Sixth parameter nHeight is added to method SetGroupHeader. If specified, this value
is used for the group header.Detalles de Implementación:
El sistema de cabeceras de grupo funciona mediante:
Este método detecta cambios en las cabeceras de grupo comparando la propiedad
Ejemplo de Uso:
Archivo: samples/test/testhead.prg (L51-53)
:SetGroupHeader( 'EMPLOYEE' + CRLF + 'NAME', 1, 2, oBold )
:SetGroupHeader( 'ADDRESS', 3, 6, oBold )
:SetGroupHeader( 'OTHER', 8, 9, oBold )El segundo enfoque utiliza la propiedad
Archivo: samples/test/testxbrw.prg (L230-236)
oBrw:nHeaderLines := 2
oBrw:nDataLines := 2
oBrw:SetRDD()
for nFor := 1 to Fcount()
oBrw:aCols[ nFor ]:cHeader := "Field: " + ltrim( str( nFor ) ) + CRLF + FieldName( nFor )
nextCuando
Archivo: source/classes/xbrowse.prg (L1850-1928)
METHOD CalcHdrHeight() CLASS TXBrowse
local nFor, nLen, nCol, oCol, nHeight
local cGrpHdr
local aGroup
if HB_ISNUMERIC( ::nHeaderHeight ) .and. ::nHeaderHeight < 1
::nHeaderHeight := 1
endif
if ::lHeader //.and. ::nHeaderHeight == nil
nLen := Len( ::aCols )
nHeight := 0
::aHeaderTop := {}
if ::lGrpHeader == nil
::lGrpHeader := .f.
for nFor := 1 to nLen
if ! Empty( ::aCols[ nFor ]:cGrpHdr )
::lGrpHeader := .t.
endif
next
endif
if ::lGrpHeader .or. ::nHeaderHeight == nil
if ::lGrpHeader
nHeight := 0
for nFor := 1 to nLen
oCol := ::aCols[ nFor ]
if oCol:cGrpHdr != cGrpHdr
if aGroup != nil
AAdd( ::aHeaderTop, aGroup )
for nCol := aGroup[ 3 ] to aGroup[ 4 ]
::aCols[ nCol ]:nGrpHeight := aGroup[ 5 ]
next
aGroup := nil
endif
cGrpHdr := oCol:cGrpHdr
if ! Empty( oCol:cGrpHdr )
// new group starts
aGroup := { oCol:cGrpHdr, oCol, nFor, nFor, oCol:HeaderHeight( .t. ), ;
oCol:aBitmap( oCol:nGrpBmpNo ) }
endif
else
// same group or nogroup
if ! Empty( oCol:cGrpHdr )
aGroup[ 2 ] := oCol
aGroup[ 4 ] := nFor
aGroup[ 5 ] := Max( aGroup[ 5 ], oCol:HeaderHeight( .t. ) )
if ! Empty( oCol:nGrpBmpNo )
aGroup[ 6 ] := oCol:aBitmap( oCol:nGrpBmpNo )
endif
endif
endif
next
if aGroup != nil
AAdd( ::aHeaderTop, aGroup )
for nCol := aGroup[ 3 ] to aGroup[ 4 ]
::aCols[ nCol ]:nGrpHeight := aGroup[ 5 ]
next
aGroup := nil
endif
endif
for nFor := 1 to nLen
nHeight := Max( nHeight, ::aCols[ nFor ]:HeaderHeight() )
next
// DEFAULT ::nGetBarHeight := FontHeight( Self, IfNil( ::oFont, ::oWnd:oFont ) ) + 8
if ::nHeaderLines > 1
nHeight := Max( nHeight, FontHeight( Self, ::oWnd:oFont ) * ::nHeaderLines )
endif
nHeight := nHeight + ROW_EXTRAHEIGHT + 3 // lines to give 3d look
if ::nHeaderHeight != nil
nHeight := Max( ::nHeaderHeight, nHeight )
endif
::nHeaderHeight := nHeight
endif
endif
return ::nHeaderHeightde cosas que se entera uno y no sabemos
gracias Maestro Linares :D
Maestro Antonio:
Revise tus sugerencia pero seguramente no las entendí, lo que busco son tres líneas de encabezado
SuperGroupHeader() GroupHeader() Header()
Las dos últimas líneas las tengo claras de como definirlas pero me falta el SuperGroupHeader que abarque dos o mas GroupHeader
Espero haberme dado a entender
Saludos
Armando,
headers.prg
#include "FiveWin.ch"
function Main()
local aData := { { 10000, 235000, 90, 2115 } }
XBROWSER aData SETUP BrwSetup( oBrw )
return nil
function BrwSetup( oBrw )
oBrw:SetGroupHeader( 'DIESSEL' + CRLF + "COMPRAS" + Space( 28 ) + "CONSUMOS", 1, 4 )
oBrw:aCols[ 1 ]:cHeader = "Litros"
oBrw:aCols[ 2 ]:cHeader = "Importe"
oBrw:aCols[ 3 ]:cHeader = "Litros"
oBrw:aCols[ 4 ]:cHeader = "Importe"
return nil
Master:
Excelente !, lo voy a probar.
Muchas gracias