Path: utzoo!utgpu!water!watmath!clyde!att!poseidon!ech From: ech@poseidon.ATT.COM (Edward C Horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: Odd scrollbar behavior with TrackControl Message-ID: <546@poseidon.ATT.COM> Date: 24 Oct 88 03:54:33 GMT References: <942@ccnysci.UUCP> Organization: AT&T Bell Laboratories, Lincroft, NJ Lines: 22 From article <942@ccnysci.UUCP>, by alexis@ccnysci.UUCP (Alexis Rosen): ! What did bother me was the crash I kept getting when I defined an ActionProc ! for the scrollbar control. I said: ! SetCtlAction(ControlHandle(item), @Scroller); ! just before starting the ModalDialog loop. Scroller is a procedure that handles ! clicks in the arrows and grey regions. The wierd thing is that the ActionProc ! worked just fine. It did everything it was supposd to. BUT- now, the instant ! I clicked on the thumb, the machine would crash. The debugger showed me that ! when I was clicking in the thumb, my ActionProc was passed a bad ControlHandle. Read IM, p I-324 very carefully: the actionProc gets parameters EXCEPT when the part number is the indicator (i.e. the thumb), in which case THERE ARE NO PARAMETERS. You're right, the "parameters" are junk. Worse, when you return from your actionProc, it will pop the nonexistent params off the stack, corrupting the stack. Good night, Irene... So yes, you need two different action routines, and you have to pass the control handle to the thumb-routine through a global. Ugly, mate. =Ned Horvath=