Need a code block, I think.

Need a code block, I think.

Postby hag » Sat Nov 08, 2008 4:23 am

In printing an xbrowse I would like to add shadow in the column print if a certain condition exists. Need code for this.

Thanks all
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby anserkk » Sat Nov 08, 2008 4:49 am

Harvey,

You need to Pass a parameter while calling oBrw:Report()
In the below given sample a codeblock is passed to oBrw:Report() as one of the parameter which will execute your custom function to modify the Report

Code block is { |oRep, oBrw, oFont| YourFunntion( oRep, oBrw ) }

Hope the below given sample will be useful to you

Code: Select all  Expand view
oBrw:Report( 'TestReport', , , ;
      { |oRep, oBrw, oFont| MySetUp( oRep, oBrw ) } )

*-------------------------------------------*
Function MySetUp( oRep, oBrw )
*-------------------------------------------*
Local oFont,i,bTest1,bTest2,nTmpTotal:=0,nRecNo
   i:=0
   
     
   Select AcMaster_ACM
   nRecNo:=RecNo()
   
   // Custom Total
   bTest1:=dbEval( { || nTmpTotal += AcMaster_ACM->OPENINGBAL } )
   bTest2:={ || bTest1}

   Select AcMaster_ACM
   Goto nRecNo

   DEFINE FONT oFont NAME 'ARIAL NARROW' SIZE 0,-9 OF oRep:oDevice

   oRep:aFont[ 1 ]   := oFont

   // Custom Fuction to be executed at end of report
   oRep:bPostEnd :={|| TestRepEnd(oRep,i)}

   COLUMN DATA { || i++ } ;
          TITLE 'Sr#' SIZE 8 GRID

   COLUMN DATA AcMaster_ACM->Name,Group_ACM->GRNAME,'' ;
         TITLE 'Name','','' SIZE 20 GRID

   COLUMN DATA AcMaster_ACM->OPENDATE,AcMaster_ACM->AC_CATGORY ;
         TITLE 'Address','' SIZE 30

   COLUMN DATA left(AcMaster_ACM->Address,50),Substr(AcMaster_ACM->Address,51,50),'' ;
         TITLE 'Address 1','Address 2','' SIZE 20


  // Column with Shadow
   COLUMN DATA AcMaster_ACM->OPENINGBAL,'','' ;
         TITLE 'Opening','Balalnce','' SIZE 20 ;
         TOTAL bTest2 ;
         PICTURE '@CXZ ##,##,###.##' ;
         SHADOW GRID

Return .t.

*-----------------------------------------*
Function TestRepEnd(oRep,i)
*-----------------------------------------*
oRep:lGrid:=.F.
oRep:lShadow:=.F.
oRep:NewLine ()
oRep:SAY(2, "Total no of Ac heads is "+str(--i))  // 2 indicates to report column 2 AcName
oRep:NewLine()
oRep:SAY(2, "Total no of pages")
oRep:SAY(3, oRep:nPage)
RETURN NIL


Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby hag » Sat Nov 08, 2008 6:55 am

Thanks for the quick response but I should have said not printing using oBrw:report(). Using the regular method. see code

Code: Select all  Expand view
COLUMN TITLE "Account";   
DATA {|| if(gl->title == repli('-', 30), repli('_' , 30), ;
if(gl->title == repli('=', 30), repli('_', 30), ;
left(gl->title,28))) };
LEFT;   
SIZE msize2;
GRID


I want to add a shadow in the column print if a certain variable is active.
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests

cron