oGraph- how to save into bmp in silent mode

oGraph- how to save into bmp in silent mode

Postby Otto » Fri Aug 15, 2014 10:21 pm

To all,
I use xBrowse as a preview for a report.
Now I would like to print this report.
On each single line I would like to print the corresponding graph.

Does someone know how to convert oGraphs in silent mode to bmp.

Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: oGraph- how to save into bmp in silent mode

Postby rhlawek » Sat Aug 16, 2014 12:17 am

I assume you are using the TGraph() class. If so, it has a Save2Bmp() method, have you tried that? I haven't tried it but I don't see anything that make it to be not silent.

METHOD Save2Bmp( cFile ) CLASS TGraph

LOCAL hBmp, hDib
DEFAULT cFile := "TGraph.Bmp"

hBmp := WndBitmap( Self:hWnd )
hDib := DibFromBitmap( hBmp )
DibWrite( cFile, hDib )
GloBalFree( hDib )
DeleteObject( hBmp )

RETURN ( FILE( cFile ) )

Best regards,

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: oGraph- how to save into bmp in silent mode

Postby Otto » Sat Aug 16, 2014 6:25 pm

Hello Robb,
thank you for your help.
The method is working.
After a long time I am using again ER.
I have to re-learn the handling and find a workflow for me.
I have also to look into the paint method of oGraph to reduce the margin.
The margin around the graphs consume to much space.
Thanks again and best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: oGraph- how to save into bmp in silent mode

Postby Otto » Sat Aug 16, 2014 6:29 pm

This is the source code for calling the Report:

Code: Select all  Expand view  RUN

function printMonatsvgl()
   local oVRD
   local cBmp := ""
   local I := 0
   *----------------------------------------------------------

   EASYREPORT oVRD NAME ".\xVRD\EasyReportExample1.vrd" //;
   //   PREVIEW lPreview TO cPrinter   PRINTDIALOG IIF( lPreview, .F., .F. )

   IF oVRD:lDialogCancel = .T.
      RETURN( .F. )
   ENDIF

   select jahresvgl
   go top
   do while .not. eof()
      I:= I + 1
      PRINTAREA 2 OF oVRD
      cbmp := "BMP" + ALLTRIM(STR(I))+".bmp"

      if I > 12

         IF oVRD:nNextRow > oVRD:nPageBreak
            PAGEBREAK oVRD
            //        PRINTAREA 2 OF oVRD
         ENDIF

         PRINTAREA 4 OF oVRD;
            ITEMIDS    { 100,110,120,130,140,150,160,170 } ;
            ITEMVALUES {  jahresvgl->MONAT    ,;
            transform(jahresvgl->JAHR      , "@E 9999,999" ),;
            transform(jahresvgl->DIFF_J_1   , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS1 , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS2 , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS3 , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS4 , "@E 9999,999" ), cbmp }

      else
         PRINTAREA 3 OF oVRD;
            ITEMIDS    { 100,110,120,130,140,150,160,170 } ;
            ITEMVALUES {  jahresvgl->MONAT    ,;
            transform(jahresvgl->JAHR      , "@E 9999,999" ),;
            transform(jahresvgl->DIFF_J_1   , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS1 , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS2 , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS3 , "@E 9999,999" ),;
            transform(jahresvgl->JAHRMINUS4 , "@E 9999,999" ), cbmp }

      endif

      skip
   enddo

   oVRD:End()

   select jahresvgl
   go top
return nil
//----------------------------------------------------------------------------//

 


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: oGraph- how to save into bmp in silent mode

Postby Otto » Sat Aug 16, 2014 6:56 pm

Hello,
please see how nice xBrowse and EasyReport are working.
Frist you see a report-live-preview. The user can add and delete subtotals wherever you need in your report.
Then you can print the report including the graphs.

Best regards,
Otto

VIDEO
http://www.atzwanger-software.com/fw/Jahrsvergleich.mp4
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: oGraph- how to save into bmp in silent mode

Postby mgsoft » Sat Aug 16, 2014 7:01 pm

Otto

In the spanish section of Easyreport forum they're making great progress and building an awesome product.
Saludos,

Eduardo
User avatar
mgsoft
 
Posts: 422
Joined: Mon Aug 17, 2009 12:18 pm
Location: España

Re: oGraph- how to save into bmp in silent mode

Postby leandro » Tue Feb 09, 2016 6:54 pm

Otto Good afternoon, thing is, I need to create graphics in silent mode and then print a report on EasyReport , by chance you have an example of how. I'm using the tgraph .

At this point I think a dialogue to show the image, but it only works when the dialog is closed.
This is the function .

Cheers

Code: Select all  Expand view  RUN

*********************************************
**esta funcion genera el bmp con los consumos
*********************************************
FUNCTION creabmp(vMan,vLot,vPer)

LOCAL oGraph ,aCan:={} ,aDia:={}
Local vRuta:=alltrim(vMan)+"-"+alltrim(vLot)+"-"+alltrim(vPer)
DEFINE DIALOG oDlg SIZE 600, 500
   
for n := 1 to 5
  AAdd(aDia,"mes"+Str(n))
  AAdd(aCan,n)
next    
   
@ 1, 1 GRAPH oGraph SIZE 250, 200 TYPE 1 XVALUES YVALUES 3D XGRID YGRID //LEGENDS
   
  oGraph:cTitX   :="Consumo Manzana"+alltrim(vMan)+" - Lote:"+alltrim(vLot)
  oGraph:cTitY   :="Meses"
  oGraph:lPopUp  :=.F.
  oGraph:nClrX = CLR_GREEN
  oGraph:nClrY = CLR_RED
  oGraph:AddSerie(aCan,"",RGB(128,128,255))
   
ACTIVATE DIALOG oDlg CENTER VALID (oGraph:save2bmp("c:\cartera\pictures\"+vRuta+".bmp"),.T.)

RETURN NIL
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1688
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: oGraph- how to save into bmp in silent mode

Postby James Bott » Tue Feb 09, 2016 9:21 pm

Otto,

I am not sure exactly what you are trying to do, but if you need to draw the graph, then save it to a bitmap, then you probably can draw it on an invisible window or dialog, then save it and end the window or dialog.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests