• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Print Dialog JRE1.3.1_06

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Native Print Dialog is called from Java Application and the user could click OK and Cancel to return back to the Main Application(print dialog is modal).We need to close the native dialog from the Application without human Intervention.(Something like setVisible(false) or dispose() for Java Components)Please suggest what must be done here.

Expecting your reply
Thanks in Advance!
Anu
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anu:
I am assuming that you are talking about a Windows print dialog. (For *nix systems, I've only ever printed from a command line; no dialog to work with.)
In your native code, once you get the handle to the PRINTDLG, try the following:

Note that the dialog will not display; this will force the printing to the system's default printer.
If you don't have access to the native source, I'm not sure how to help you.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't want to let your user input info why are you using a Dialog at all? Using a Dialog and then just hiding the fact that you are using it seems sort of silly to me.
 
Joel McNary
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cindy Glass:
If you don't want to let your user input info why are you using a Dialog at all? Using a Dialog and then just hiding the fact that you are using it seems sort of silly to me.


'cause that's the Windows API
This is the way the documentation says to print to a printer without showing the dialog box. As far as the API is concerned, the Dialog box and the printer settings are the same thing. It's just a matter of showing the settings to the user or not.
[ April 02, 2003: Message edited by: Joel McNary ]
 
Anu Jv
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.I shall explain you why we need such an requirement.
In Windows XP with JRE1.3.1_06(no other JRE could be used) ,the Print Dialog is Modal.So we need to click OK or Cancel in Print Dialog to get back focus to the main Application.
But our problem is, sometimes when the Print Dialog is triggerd,the Application becomes unusable but the Print Dialog does not come up (view is missing). Even in ALT TAB we cannot find the Print Dialog.In this situation as OK or Cancel could not be triggered. So by setting a timer, if we do not get the print dialog response within a certain amount of time we need to close the dialog from Application so that the Main Application gains focus.
Expecting you reply
Anu
 
Joel McNary
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a similar problem (though not exact--I could still find the print dialog through ALT-TAB). My solution was to force the dialog to the front. Try this in your native code:

and then, where you initialize your Print dialog:

What you are doing is creating a function that the print dialog will call when it is initialized (the PrintDialogWindowToFront function). All that function does is force the dialog to the front.
The second part simply lets the dialog know which function to call upon initialization and turns on the function call.
Hope this helps.
 
Anu Jv
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply.We cannot include native code in our Application. Could you please tell whether there is any method with which the modality set for the Print Dialog could be removed?
Anu
 
Joel McNary
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm....
I'm afraid that I don't know of any way to set the modality through java. All of my experience with print dialogs has been in C++. I took a look at the java.awt.print package (which I assume you are using; if not, could you please tell us more about what you are doing?) and did not see anything about setting the modality of the Print Dialog.
Anybody else have any ideas?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic