Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!ucbcad!ucbvax!decvax!decwrl!nsc!voder!apple!dowdy
From: dowdy@apple.UUCP
Newsgroups: comp.sys.mac
Subject: Re: Drawing Lines in Dialogs
Message-ID: <1281@apple.UUCP>
Date: Tue, 7-Jul-87 11:56:20 EDT
Article-I.D.: apple.1281
Posted: Tue Jul  7 11:56:20 1987
Date-Received: Thu, 9-Jul-87 06:32:12 EDT
References: <1256@apple.UUCP> <6608@dartvax.UUCP>
Reply-To: dowdy@apple.UUCP (Tom Dowdy)
Organization: Apple Computer Inc., Cupertino, USA
Lines: 65
Keywords: drawing tricks dialogs

In article <6608@dartvax.UUCP> merchant@dartvax.UUCP (Peter Merchant) writes:
>In article <1256@apple.UUCP>, dowdy@apple.UUCP (Tom Dowdy) writes:
>> [ article by myself conserning PICTs and Dialogs]
>
>Recently I had to do the same thing and I came up with the same idea.  The
>problem is, it didn't work because it was in a Desk Accessory.  It seems
>that Font/DA Mover (at least the version I have...3.2, I think) added the
>PICT resource but it didn't change the reference in the dialog box.  I suppose
>I could have still done it with a bit of code to figure out what the resource
>number was and change the reference in the dialog box and then draw the dialog
>box.
>
>Next time you're in the neighborhood with "someone else", ask if there is a
>nice way to use the PICT resource in a DA.

I was in the neighborhood so I thought I would answer it myself.

The problem described above concerns the renumbering of resources by
the font/da mover.  This can be a pain, for example, if you need
a dialog in your DA, you call GetNewDialog, but you need the resource
ID.  The Font/DA mover will CHANGE this on you, so you need to somehow
figure out what it was changed to.

There are three ways to do this (that I know of):
1) Hard code your resource numbers.  This doesn't work (as the above story
points out)
2) Use named resources.  Then find the resource via it's name, figure out
its number.  This is sort of a lazy way around this, but it works, and I
have used it in the past.
3) Compute the IDs which have been renumbered.  For an example of this,
see MPW DA examples (the only one I have handy now)...

HOWEVER:  The problem described above concerns the renumbering of
PICT resources that are used in a DITL.
Quoting from Tech Note Number 23 on Font/DA Mover and DAs:
"Sometimes, resource IDs are embedded in other resources.
For example, DLOG resource contain the ID of the assciated DITL.
In this case, and in two other specific cases of resource IDs in other
resources, the FDAM will renumber the embedded resource ID as well as
the resource itself:

1) DITL IDs contained in DLOG and ALRT resources
2) ICON, PICT and CNTL IDs contained in DITL resources
         ^^^^
3) MDEF IDs contained in MENU resources."

What this means is that if you include a PICT in a DITL, it will AUTOMATICALLY
work, no matter what the PICT has been renumbered to.  I have used PICTs
in DITLs in DAs (don't you love all these abbrevs?) in the past with no
problems.  They were correctly numbered.

So I'm thinking that the problem was that either your DITL/DLOG and/or
PICT resources were not considered owned resources.  Did you create them
as such?  For more information on owned resources, see "Resource IDs of
Owned Resource" in the Resource Manager section of Inside Mac.

As always, (as is suggested in the Tech Note), it is a good idea to move
your DA to several disks in an attempt to "break" it.  This will let
you know if you are having owned resource problems.

  Tom Dowdy                 CSNET:    dowdy@apple.CSNET
  Apple Computer MS:27Y     AppleLink:DOWDY1
  20525 Mariani Ave         UUCP:     {sun,voder,amdahl,decwrl}!apple!dowdy
  Cupertino, CA 95014       
  "Plus ca change, Plus c'est la meme chose."