Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site Shasta.ARPA
Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!hao!hplabs!pesnta!greipa!decwrl!Glacier!Shasta!gus
From: gus@Shasta.ARPA
Newsgroups: net.micro.mac
Subject: Re: Is My Thumb an Indicator?
Message-ID: <1523@Shasta.ARPA>
Date: Sat, 9-Nov-85 02:57:52 EST
Article-I.D.: Shasta.1523
Posted: Sat Nov  9 02:57:52 1985
Date-Received: Tue, 12-Nov-85 06:24:57 EST
References: <1283@wanginst.UUCP>
Distribution: net
Organization: Stanford University
Lines: 43

> According to the Control Manager chapter of IM, the action proc for
> a particular control will be called repeatedly as long as the mouse is
> down in some part of the control.  True enough, it will.  It also says
> that there are two flavors of action procs, depending on whether or not
> the control is an "indicator".  If it is, the action proc is a parameterless
> procedure (no arguments, no return value).  If not, the action proc
> receives the control handle and part code as arguments.  IM points out
> that it's important to know what kind of control you're dealing with,
> since "obviously" your action proc can only be of one type or the other.
> 
> My problem: when I mouse down in the scrolling or paging regions of my
> scrollbar, my action proc is called exactly as advertised with the
> appropriate handle and part code on the stack.  When I mouse down in the
> thumb (the little square item that shows the scroll bar position), my
> action proc is called without parameters as though the thumb were an indicator!
> Since I'm writing in assembler, I can deal with this, but I'd still like
> to know what's going on here.  I'd be in serious trouble if I were using
> a compiled language and couldn't muck with the stack.
> 
> Has anyone run into this curiosity?  Has anyone used a scrollbar action
> proc and *not* run into this?
> 

ARGH! Yes! I ran into this one this summer when I was writing Pascal code.
I ended up writing a very small kluge routine that would provide the two
missing parameters to the action proc (which are both really needed at all
times) The routine was rather ugly as it had to resort to less-than robust
techniques to figure out who was calling me, and where I could find the
missing data. I don't remember exactly what I did. (I would have to dig
up the Lisa Pascal/assembler source for that.)

The problem stems from the fact that the control manager passes the action
proc routine address to DragGreyRegion when you click in a draggable
indicator. DragGrayRegion does not know anything about control action procs
in particular. It just simply has a hook that it calls repeatedly with no
parameters. The action proc, however, calls this routine itself when the
part does not move. (i.e. is not an indicator or 'thumb')

Fortunately, this anomoly is covered in reasonable detail in Inside Mac.
Unfortunately, no solution is presented. Perhaps most unfortunately, this
is a serious design flaw which can be worked around, but which cannot be
fixed because the fix would break most existing work-arounds! Moral, DON'T
RELEASE PROGRAMS WITH DESIGN DEFFICIENCIES!!!!