Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.sys.mac.programmer Subject: Change in System Tools 6.0 Menu Manager behavior. Keywords: menuWidth -> -1, PopUpMenuSelect Message-ID: <9365@dartvax.Dartmouth.EDU> Date: 19 Jul 88 06:39:50 GMT Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Organization: Dartmouth College, Hanover, NH Lines: 36 I've been using Steve Brecher's TrackPopUp.a routine for some time now to put up a small popup menu in one of my programs (I have modified it slightly to be a C function rather than Pascal, but that's all). This routine uses the PopUpMenuSelect trap if that is available on a Mac II, otherwise draws the menu itself. It has performed flawlessly for me since I got it, but no longer works correctly on a Mac II with System Tools 6.0 installed. This routine does not use a PopUp box, but rather allows the user to pop the menu up anywhere on the screen using for example an option mouse-click. The routine then calculates the best place to pop up the menu based on the mouse position and the size of the menu as found in (*theMenu)->menuWidth, where theMenu is a MenuHandle. Previous to System Tools 6.0, calling CalcMenuSize once at the beginning of the program was enough to ensure that (*theMenu)->menuWidth had the correct information in it for all calls to the TrackPopUp routine. After installation of System Tools 6.0, sometime after the first call to PopUpMenuSelect and before the second call, somebody puts a minus 1 (long) into (*theMenu)->menuWidth! Needless to say, all of Steve's carefully hand-coded instructions in this routine come to naught, and the PopUp menu generally gets drawn as far away from where you want it as possible. I tried to determine where the menuWidth was being changed using MacsBug's "SS" command on the field after locking the MenuHandle. MacsBug broke in GetMCEntry a couple of times, and once in an MDEF, before I got bored with this experiment. The problem is fixed by calling CalcMenuSize every time before calling TrackPopUp if ((*theMenu)->menuWidth == -1), but this is not the point. The point is this: Why is (*theMenu)->menuWidth now being changed to -1, even though the contents of the menu are not changed in any way, and why is this new behavior not documented anywhere? Oh, yeah, and one other question: What other surprises await the unwary Macintosh programmer? Earle R. Horton. H.B. 8000, Dartmouth College, Hanover, NH 03755