Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!purdue!decwrl!nsc!voder!apple!keith
From: keith@Apple.COM (Keith Rollin)
Newsgroups: comp.sys.apple
Subject: Re: windows
Message-ID: <13029@apple.Apple.COM>
Date: 29 Jun 88 15:05:59 GMT
References: <148@thelink.UUCP>
Reply-To: keith@apple.apple.com.UUCP (Keith Rollin)
Organization: Apple Computer Inc, Cupertino, CA
Lines: 43

In article <148@thelink.UUCP> oliver@thelink.UUCP (Joel Sumner) writes:
>
> have a Toolbox question.. In Applications such as DeluxePaint II,
>clicking the mouse in the tools (to select, say the pen) does not deactivate
>other windows (i.e. It does not 'activate' the tool window. When I say this,
>I mean that it was stated that when a user clicks on an inactive window, it
>only becomes active and the mouse click has no effect on the window other
>than making it active.)  How is this accomplished?  In the example programs
>to TML Pascal (Standalone), a drawing program is included that allows you to
>'draw'. The thing that I notice in that program is that you must first
>'activate' the tool window before selecting a tool and then 'activate' the
>drawing window before drawing.  How can this be avoided?  This could be

Doing what you want should be very easy. Windows are only brought to front on
(I think) 2 calls: SelectWindow and BringToFront. If neither of these calls
are made when a window is clicked on, then it won't be brought to front.

TML's Pascal sample program probably works the way it does because it uses
TaskMaster to perform a lot of operations. When writing a quickie sample
program, it is very tempting to simply set the TaskMask to $0000FFFF and 
leave your worries behind. However, TaskMaster will automatically call
SelectWindow if its call to FindWindow detects a click on an incactive window.
That is why many programs do not use windows that float in the background all
the time (because they use TaskMaster).

You can get around this in several ways. 1) Don't use TaskMaster. This is a 
pain and not really necessary. 2) Don't set the tmFindW bit in the TaskMask.
This will cause TaskMaster to return to you immediately after a mouse click. 3) 
Clear bits tmDragW, tmContent, and tmInfo in the TaskMask (you may have to
fiddle with the last bit...I think the documentation is wrong that you have to
SET it in order to get TaskMaster to ignore clicks in the infobar...). Anyway,
this last option seems to be the best in terms of getting TaskMaster to do
everything except activate windows. I hope that there are no problems with
this; the last time I tried it, it didn't work, but that was with some
unreleased System Software -- I have been assured that it has been fixed 
(knock on wood!).


Keith Rollin                                               amdahl\
Developer Technical Support                           pyramid!sun !apple!keith
Apple Computer                                             decwrl/
"You can do what you want to me, but leave my computer alone!"