Tcalex problems

Re: Tcalex problems

Postby Silvio.Falconi » Wed Oct 18, 2017 6:01 pm

I initiated this method to print the week someone can help me to build it ?

IF oApp():oCalex:IsKindOf( "TWeekView" )
oApp():oCalex:oView:printWeek()
Endif


METHOD PrintWeek()
METHOD PrintHourHorzLines(oPrn,nTop)


not run also and I not Know How inserted the records into

Code: Select all  Expand view


METHOD PrintWeek()  CLASS TWeekView
   local oPrn, oFont,oFontDay
   local nRowStep, nColStep
   local nRow := 0, nCol := 0, n, m
   local nGridHeight
   local nGridWidth
   local aDataArea := Array( 4 )
   Local oPen
   Local dFirstDateWeek := oApp():oCalex:GetFirstDateWeek()
   Local dEndDateWeek   :=  dFirstDateWeek + 6
   local aArea := Array( 4 )


   DEFINE PEN oPen WIDTH  2
   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -90 OF oPrn
   DEFINE FONT oFontDay NAME "Ms Sans Serif" SIZE 0, -44 OF oPrn


   PRINT oPrn NAME "Print week" PREVIEW

   if Empty( oPrn:hDC )
         return nil          // Printer was not installed or ready
      endif



      nGridHeight    := oPrn:nVertRes() / 20
      nGridWidth     := oPrn:nHorzRes() / 15

      nRowStep = oPrn:nVertRes() / 20
      nColStep = oPrn:nHorzRes() / 15

      nGridHeight = nGridHeight*nColStep  / 25.4
      nGridWidth  = nGridWidth*nRowStep   / 25.4

      nHeightHeader := 120

      nModCol = nGridWidth % ::nDays


      PAGE




   aDataArea[ 1 ] := ::nTopMargin - ::nVirtualTop
   aDataArea[ 2 ] := ::nLeftMargin + ::nLeftLabelWidth +800
   aDataArea[ 3 ] := nGridHeight + ::nTopMargin - ::nVirtualTop
   aDataArea[ 4 ] := nGridWidth + ( ::nLeftMargin + ::nLeftLabelWidth )


   // Print Box around
   oPrn:Box(aDataArea[ 1 ], aDataArea[ 2 ], aDataArea[ 3], aDataArea[ 4 ], oPen  )

      nCol2Step = ( Int( nGridWidth / ::nDays ))



   //  lines

      for n = 1 to 6

     oPrn:Line( ::nTopMargin - ::nDNameHeight,;
                ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ),;
                (nGridHeight) + ::nTopMargin,;
                ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ) )
  next



    oPrn:Box( ::nTopMargin - ::nDNameHeight,;
               aDataArea[ 2 ], ;
               ::nTopMargin+nHeightHeader, ;
               aDataArea[ 4 ], ;
               oPen)





   for n = 1 to 6
     oPrn:Line(::nTopMargin - ::nDNameHeight,;
              ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ),;
              ::nTopMargin+nHeightHeader,;
              ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ) )



  next



     //Print Header

     for n = dFirstDateWeek to dEndDateWeek


         aArea[ 1 ] = ::nTopMargin - ::nDNameHeight
         aArea[ 2 ] = ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step )



        dTemp = dFirstDateWeek + n
        cText = oemtoansi(CDoW( dFirstDateWeek + n ))
        cDay = Str( Day( dFirstDateWeek + n ), 2 )


      //Display character day week


        oPrn:Say( aArea[ 1 ], aArea[ 2 ]+500, cText,  oFontDay )


      //Display numeric day

       oPrn:Say( aArea[ 1 ], aArea[ 2 ]+500, cDay,  oFontDay )


         next n




        // Print the Hour first
        ::PrintHourHorzLines(oPrn,800)



        // Print appointments




       ENDPAGE
     ENDPRINT

   RETURN nil


//--------------------------------------------------------------------------------------//

 METHOD PrintHourHorzLines(oPrn,nTop) CLASS TWeekView
   local nGridWidth,nGridHeight
   local n, nColStep, nRowStep
   local nBottom
   local aLabelArea
   local cTime := ""
   local nTime
   local oFontTime



      nGridWidth     := oPrn:nHorzRes() / 15
      nGridHeight    := oPrn:nVertRes() / 20

      nRowStep = oPrn:nVertRes() / 20
      nColStep = oPrn:nHorzRes() / 15

      nGridHeight = nGridHeight*nColStep  / 25.4
      nGridWidth  = nGridWidth*nRowStep   / 25.4



     DEFINE FONT oFontTime NAME "Ms Sans Serif" SIZE 0, -12 OF oPrn


     nRowStep   = 200

   nTime      = ::nStartHour * 100

   for n = 0 to ::nRowCount

      nTop  = ::nTopMargin + ( n * nRowStep ) - ::nVirtualTop


      //Only paint the visibles rows
      if nTop > 0 .and. nTop < nGridHeight + nRowStep

         if nTime % 100 == 0

            oPrn:Line(nTop - nRowStep,;
                    ::nLeftMargin,;
                    nTop - nRowStep,;
                    nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                    )

         //Show Left label

            aLabelArea = { ::nTopMargin + ( ( n - 1 ) * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftMargin, ::nTopMargin + ( n  * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftLabelWidth - 2 }



            cTime = ::oCalex:ConvertTime(  nTime, ::oCalex:lAmPm )
            oPrn:Say( aLabelArea[ 1 ], aLabelArea[ 2 ]+210, cTime, oFontTime )




              elseif nTime %  100 == 30

               oPrn:Line(nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth + 1,;
                    nTop - nRowStep,;
                    nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                     )

             oPrn:Line( nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth / 2,;
                    nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth - 4,;
                     )

            aLabelArea = { ::nTopMargin + ( ( n - 1 ) * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftMargin, ::nTopMargin + ( n  * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftLabelWidth - 2 }

                cTime = LEFT( ::oCalex:ConvertTime( nTime ), 5 )
                     oPrn:Say( aLabelArea[ 1 ], aLabelArea[ 2 ]+210, cTime, oFontTime )



         else
            oPrn:Line(nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth + 1,;
                    nTop - nRowStep,;
                    nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                     )

            oPrn:Line( nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth / 2,;
                    nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth - 4,;
                     )
         endif

         if n = ::nRowCount
           oPrn:Line( nTop,;
                   ::nLeftMargin,;
                   nTop,;
                   nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                    )
         endif
      endif

      nTime := ::NextInterval( nTime )

   next

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: 6765
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 6 guests