column to print

column to print

Postby Silvio.Falconi » Sun Mar 19, 2023 11:20 am

Rao sad me to make to print and select columns

Code: Select all  Expand view  RUN

aCols := { "CITY", "FIRST", "ZIP" }
cSave := oBrw:SaveState()
oBrw:ReArrangeCols( aCols )
oBrw:Report()
oBrw:RestoreState( cSave )
oBrw:Refresh()
 


Instead oBrw:Report() I wish use my function because on my function run good shadow with pijama effect

Code: Select all  Expand view  RUN

STATIC FUNCTION Reporte(oBrw,aColumns)
LOCAL oRep, oFont, oFont1, oFontCopy
DEFINE FONT oFont   NAME "ARIAL"       SIZE 0,-9
DEFINE FONT oFont1  NAME "CALIBRI"     SIZE 0,-9 BOLD
oBrw:GoTop()
REPORT oRep TITLE "Customers";
       FONT  oFont,oFont1;
       HEADER "Report of Customers "  CENTER ;
       FOOTER "Hoja:" + STR(oRep:npage,3) ,"Fecha:"+DTOC(DATE()) CENTER;
       PREVIEW CAPTION  "Customers"

COLUMN TITLE "First"      DATA oBrw:oDbf:first    SIZE 15 FONT 1 SHADOW
COLUMN TITLE "Last"       DATA oBrw:oDbf:last     SIZE 15 FONT 1 SHADOW
COLUMN TITLE "City"       DATA oBrw:oDbf:city     SIZE 10 FONT 1 SHADOW
COLUMN TITLE "State"      DATA oBrw:oDbf:state    SIZE 06 FONT 2 SHADOW

// Digo que el titulo lo escriba con al letra 2
oRep:oShdBrush := TBrush():New(,nRgb(219,229,241))
oRep:oTitle:aFont[1] := {|| 2 }
oRep:bInit := {|| oBrw:oDbf:GoTop()}
oRep:bSkip := {|| (IF(!oBrw:oDbf:Eof(),oBrw:oDbf:Skip(),nil),IF(oRep:nCounter % 2 =1 , oRep:lShadow :=.f.,oRep:lShadow :=.t.))}

END REPORT
ACTIVATE REPORT oRep WHILE !oBrw:oDbf:Eof() ;
  ON ENDPAGE ( oRep:oTitle := TrLine():New({}),;
   oRep:nTitleRow := oRep:oHeader:nHeight + oRep:nTopMargin )
RETURN nil



but it run al column and not that selected ,how I can resolve it ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: column to print

Postby nageswaragunupudi » Sun Mar 19, 2023 4:08 pm

Code: Select all  Expand view  RUN
aCols := { "CITY", "FIRST", "ZIP" }
Reporte( oBrw, aCols )
 
Regards

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

Re: column to print

Postby Silvio.Falconi » Mon Mar 20, 2023 8:39 am

nageswaragunupudi wrote:
Code: Select all  Expand view  RUN
aCols := { "CITY", "FIRST", "ZIP" }
Reporte( oBrw, aCols )
 


Not run ok

I use your function to select columns ( do you remeber it ?)

all source code

Code: Select all  Expand view  RUN

 
#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"
#include "report.ch"

function Main()

   local oDlg, oBrw, oFont

 

       oDbf:=Tdatabase():Open(,"customer" ,"DBFCDX", .t.)
       oDbf:setorder(1)
       oDbf:Gotop()

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -14

   DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
      FONT oFont TITLE 'XBrowse test print column'

   @ 10, 10 XBROWSE oBrw OF oDlg SIZE 300, 160 PIXEL ;
      AUTOCOLS ALIAS oDbf NOBORDER

   oBrw:nMarqueeStyle    = MARQSTYLE_HIGHLWIN7
   oBrw:SetMultiSelectCol()
   oBrw:CreateFromCode()

   @ 200, 10 BUTTON "PRINT" SIZE 45,12 PIXEL OF oDlg ;
   ACTION OptionPrint(oBrw)

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil
//--------------------------------------------------------------------//

function OptionPrint( oBrowse)
       local aCols    := {}
       local oDlgOptions,oBarOption,oIcon
       local oFont,oBold
       local oBrw
       local cTitle:="Columns to Print"


       local  nBottom   := 20
       local  nRight    := 40
       local  nWd       := Max( nRight * DLG_CHARPIX_W, 180 )
       local  nHt       := nBottom * DLG_CHARPIX_H



       * ORIGINAL
       *AEval( oBrowse:aCols, { |o,i| AAdd( aCols, { o:cHeader,i, !o:lHide } ) } )

       // TOGGLE COLUMN FOR :SetMultiSelectCol()
       AEval( oBrowse:aCols, { |o,i| AAdd( aCols, { If(empty(o:cHeader),"Col-" + cValToChar( i ),o:cHeader),;
                            i, !o:lHide } ) } )

       DEFINE ICON oIcon RESOURCE "ICON1"
       DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
       DEFINE FONT oBold  NAME 'Tahoma' SIZE 0, -14 BOLD


       DEFINE DIALOG oDlgOptions SIZE nWd, nHt PIXEL TRUEPIXEL ;
       TITLE cTitle COLOR CLR_BLACK,RGB( 245,245,235) ICON oIcon
       oDlgOptions:lHelpIcon := .F.
       oDlgOptions:nStyle    := nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION,WS_SYSMENU,WS_MINIMIZEBOX )


       DEFINE BUTTONBAR oBarOptions OF oDlgOptions SIZE 64,70 2015 BOTTOM
       DEFINE BUTTON OF oBarOptions PROMPT "Annulla"  ;
                      FILE "DLG_NO"  ;
                      ACTION ( oDlgOptions:end( IDCANCEL ) )

       DEFINE BUTTON OF oBarOptions PROMPT "Conferma" ;
               RESOURCE "DLG_OK"  BTNRIGHT;
            ACTION ( aCols := {}, ;
                     AEval( oBrw:aArrayData, { |a| If( a[ 3 ], AAdd( aCols, oBrowse:aCols[ a[ 2 ] ] ), nil ) } ), ;
                     oDlgOptions:end( IDOK ) )

         oBarOptions:bClrGrad := { | lPressed | If( ! lPressed,;
                 { { 1, RGB( 250,250,245), RGB( 250,250,245)} },;
                 { { 1, RGB( 245,245,235), RGB( 245,245,235)} } ) }

       @ 10,10 XBROWSE oBrw SIZE -10,-110 PIXEL OF oDlgOptions ;
          DATASOURCE aCols ;
          COLUMNS 1,2,3 ;
          HEADERS "Column","No","" ;
          COLSIZES 100, 40, 40 ;
           NOBORDER  FONT oFONT


       WITH OBJECT oBrw
          :lHScroll:=.f.
          :lDrawBorder := .t.

          WITH OBJECT :aCols[ 3]
             :SetCheck(, .t. )
            * :nHeadBmpNo    := 2
          END
          :CreateFromCode()
       END



       oDlgOptions:bResized  := <||
       local oRect     := oDlgOptions:GetCliRect()

                    oBrw:setfocus()
                 return nil
                     >



       ACTIVATE DIALOG oDlgOptions CENTERED ;
       ON INIT (oDlgOptions:resize(), ;
                 ChangeButtons( oBarOptions ))
               RELEASE oFont,oBold
       oBrowse:refresh()

       IF oDlgOptions:nresult == IDOK

          //return  aCols
           Reporte(oBrowse,aCols)

        ENDIF
        RETURN NIL
//------------------------------------------------------------------------//
function ChangeButtons( oBar )
       AEval( oBar:aControls, { | oCtrl | oCtrl:nTop += 4, oCtrl:nHeight -= 4 } )
       return .T.
//-------------------------------------------------------------------------//
STATIC FUNCTION Reporte(oBrw,aColumns)
local  oRep, oFont, oFont1, oFontCopy
DEFINE FONT oFont   NAME "ARIAL"       SIZE 0,-9
DEFINE FONT oFont1  NAME "CALIBRI"     SIZE 0,-9 BOLD




oBrw:GoTop()

REPORT oRep TITLE "Customers";
       FONT  oFont,oFont1;
       HEADER "Report of Customers "  CENTER ;
       FOOTER "Hoja:" + STR(oRep:npage,3) ,"Fecha:"+DTOC(DATE()) CENTER;
       PREVIEW CAPTION  "Customers"

COLUMN TITLE "First"      DATA oBrw:oDbf:first    SIZE 15 FONT 1 SHADOW
COLUMN TITLE "Last"       DATA oBrw:oDbf:last     SIZE 15 FONT 1 SHADOW
COLUMN TITLE "City"       DATA oBrw:oDbf:city     SIZE 10 FONT 1 SHADOW
COLUMN TITLE "State"      DATA oBrw:oDbf:state    SIZE 06 FONT 2 SHADOW


oRep:oShdBrush := TBrush():New(,nRgb(219,229,241))
oRep:oTitle:aFont[1] := {|| 2 }
oRep:bInit := {|| oBrw:oDbf:GoTop()}
oRep:bSkip := {|| (IF(!oBrw:oDbf:Eof(),oBrw:oDbf:Skip(),nil),IF(oRep:nCounter % 2 =1 , oRep:lShadow :=.f.,oRep:lShadow :=.t.))}

END REPORT
ACTIVATE REPORT oRep WHILE !oBrw:oDbf:Eof() ;
  ON ENDPAGE ( oRep:oTitle := TrLine():New({}),;
  oRep:nTitleRow := oRep:oHeader:nHeight + oRep:nTopMargin )
RETURN nil
//-------------------------------------------------------------------------------------//

 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests