Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Pop-up menus and MPW scripts Message-ID: <39184@apple.Apple.COM> Date: 5 Mar 90 00:07:44 GMT References: <27526@cup.portal.com> Organization: Apple Computer Inc, Cupertino, CA Lines: 81 In article <27526@cup.portal.com> nicky@cup.portal.com (nick john pilch) writes: >Two questions: > >Has anyone else noticed that the horizontal displacement for the >start of the text in a pop-up menu changed from 6.0.3 to 6.0.4? Text in a >pop-up >menu is now drawn about 2 pixels to the left of where it used to be. Those who >coded their pop-ups so that the text displayed on their pop-up-at-rest bar >corresponded exactly to what would appear in the menu when the menu was clicked >find that now the text moves to the left when the pop-up bar is clicked. I >didn't see this documented anywhere and it'd be nice to know why this was done. >Try out the pop-up menus in the projector windows of MPW or the Set Tabs & Font >dialog of THINKC. I'd love to know why it was done, too. I work at Apple in DTS, and I don't know of anyone here who was aware that the menus changed until a developer wrote in to us about a week ago. I don't know if they are going to stay this way, or if they will revert back to their previous appearance in future systems, so you may wish to hold off on updating your software until things shake out. Hmmm...wouldn't it be nice if there were a system call that draw those boxes, rather than having to draw them yourself? Actually, I use MacApp which draws them for me, so what am I complaining about? > >Secondly, I would like to add some "check-able" menu items to a menu in MPW. >They would correspond to exported shell variables whose state is either 1 or >0. For example, one variable is SADESYMBOLS. A value of 1 would mean to >compile, >lib and link everything with Sade symbols turned on. I'd like to add that item >to a menu so that when it's first added, it would be checked if the variable >were 1 and unchecked if it were 0. Then, choosing the menu item would toggle >its >value and the checkmark. I think this has to be done with a script. The script >would add the menu item if it weren't there and would be invoked when the menu >item were chosen to do the toggling. (CompareFiles works like this.) Anyway, >the problem is that I want to be able to pass the variable name to this script >and then have the script evaluate the variable. How can I do this? When the >script sees the variable as a parameter it just treats it as a string and won't >evaluate it no matter what I do. The only way I can see to evaluate it is to >say: "Set MyVariableName" and then extract the last part when I get the output, >i.e., "Set MyVariableName 0." How do I extract the 0 then? >Is there an easier way??? > >Nick Pilch >Mountain Lake Software >nicky@cup.portal.com Nick, I use something like the following to set the SADE option for my MacApp programs. It installs a menu item called "MABuild SADE symbols". It is initially not checked because MASADEFlag is set to zero. Selecting the menu item will toggle the value of MASADEFlag, as well as the check mark in the menu item. Set MASADEFlag 0 Alias MASymOff "AddMenu Build 'MABuild SADE Symbols' MASymOn; Set MASADEFlag 0" Alias MASymOn "AddMenu Build 'MABuild SADE Symbols!' MASymOff; Set MASADEFlag 1" IF {MASADEFlag} == 1 MASymOn ELSE MASymOff END That ^R thing after the exclamation point is the Mac character for the check mark symbol. -- ------------------------------------------------------------------------------ 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