[comp.sys.mac.programmer] Making a control in the Print Job Dialog inactive

sas@tut.cis.ohio-state.edu (Scott Sutherland) (07/28/89)

Does anyone know of a reasonable way to call HiliteControl on an item in 
the Printer Job Dialog.  Since my application can't print in draft mode
on an ImageWriter, I'd like to dim the Draft radio button and make it 
inactive if the chosen printer is an ImageWriter. 

Any suggestions will be *much* appreciated!

- Scott

---
Scott A. Sutherland		sas@cis.ohio-state.edu
Staff Software Developer
The Ohio State University, Department of Dance

isle@eleazar.dartmouth.edu (Ken Hancock) (07/28/89)

In article <56212@tut.cis.ohio-state.edu> Scott Sutherland <sas@cis.ohio-state.edu> writes:
>Does anyone know of a reasonable way to call HiliteControl on an item in 
>the Printer Job Dialog.  Since my application can't print in draft mode
>on an ImageWriter, I'd like to dim the Draft radio button and make it 
>inactive if the chosen printer is an ImageWriter. 
>
>Any suggestions will be *much* appreciated!
>
>- Scott

The answer is you're not supposed to.  Touching anything in the print
record is a big no-no.  I sympathize with you.  I'm currently
writing a DA which wanted to do a bunch of things that the
Print Manager SHOULD allow you to do, but doesn't.

All I can say is if they choose draft and it looks like
garbage, that's life...

Ken

Ken Hancock  '90                    | E-mail: (BITNET/UUCP/INTERNET)
Computer Resource Center Consultant |   isle@eleazar.dartmouth.edu
------------------------------------+---------------------------------------
DISCLAIMER?  I don't get paid enough to worry about disclaimers.

odawa@well.UUCP (Michael Odawa) (07/31/89)

In article <56212@tut.cis.ohio-state.edu> Scott Sutherland <sas@cis.ohio-state.edu> writes:
>Does anyone know of a reasonable way to call HiliteControl on an item in 
>the Printer Job Dialog.  Since my application can't print in draft mode
>on an ImageWriter, I'd like to dim the Draft radio button and make it 
>inactive if the chosen printer is an ImageWriter. 

We had to do the same thing in DocuComp, and we used the techniques
outlined in Tech Note #95.  The Draft Mode button is Item #8 in the
ImageWriter PrJobDialog.  Hilite it as Inactive.  In the MyDlgInit procedure
this would entail (in Pascal):

  if PrintHdl^^.PrStl.wDev = BitShift(bDevCItoh,8) { Imagewriter.. }
    then begin
      GetDItem(PrintDlg, 8, Junk, H, ItemRect);  { Draft printing btn.. }
      HiliteControl(ControlHandle(H), Inactive);
    end;

Michael Odawa
Simple Software
odawa@well.uucp

isle@eleazar.dartmouth.edu (Ken Hancock) (08/02/89)

In article <12928@well.UUCP> odawa@well.UUCP (Michael Odawa) writes:
>In article <56212@tut.cis.ohio-state.edu> Scott Sutherland <sas@cis.ohio-state.edu> writes:
>>Does anyone know of a reasonable way to call HiliteControl on an item in 
>>the Printer Job Dialog.  Since my application can't print in draft mode
>>on an ImageWriter, I'd like to dim the Draft radio button and make it {->>inactive if the chosen printer is an ImageWriter. 
>
>We had to do the same thing in DocuComp, and we used the techniques
>outlined in Tech Note #95.  The Draft Mode button is Item #8 in the
>ImageWriter PrJobDialog.  Hilite it as Inactive.  In the MyDlgInit procedure
>this would entail (in Pascal):

I think you'd better go back and re-read Tech Note #95.  The first
page specificly states that you should not change any of the
controls in the print job dialog, only add them.

Besides, there's no reason to disable the Draft printing.  Let
the Print Manager deal with it.  The word "draft" means
"it may look like garbage, but print it anyway."  So instead
of deciding what's best for the user, let them decide for
themselves.

