[comp.sys.mac.programmer] TC4.0: Odd Address/Address Error, using SetCtlAction

myoung@joker.sgi.com (Mark Young) (07/23/90)

I've been trying to implement a scrollbar in a dialog menu.  Everything
seems to work Ok (the up/pageup/down/pagedown parts) until I try to move 
the thumb widget.  If I'm in the debugger, I get an odd address message
with the pc at 80157c (system 6.02).  If I'm not in the debugger, macsbug
gives me an address error.

when in the debugger, I can trace the action routine to the point where it
returns; the error happens as soon as I step past the return.

If I don't set the action routine, I can move the thumb just fine, but can't
get set actions for the other parts of the scrollbar.

anyone have any suggestions...please...I've already wasted many hours trying
to find a way to track this down with no luck.


thanks.

	...myoung

keith@Apple.COM (Keith Rollin) (07/24/90)

In article <10752@odin.corp.sgi.com> myoung@joker.asd.sgi.com (Mark Young) writes:
>I've been trying to implement a scrollbar in a dialog menu.  Everything
>seems to work Ok (the up/pageup/down/pagedown parts) until I try to move 
>the thumb widget.  If I'm in the debugger, I get an odd address message
>with the pc at 80157c (system 6.02).  If I'm not in the debugger, macsbug
>gives me an address error.
>
>when in the debugger, I can trace the action routine to the point where it
>returns; the error happens as soon as I step past the return.
>
>If I don't set the action routine, I can move the thumb just fine, but can't
>get set actions for the other parts of the scrollbar.
>
>anyone have any suggestions...please...I've already wasted many hours trying
>to find a way to track this down with no luck.

Are you using the same ActionProc for both the thumb and the arrows? If
so, check out page i-324 of Inside Mac. There, it mentions that the
ActionProc is called with a different number of parameters in either
case, and that different routines need to be called depending on what
was clicked on.

Yes, this means that SetCtlAction is almost useless for scrollbars. The
alternative is to pass in the pointer to the right routine when you call
TrackControl.

-- 
------------------------------------------------------------------------------
Keith Rollin  ---  Apple Computer, Inc.  ---  Developer Technical Support
INTERNET: keith@apple.com
    UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith
"Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions

murat@farcomp.UUCP (Murat Konar) (07/25/90)

In article <10752@odin.corp.sgi.com> myoung@joker.asd.sgi.com (Mark Young) writes:
>I've been trying to implement a scrollbar in a dialog menu.  Everything
>seems to work Ok (the up/pageup/down/pagedown parts) until I try to move 
>the thumb widget.  If I'm in the debugger, I get an odd address message
>with the pc at 80157c (system 6.02).  If I'm not in the debugger, macsbug
>gives me an address error.
>
>when in the debugger, I can trace the action routine to the point where it

You did remember to declare your action routine as pascal didn't you?  I was
helping a guy with similar symptoms (crash on return) and this was the problem.
The ROM expects routines to have Pascal calling (and returning) conventions.

-- 
____________________________________________________________________
Have a day. :^|             
Murat N. Konar	
murat@farcomp.UUCP             -or-          farcomp!murat@apple.com