Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Java
 QCChart2D for Java
 ChartPrint Problem.

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
KnightHawk Posted - 05 Jun 2009 : 11:44:28
I am wondering about a specific method with the ChartPrint class.
When I call commonPrintObj.pageDialog(); (commonPrintObj is an instantiation of ChartPrint), it always returns false no matter if I press OK or Cancel on the page setup.

Example:

public boolean printerSetup(){
if(commonPrintObj == null){
commonPrintObj = null;
commonPrintObj = new ChartPrint();
}

commonPrintObj.setPrintDialogFlag(commonPrintObj.printDialog());
System.out.println(commonPrintObj.getPrintDialogFlag());
if(!commonPrintObj.getPrintDialogFlag()){
commonPrintObj = null;
return false;
}

commonPrintObj.setPageDialogFlag(commonPrintObj.pageDialog());
System.out.println(commonPrintObj.getPageDialogFlag());
if(!commonPrintObj.getPageDialogFlag()){
commonPrintObj = null;
return false;
}
return true;
}

Am I going about creating the ChartPrint and loading the pageDialog the wrong way?
4   L A T E S T    R E P L I E S    (Newest First)
KnightHawk Posted - 05 Jun 2009 : 15:49:21
Thank you for the help.
quinncurtis Posted - 05 Jun 2009 : 15:44:37
Sorry, we mixed up the two routines. It looks like our documentation for that function is wrong. The underlying Java PrinterJob.pageDialog method, which we call, returns a PageFormat structure, and not true or false.

The Java documentation for PrinterJob.pageDialog says:

Displays a dialog that allows modification of a PageFormat instance. The page argument is used to initialize controls in the page setup dialog. If the user cancels the dialog then this method returns the original page object unmodified. If the user okays the dialog then this method returns a new PageFormat object with the indicated changes. In either case, the original page object is not modified.

Unfortunately we do not have an access routine for the PageFormat object we use. We will put that on a list to add in the next, 2.0 release of the software.
KnightHawk Posted - 05 Jun 2009 : 14:35:04
The example you provide does not cover the issue I seem to be having.

The method printDialog() works fine for me.

The method pageDialog() (the dialog to set page layout) is the method that keeps returning false.

pageDialog() does not seem to be listed in the modified example you provided.
quinncurtis Posted - 05 Jun 2009 : 13:36:31
When you say it "always" returns false, does this include our printingr example programs ?

We modified our Lineplotsalesvolume example to save the dialog result and it returned true if OK button was pressed, and false if the Cancel button was pressed (we looked at the return value in the debugger).

public void  actionPerformed(ActionEvent event)
    { Object object = event.getSource();
    
    boolean dlgresult = false;
      
      if (object == printMenuItem)
      {
          lineplotsalesvolume.Print(printgraph);
      } else
      if (object == printerSetupMenuItem)
      {
    	  dlgresult = printgraph.printDialog();
      } else
        if (object == imageSetupMenuItem)
        {
        	lineplotsalesvolume.SaveJPEG();
        } else      	
      if (object == exitMenuItem)
      {
        System.exit(0);;
      }      	
    }
   }

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07