FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour GRAPHPRN
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
GRAPHPRN
Posted: Fri Oct 28, 2022 01:00 AM
Saludos

haciendo pruebas con la nueva funcionalidad de impresión directa de graficas

compilo el programa graphprn.prg

si utilizo el tipo de grafica PIE me manda error
Code (fw): Select all Collapse
function Main()

   local oGraph, oPrn, aTable, cRegion

   CreateDBF()

   USE GRAFDATA NEW VIA "DBFCDX"
   SET ORDER TO TAG MAIN
   GO TOP

   DEFINE GRAPH oGraph SIZE 250, 200 TYPE GRAPH_TYPE_PIE ;
      YVALUES XGRID YGRID XVALUES LEGENDS

   WITH OBJECT oGraph
      :aSeries = { { "DeskTop", METRO_AMBER  }, ;
                   { "Lap-Top", METRO_OLIVE  }, ;
                   { "Printer", CLR_HMAGENTA } }
      :aYVals = { "Jan", "Feb", "Mar", "Apr", "May" }
      :lViewSRLegend = .T.
      :cTitle := "ABC COMPANY"
   END

   PRINT oPrn PREVIEW

   for each cRegion in { "NORTH", "SOUTH" }

      oGraph:aData   := FW_DbfToArray( "JAN,FEB,MAR,APR,MAY", { || FIELD->REGION = cRegion } )
      oGraph:cTitle  := "ABC COMPANY, " + cRegion + " REGION"

      PAGE

      @ 1, 1   PRINT TO oPrn GRAPH oGraph SIZE 5,4 INCHES
      @ 5, 1   PRINT TO oPrn TABLE oGraph:aTable SIZE 5, 2 INCHES
      @ 7, 1.5 PRINT TO oPrn CHART oGraph:aTable SIZE 4, 3 INCHES

      ENDPAGE

   next

   ENDPRINT

   oGraph:End()
   CLOSE DATA

return nil

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

static function CreateDBF()

   field REGION, PRODUCT

   local aData := ;
   {  { "NORTH", "DeskTop", 14280, 20420, 12870, 25347,  7640 } ;
   ,  { "NORTH", "Lap-Top",  8350, 10315, 15870,  5347, 12340 } ;
   ,  { "NORTH", "Printer", 12345,  8945, 10560, 15600, 17610 } ;
   ,  { "SOUTH", "DeskTop", 12345,  8945, 10560, 15600, 17610 } ;
   ,  { "SOUTH", "Lap-Top", 14280, 20420, 12870, 25347,  7640 } ;
   ,  { "SOUTH", "Printer",  8350, 10315, 15870,  5347, 12340 } ;
   }

   DBCREATE( "GRAFDATA", { { "REGION", "C", 5, 0 }, { "PRODUCT", "C", 7, 0 }, ;
      { "JAN", "N", 5, 0 }, { "FEB", "N", 5, 0 }, { "MAR", "N", 5, 0 }, ;
      { "APR", "N", 5, 0 }, { "MAY", "N", 5, 0 } }, "DBFCDX", .T., "DATA" )

  FW_ArrayToDBF( aData )

  GO TOP
  INDEX ON REGION+PRODUCT TAG MAIN
  CLOSE DATA

return nil

//----------------------------------------------------------------------------//
Error description: Error BASE/1004 Class: 'NIL' has no exported method: GETDC
Args:
[ 1] = U

Stack Calls
===========
Called from: => GETDC( 0 )
Called from: .\source\classes\TGRAPH.PRG => TGRAPH:DRAWPIE( 2194 )
Called from: .\source\classes\TGRAPH.PRG => TGRAPH:PAINT( 970 )
Called from: .\source\classes\TGRAPH.PRG => TGRAPH:PRINT( 2355 )
Called from: .\source\classes\PRINTER.PRG => TPRINTER:PRINTGRAPH( 1286 )
Called from: GP3.prg => MAIN( 44 )
Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: GRAPHPRN
Posted: Tue Nov 08, 2022 04:45 AM
We are sorry. There is a bug in TGraph.prg while printing PIE chart directly to printer. Painting on screen works well.

We suggest the fix here. You may apply this fix to tgraph.prg.

Line 2194 in the Method DrawPie() of TGraph.prg:
Existing code:
Code (fw): Select all Collapse
hMemCDC := ::oWnd:GetDC()
Substitute with this revised code:
Code (fw): Select all Collapse
hMemCDC := If( ::oWnd == nil, GetDC( 0 ), ::oWnd:GetDC() )
Next, go to line 2198.
Existing code:
Code (fw): Select all Collapse
::oWnd:ReleaseDC()
Substitute with this revised code:
Code (fw): Select all Collapse
if ::oWnd == nil; ReleaseDC( 0, hMemCDC ); else; ::oWnd:ReleaseDC(); endif
With this change your program works.
We would be glad if you apply the fix and confirm its working.
Regards



G. N. Rao.

Hyderabad, India
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: GRAPHPRN
Posted: Tue Nov 08, 2022 08:38 PM

gracias

sí funcionó!

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: GRAPHPRN
Posted: Wed Nov 09, 2022 12:00 AM

Thanks for your confirmation.

This fix is included for the next release.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion