tgraph problem end oDlg and print

tgraph problem end oDlg and print

Postby hag » Sat Sep 13, 2008 5: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.


Code: Select all  Expand view

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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Sat Sep 13, 2008 7: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hag » Sat Sep 13, 2008 7: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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Sat Sep 13, 2008 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby hag » 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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Sat Sep 13, 2008 10:06 pm

Code: Select all  Expand view
   local oDlg, nStyle :=nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION )
   define dialog oDlg style nStyle
   activate dialog oDlg


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

Postby hag » 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
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby James Bott » Sun Sep 14, 2008 1: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Sun Sep 14, 2008 1:40 am

Harvey,

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

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

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

Postby hag » Sun Sep 14, 2008 7:01 am

James:

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

Perfect.

Harvey
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Postby Otto » Sun Sep 14, 2008 7:04 am

Hello Harvey,

this code is working for me.
Regards,
Otto

Code: Select all  Expand view
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


Image
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: tgraph problem end oDlg and print

Postby reinaldocrespo » Sat Jun 12, 2010 3: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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: tgraph problem end oDlg and print

Postby James Bott » Sat Jun 12, 2010 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: tgraph problem end oDlg and print

Postby reinaldocrespo » Sat Jun 12, 2010 5:10 pm

James;

Thank you.

Do you mean something like:
Code: Select all  Expand view

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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: tgraph problem end oDlg and print

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 39 guests