Ken
Ken Hancock  '90                    | E-mail: (BITNET/UUCP/INTERNET)
Computer Resource Center Consultant |   isle@eleazar.dartmouth.edu
------------------------------------+---------------------------------------
DISCLAIMER?  I don't get paid enough to worry about disclaimers.

odawa@well.UUCP (Michael Odawa) (08/03/89)

In article <12928@well.UUCP> I wrote:
>In article <56212@tut.cis.ohio-state.edu> Scott Sutherland <sas@cis.ohio-state.edu> writes:
>>Since my application can't print in draft mode...I'd like to dim the 
>>Draft radio button [in the PrJobDialog]...
>
>We had to do the same thing in DocuComp, and we used the techniques
>outlined in Tech Note #95.  The Draft Mode button is Item #8 in the
>Imagewriter PrJobDialog.  Hilite it as Inactive...

   Since my original posting of this technique, several perceptive people
have pointed out that I failed to follow one of the caveats of Tech Note
#95, which said,

 o Don't count on an item retaining its current position in the list.  If
   you depend on the Draft button being a particular number in the
   ImageWriter's style dialog [sic] item list, and we change the Draft
   button's item number for some reason, your program may no longer 
   function properly.

   They are correct; I was wrong, and my penalty is that I will probably
have to revise the product when the new print architecture comes out.  At
the time I wrote the code (over a year ago) it seemed like a reasonable risk
to take.  In retrospect I do not regret the decision, as (1) my users will
have been spared two years of getting garbage when they choose the Draft
print mode, and (2) it will be time for a new rev anyway.  However with the
announced coming of System 7 and all that portends I would not now write
code which violated the caveat so blatantly.

   Hence I too must caution, 

        DO NOT USE TECH NOTE #95 TO DISABLE DRAFT PRINTING (anymore).

Michael Odawa
Simple Software
odawa@well.uucp

s29749s@saha.hut.fi (Olli Johannes Arnberg) (08/03/89)

Michael Odawa writes:
> We had to do the same thing in DocuComp, and we used the techniques
> outlined in Tech Note #95.  The Draft Mode button is Item #8 in the
> ImageWriter PrJobDialog.  Hilite it as Inactive.  In the MyDlgInit procedure
> this would entail (in Pascal):
>
>  if PrintHdl^^.PrStl.wDev = BitShift(bDevCItoh,8) { Imagewriter.. }
>    then begin
>      GetDItem(PrintDlg, 8, Junk, H, ItemRect);  { Draft printing btn.. }
>      HiliteControl(ControlHandle(H), Inactive);
>    end;

OH NO!  Not again.

As authors of the HPDJ printer driver for HP DeskJet we would dare to
strongly suggest against manipulating ANYTHING in the print record or
print dialogs.

Although in principle you can tell which printer is used by examining
the xxxxxDev (I don't remember which field it was, and the
documentation isn't handy now) field, nobody has ever told you that a
specific printer does not "support" this or that method of printing.
It is YOU that have found out by previous experiences that an
ImageWriter does not (currently!) print graphics very well in draft
mode.  This is something that every ImageWriter user has experienced
so that they don't expect graphics output when they have selected
draft printing.

And as everyone knows, there are several other printers: LaserWriter
(in fact, several of them), ImageWriter LQ, Hewlett-Packard DeskJet
(there are several drivers for it), Hewlett-Packard PaintJet and so
on.  

When we wrote our driver, the biggest problem rose when using programs
that "knew" something of the printer driver (most notorius ones were
from Microsoft).  Printer records contain several for-driver-only
fields that are not to be fiddled with.  Nearly every driver uses them
for different purposes.

So, when writing a program, use only things that are given in Inside
Macintosh and in Technical notes.  Then everything works.

So, why protect a user against expected results?  If the user wants to
be stupid, let her/him be so.  Why prevent your application from
working with a future version of ImageWriter driver which prints
graphics ok in draft mode (using virtual memory :-)?  Why mess up
HPDJ's print dialog by inactivating "All"-button?  (That is our item
8). 

There is no reason.  Don't do it.

  Ari Mujunen             Olli Arnberg
  s29851c@taltta.hut.fi   s29749s@saha.hut.fi