Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 ChartPrint Problem.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

KnightHawk

22 Posts

Posted - 05 Jun 2009 :  11:44:28  Show Profile  Reply with Quote
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?

quinncurtis

1164 Posts

Posted - 05 Jun 2009 :  13:36:31  Show Profile  Reply with Quote
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);;
      }      	
    }
   }
Go to Top of Page

KnightHawk

22 Posts

Posted - 05 Jun 2009 :  14:35:04  Show Profile  Reply with Quote
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.
Go to Top of Page

quinncurtis

1164 Posts

Posted - 05 Jun 2009 :  15:44:37  Show Profile  Reply with Quote
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.
Go to Top of Page

KnightHawk

22 Posts

Posted - 05 Jun 2009 :  15:49:21  Show Profile  Reply with Quote
Thank you for the help.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07