Superheader en xBrowse

Superheader en xBrowse

Postby César E. Lozada » Thu Jan 28, 2010 4:49 am

Hola:

No logro entender cómo son los valores de :nHeaderType para hacer un xBrowse con superheaders.

Ya leí
viewtopic.php?f=3&t=14386&p=74585&hilit=superheader#p74585
pero tampoco doy pie con bola.

¿ Alguien me echa un ancla para poner, en un browse, un superheader a las columnas 2 y 3 y otro a las columnas 4, 5 y 6 ?. Y mucho mejor si me explica aunque sea un poquito.

Gracias a todos.
User avatar
César E. Lozada
 
Posts: 128
Joined: Wed Oct 26, 2005 12:18 pm
Location: Los Teques, Miranda, Venezuela

Re: Superheader en xBrowse

Postby nageswaragunupudi » Thu Jan 28, 2010 5:22 pm

In version 9.12, GroupHeader logic is totally revised in XBrowse. From this version, defining group headers is extremely simple. Example:
Code: Select all  Expand view  RUN
oBrw:SetGroupHeader( cHeader, nFromCol, nUptoCol, [ oFont ] )
 

Here is the \fwh\samples\testhead.prg
Code: Select all  Expand view  RUN
// Class TXBrowse group headers demo

#include "FiveWin.ch"
#include "XBrowse.ch"

REQUEST DBFCDX

function main()

   local oWnd, oBar, oFont

   SET DATE ITALIAN
   SET CENTURY ON

   RDDSetDefault( 'DBFCDX' )

   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
   DEFINE WINDOW oWnd MDI ;
      TITLE "Testing GroupHeaders support for xBrowse"
   oWnd:SetFont( oFont )

   DEFINE BUTTONBAR oBar OF oWnd 2007

   DEFINE BUTTON OF oBar FILE "..\bitmaps\16x16\exit.bmp" ACTION ( oWnd:End() )
   DEFINE BUTTON OF oBar FILE "..\bitmaps\16x16\New.bmp"  ACTION ( TestHeader() )

   ACTIVATE WINDOW oWnd
   RELEASE FONT oFont

return nil

function TestHeader

   local oWnd, oBrw, oBold
   local cAlias   := cGetNewAlias( 'CUST' )

   USE 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 nil
 

Result:
Image
Supports multi-line headers, fonts and bitmaps. Even optionally supports dynamic grouping or regrouping during runtime by programmer or user.

These are the three lines defining three group headers
Code: Select all  Expand view  RUN
     :SetGroupHeader( 'EMPLOYEE' + CRLF + 'NAME',    1, 2, oBold )
      :SetGroupHeader( 'ADDRESS', 3, 6, oBold )
      :SetGroupHeader( 'OTHER',   8, 9, oBold )
 
Regards

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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 118 guests