FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour tgraph problem end oDlg and print
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
tgraph problem end oDlg and print
Posted: Sat Sep 13, 2008 05:01 AM
When I x out of a graph presentation it ends the oGraph but it leaves the underlying dialog. How can I get rid of the both with one x out. Here is the code.


DEFINE DIALOG oDlg; 
   SIZE 750, 500 

   @ 1, 1 GRAPH oGraph; 
   SIZE 350, 200; 
   TYPE nType; 
  @ 15,14 say alltrim(mcompname)+"-"+cTitle  
  @ 0,01 Button "Print" action (oDlg:print()) 

  ACTIVATE DIALOG oDlg; 
  CENTER


Item 2...

I use the oDlg:print() to print the graph. Is there a way to size the print and center it on the paper. Now is very small and in the left corner of the paper.
Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
tgraph problem end oDlg and print
Posted: Sat Sep 13, 2008 07:01 PM

Item 1
Change this line to:

> @ 0,01 Button "Print" action (oDlg:print(), oDlg:end())

Item 2
See this message thread:

http://forums.fivetechsoft.com/viewtopi ... rint+scale

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
tgraph problem end oDlg and print
Posted: Sat Sep 13, 2008 07:40 PM

James:

You said:
> @ 0,01 Button "Print" action (oDlg:print(), oDlg:end())

Putting the oDlg:end() kills the graph after printing.
Maybe I didn't make it clear the "X" in the upper right corner won't kill the oDlg when clicked it kills the oGraph. How can I get them to both go when the X is clicked.

Item 2 you said
>See this message thread:

http://forums.fivetechsoft.com/viewtopi ... rint+scale

Nothing there works. Just keeps printing small graphic. Much smaller then whats on the screen.

Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
tgraph problem end oDlg and print
Posted: Sat Sep 13, 2008 09:41 PM

Harvey,

>Maybe I didn't make it clear the "X" in the upper right corner won't kill the oDlg when clicked it kills the oGraph. How can I get them to both go when the X is clicked.

Sorry, I misuderstood. Here are two options. Use a valid clause to end the dialog.

Or, better in my opion, is to remove the X button. In Workshop, double click on the dialog, and under the "Dialog Style" group, uncheck the "system menu" item.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
tgraph problem end oDlg and print
Posted: Sat Sep 13, 2008 10:04 PM

The dialog is created with code. How can I turn off the sysmenu when dialog created with code?

James I really appreciate you assistance.
Thanks

Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
tgraph problem end oDlg and print
Posted: Sat Sep 13, 2008 10:06 PM
   local oDlg, nStyle :=nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION )
   define dialog oDlg style nStyle
   activate dialog oDlg


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
tgraph problem end oDlg and print
Posted: Sun Sep 14, 2008 12:41 AM

James:

This is really dumb.... :oops:

After the click on X there was no return. All I need to do was add a return nil and the oGraph and oDlg are gone on one click.

real dumb on my part.

Still can't get the graph to print in a reasonable size. Any new ideas?

HArvey

Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
tgraph problem end oDlg and print
Posted: Sun Sep 14, 2008 01:37 AM

Harvey,

>After the click on X there was no return.

Glad you found a solution. I would still recommend not leaving the X button on any dialog. The users don't really know what it means, OK or Cancel.

>Still can't get the graph to print in a reasonable size. Any new ideas?

You tried changing nScale and there was no difference in the print size?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
tgraph problem end oDlg and print
Posted: Sun Sep 14, 2008 01:40 AM

Harvey,

Why don't you just use the TGraph Print method?

METHOD Print( oPrn, nTop, nLeft, nWidth, nHeight ) CLASS TGraph

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
tgraph problem end oDlg and print
Posted: Sun Sep 14, 2008 07:01 AM

James:

> Print( oPrn, nTop, nLeft, nWidth, nHeight ) CLASS TGraph

Perfect.

Harvey

Thank you

Harvey
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
tgraph problem end oDlg and print
Posted: Sun Sep 14, 2008 07:04 AM
Hello Harvey,

this code is working for me.
Regards,
Otto

function graphprint (oGraph,oReport)
   local oPrn, nTop := 3.0, nLeft := 2.0, nHeight := 9, nWidth := 16

   oPrn:=PrintBegin("Aufloesung",.F.,.T.,,.T.)
   oPrn:SetPortrait()
   oPrn:Cmtr2Pix(@nTop , @nLeft)
   oPrn:Cmtr2Pix(@nWidth, @nHeight)

   sysRefresh()
   oPrn:End()

   nTop   :=  INT(nTop)
   nLeft  := INT(nLeft)
   nWidth := INT(nWidth)
   nHeight:= INT(nHeight)


/*Page
oGraph:Print( oPrn, nTop, nLeft, nWidth, nHeight )
PageEnd()
PrintEnd()      
DeleteObject(oPrn)
*/

   oGraph:Print( oReport:oDevice,nTop,nLeft,nWidth,nHeight )

return NIL


Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: tgraph problem end oDlg and print
Posted: Sat Jun 12, 2010 03:29 PM

Otto;

Hi.

How about creating and printing the graph without first displaying on the screen? That is, create and print a tgraph directly to the printer either on a treport or a tprinter object without showing the graph on a window or dialog.

Can you help with that?

Thank you,

Reinaldo.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: tgraph problem end oDlg and print
Posted: Sat Jun 12, 2010 03:47 PM

Hi Reinaldo,

If Otto doesn't have an answer, you might try a trick. Draw the window offscreen (negative coordinates) then print, then close the window.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: tgraph problem end oDlg and print
Posted: Sat Jun 12, 2010 05:10 PM
James;

Thank you.

Do you mean something like:
Code (fw): Select all Collapse
local oPie
local oWnd  := tWindow():New( -500,-550, -50,-30 )
    
    oWnd:Activate()
    oPie :=  TGraph():New( 0, 0, oWnd,  nWidth, nHeight, .f., .t.  )

    with object oPie
        :cTitle     := "Malignancy % Found On Sample"
        :cSubTit    := alltrim( ::oSpcs:Specimen )
        :AddSerie( { ::oSpcs:Cancrprcnt },"Cancer %", RGB( 50, 50,200), GRAPH_TYPE_PIE, .t. )
        :AddSerie( { 100.00 - ::oSpcs:Cancrprcnt },"Non-Cancer", /*RGB( 200, 50,200)*/CLR_WHITE, GRAPH_TYPE_PIE, .t. )
    end

    oPie:Print( ::oPrn, a[ 1 ], a[ 2 ], b[ 2 ] - a[ 2 ], b[ 1 ] - a[ 1 ] )
    oPie:End()
    oWnd:End()
...


I get this runtime error:
Error description: Error BASE/1087 Argument error: --
Args:
[ 1] = U

Stack Calls
===========
Called from: window.prg => (b)TWINDOW:TWINDOW(460)
Called from: window.prg => TWINDOW:RELEASEDC(0)
Called from: tgraph.prg => TGRAPH:PRINT(1505)


Help?

Thank you,


Reinaldo.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: tgraph problem end oDlg and print
Posted: Sun Jun 13, 2010 12:31 PM

Reinaldo,

What is line 460 of your version of TWindow?

Does it work if the window coordinates are all positive?

Try a sysRefresh() after oPie():print.

If neither of those work, how about providing a small self contained sample we can test.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10