Path: utzoo!attcan!uunet!microsoft!peterbak From: peterbak@microsoft.UUCP (Peter Bako) Newsgroups: comp.sys.mac.programmer Subject: Control Bars Message-ID: <5706@microsoft.UUCP> Date: 12 May 89 16:38:22 GMT Reply-To: peterbak@microsoft.UUCP (Peter Bako) Organization: Microsoft Corp., Redmond WA Lines: 60 I have recently started to program the macs, and am experimenting with control bars. I have written a simple application, which opens a window up, puts a horizontal control bar in the middle, and will eventually display its current value above it. At the moment I am having problems with incrementing the value by one, if the user clicks on the down arrow. (problems means Bus Error!) Here is a scaled version of the code: case inContent: MousePoint = AnEvent.where; GlobalToLocal(&MousePoint); tempInt = FindControl(&MousePoint, myWindow, &whichControl); switch (tempInt) { case inThumb: TrackControl(whichControl, &MousePoint, nil); break; case inUpButton: case inDownButton: case inPageUp: case inPageDown: TrackControl(whichControl, &MousePoint, MoveScrollbar); break; } ok thats part of my control loop... Now the routime MoveScrollbar... MoveScrollbar(theControl, partCode) ControlHandle theControl; int partCode; { int amount, current; switch (partCode) { case inUpButton: /* I go thru case inUpButton, inDownButton, inPageUp, inPageDown. then my case statement is over, and the following three lines are left */ current = GetCtlValue(theControl); current += amount; /*amount set by switch */ SetCtlValue(theControl, current); } Ok now as far as I can tell, I always break while performing the SetCtlValue in the routine above. As far as I can tell everything is in the right place, yet each time I click either of the arrows I crash. Any suggestions? Peter Bako PS. I try to read this group, but I dont always get a chance to, so please send me mail....