Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!ncar!tank!uwvax!umn-d-ub!gandreas From: gandreas@umn-d-ub.D.UMN.EDU (Glenn Andreas) Newsgroups: comp.sys.mac.programmer Subject: Re: Odd scrollbar behavior with TrackControl Message-ID: <536@umn-d-ub.D.UMN.EDU> Date: 27 Oct 88 16:34:48 GMT References: <942@ccnysci.UUCP> <13726@dhw68k.cts.com> <953@ccnysci.UUCP> Reply-To: gandreas@ub.d.umn.edu.UUCP (Glenn Andreas) Organization: University of Minnesota, Duluth Lines: 50 In article <953@ccnysci.UUCP> alexis@ccnysci.UUCP (Alexis Rosen) writes: > >Ken McLeod recently responded to my original query (no, I'm not going to quote >two pages.) > >Unfortunately, he erred in exactly the opposite direction that I did. I first >said, "I'm using an ActionProc, and its arguments are sometimes garbage." Ken >responds "Declare you arguments explicitly." That's exactly what I was doing, >and that's why I was crashing. > >In fact, ActionProcs take EITHER two args (normal case) or none, for "dial >indicators." That's one ugly interface. Yuck. (Wonder how NeXT does it ;-) > >---- >Alexis Rosen alexis@dasys1.UUCP or alexis@ccnysci.UUCP How about just skipping the explicit tracking call all together? I was a DA recently that needed a scroll bar, so I though, no problem. However, any routine used as a ProcPtr needed to be scoped globallly (i.e., it can't be a nested procedure, the static link throws everything off). But, I needed to get some information that was with the DA, and thus passed to the main routine. But you can't use global variables with DA's, so there was no easy way to get information between the ActionProc and the main routine (well, you could probably use the control's RefCon, but I said easy). So what I did was do my own TrackControl, and the whole thing looked clearer than using TrackControl with and ActionProc. Basically, I did the following: Get the part hit in the control. if the part hit = inThumb then TrackControl with no Action Proc else while part first hit = where the mouse now is and still down do case part hit of up : Scroll down one down : Scroll up one pageUp : Scroll down one page pageDown : Scroll up one page Or something to this effect (I don't have the code nearby to be able to quote). The scroll routine took the amount and then updated the control by that amount, checking min & max, etc - basically I did the work of TrackControl, and if I get around to this, I will code this up as a simple procedure that I can reuse. This can go with my SetDialogItemValue and GetDialogItemValue routines that I use all the time. These could be good candidates for the code sample library that was once talked about here. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = "Whether you like it, or don't like it, sit | - gandreas@ub.d.umn.edu - = = back and take a look at it, because it's the | Glenn Andreas = = best going today! WOOOOoooo!" - Ric Flair | = =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=