Path: utzoo!mnetor!uunet!husc6!bloom-beacon!oberon!bbn!rochester!pt.cs.cmu.edu!f.gp.cs.cmu.edu!dtw
From: dtw@f.gp.cs.cmu.edu (Duane Williams)
Newsgroups: comp.sys.mac.programmer
Subject: Re: What can you assume about the current port?
Message-ID: <1654@pt.cs.cmu.edu>
Date: 11 May 88 04:16:28 GMT
References: <2799@polya.STANFORD.EDU>
Sender: netnews@pt.cs.cmu.edu
Organization: Carnegie-Mellon University, CS/RI
Lines: 33


I don't know what the current Apple dogma is regarding the User Interface
Guidelines, but an early version of the Guidelines said that "the user
should feel in control of the computer."  Selecting the active window (by
clicking in it) is supposed to be the prerogative of the user and is one of
the ways of making the user "feel in control" of the machine.  

There are only a few circumstances when the current port should be changed
by the application.  The primary one, in obedience to the above standard, is
when an activate event is received, generally caused by an explicit user
action, e.g., clicking in a window or creating a new window.  The activated
window should become the current port.

Update events also require changing the current port, but such a change
should be strictly temporary (lasting the lifetime of the redraw procedure
only).

There were documented problems with some DAs changing the current port non-
temporarily; so you may have to save and restore the current port around the
opening of a DA.

Of course, we all know that Apple changes the dogma from time to time --
after which we read in press reports about how awful it is that third party
developers are not following the rules.  And we all know that Apple has been
a prime violator of its own rules (even prior to changing them); witness the
Finder, MacPaint, and HyperCard.  So, feel free to change the current port
with the phase of the moon and keep those users guessing! :-)

Duane Williams

-- 
uucp: ...!seismo!cmucspt!me.ri.cmu.edu!dtw
arpa: dtw@cs.cmu.edu