[comp.sys.mac.programmer] cdev/system 7 question/problem..

jkeegan@hawk.ulowell.edu (Jeff Keegan) (05/26/91)

Okay, my question goes something like this : what's the best way to tell where
you're cdev's running?

And here's the explanation to that awkward question..

One of my cdevs occasionally needs to call up a modal dialog in front of the
control panel (put yourselves om a pre-system 7 train of thought for a moment).
I used to create the dialog (invisible), and move it a certain number of pixels
down and a certain number over, to compensate for the scroll box on the left
side of the old control panel.  This way I could get it to come up exactly
over the panel of my cdev, no matter where the control panel was (I placed
it relative to the control panel's current position).

Recently I ran my old version (after installing system 7) and realized that
another solution was necessary (because the modal-dialog I'd created was now
too far to the right, because of the lack of a control-panel).  I created a
system-7 version in a flash by changing the horizontal offset of the move I was
performing from 102 pixels to 0.  That's great, but I want my cdev to work in
both environments, system 6 and system 7... No problem, you say, check Gestalt
(if that's spelled wrong forgive me) for the system software's version number..
Well, I thought of that, and was going to do it.. If I'm earlier than 7, use
the offset, and if after 7, don't.. But (in addition to the gnawing feeling at
my gut for making such a non-elegant check) I started to wonder if there were
other times I'd have to worry about the problem, and I think I found one..
QuickKeys 2, for instance, allows you to pull up a single panel.  I haven't
been able to actually look at that feature again recently (since I've moved
to Sys. 7 and that feature doesn't work (nor does it need to).  So, I don't
know this for a fact, but I think that's a different sized window than the
normal control panel anyway, too.  Am I missing some painfully easy way of
finding out exactly where my window is?

(Just for the record, I'm getting the current location now by setting a Point
to the values of the window's portRect.left and portRect.right, doing a 
LocalToGlobal on it, and optionally adding the offset..)

So, opinions?  Am I being to fussy, and should I just go by the system version
number? (Something the whole Gestalt philosophy is against.. the same
trap that caused so many Math-CoProcessor-Not-Installed errors on the IIsi),
or is there another do-able solution?

..Jeff

-------------------------------------------------------------------------------
| Jeff Keegan                | I clutch the wire fence until my fingers bleed |
| jkeegan@hawk.ulowell.edu   | A wound that will not heal                     |
|----------------------------| A heart that cannot feel                       |
| This space intentionally   | Hoping that the horror will receed             |
| left blank                 | Hoping that tomorrow we'll all be freed  -RUSH |
-------------------------------------------------------------------------------