I note that nStretchCol works well if I have to extend a column ,
but If I need to reduce doesn't work .
this is the xbgrpsum.prg adjusted that explain the problem
- Code: Select all Expand view
- #include 'fivewin.ch'
#include 'xbrowse.ch'
function Main()
local oDlg, oBrw, oFont, oBold
local aData := Array( 4, 5 )
local i, j
for i := 1 to 4
aData[ i ][ 1 ] := 'Prod-' + Chr(64+i)
for j := 2 to 5
aData[ i ][ j ] := Round( hb_Random( 100, 999 ), 2 )
next j
next i
DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
DEFINE FONT oBold NAME 'TAHOMA' SIZE 0,-12 BOLD
DEFINE DIALOG oDlg SIZE 700,300 PIXEL FONT oFont ;
TITLE 'FWH 10.4 Group Totals'
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
AUTOCOLS ;
HEADERS 'Product', 'USA', 'Canada', 'UK', 'Spain' ;
ARRAY aData CELL LINES NOBORDER FASTEDIT FOOTERS ;
AEval( oBrw:aCols, { |o| o:nEditType := EDIT_GET } )
AEval( oBrw:aCols, { |o| o:nWidth := 100 } )
WITH OBJECT oBrw
// Make Groups
:SetGroupHeader( 'Americas', 2, 3, oBold )
:SetGroupHeader( 'Europe', 4, 5, oBold )
:lAllowColReGroup := .t. // columns can be moved accross groups
// Group totals
:SetGroupTotal( 'Americas', 'Total' )
:SetGroupTotal( 'Europe', 'Total' )
// Grand Total
:SetGroupTotal( { 'Americas_Total', 'Europe_Total' }, 'Grand' + CRLF + 'Total', AGGR_SUM, oBold )
END
// Set pictures, totals in footers
AEval( oBrw:aCols, { |o| o:cEditPicture := '99,999.99', ;
o:nFooterType := AGGR_SUM, ;
o:bOnChange := { || oBrw:MakeTotals(),oBrw:RefreshFooters() } }, 2 )
oBrw:Product:cFooter := 'Total'
oBrw:nStretchCol := 1
oBrw:MakeTotals()
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont, oBold
return nil
Regards Maurizio
www.nipeservice.com