[comp.sys.mac.programmer] Pop-up menus and MPW scripts

nicky@cup.portal.com (nick john pilch) (03/04/90)

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.

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

keith@Apple.COM (Keith Rollin) (03/05/90)

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 <opt-d>
      "AddMenu Build 'MABuild SADE Symbols' MASymOn; Set MASADEFlag 0"

   Alias MASymOn <opt-d>
      "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

brendan@claris.com (Brendan McCarthy) (03/06/90)

From: nicky@cup.portal.com (nick john pilch)
>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.

Yes.  We've encountered this apparently problem too.  It seems that some 
bright engineer at Apple was playing with the system MDEF, saw the 2 pixel
horizontal offset, and figured that no-one would care if it was removed.
Now, our Claris MDEF checks which version of the system you're running and
draws the menu the same way the system does.  Thanks Apple.

        :        Brendan McCarthy
        :        UUCP:      brendan@claris.com
        :        InterNet:  {ames,apple,portal,sun,voder}!claris!brendan

tecot@Apple.COM (Ed Tecot) (03/27/90)

In article <10910@claris.com> brendan@claris.com (Brendan McCarthy) writes:
>Yes.  We've encountered this apparently problem too.  It seems that some 
>bright engineer at Apple was playing with the system MDEF, saw the 2 pixel
>horizontal offset, and figured that no-one would care if it was removed.
>Now, our Claris MDEF checks which version of the system you're running and
>draws the menu the same way the system does.  Thanks Apple.

Wow.  I've been called many things, but never bright.  I can explain the
change:

Up until 6.0.4, the space reserved for item marks was a hard-coded constant.
Although it looked a little wierd in the US, the real problem was in other
countries - if the font was larger than Chicago 12 or draw from right-to-left,
the overlapping characters made things impossible to read.  I changed the
offset to be calculated from the font - it's now identical to a space.

Of course, this makes me a little curious - as developers, in the future,
would you rather that we fix bugs like these, or leave them alone?

						_emt

mxmora@unix.SRI.COM (Matt Mora) (03/27/90)

In article <39844@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:

>Of course, this makes me a little curious - as developers, in the future,
>would you rather that we fix bugs like these, or leave them alone?


How about letting the developers know about the change?
A system bug fix list from apple sure would be wonderful.
The "Macintosh System Software 6.0.5 ***Draft*** Change History"
document is a step in the right direction.



>						_emt



-- 
___________________________________________________________
Matthew Mora
SRI International                       mxmora@unix.sri.com
___________________________________________________________

d88-jwa@nada.kth.se (Jon Watte) (03/27/90)

>In article <10910@claris.com> brendan@claris.com (Brendan McCarthy) writes:
>>bright engineer at Apple was playing with the system MDEF, saw the 2 pixel
>>horizontal offset, and figured that no-one would care if it was removed.

In article <39844@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:
>Of course, this makes me a little curious - as developers, in the future,
>would you rather that we fix bugs like these, or leave them alone?

We'd rather see you document them, clearly, and before the actually
fixed software is released.

h+
-- 
   ---  Stay alert !  -  Trust no one !  -  Keep your laser handy !  ---
             h+@nada.kth.se  ==  h+@proxxi.se  ==  Jon Watte
                    longer .sig available on request

rob@cs.mu.oz.au (Robert Wallen) (03/27/90)

In article <39844@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:
>Up until 6.0.4, the space reserved for item marks was a hard-coded constant.
>Although it looked a little wierd in the US, the real problem was in other
>countries - if the font was larger than Chicago 12 or draw from right-to-left,
>the overlapping characters made things impossible to read.  I changed the
>offset to be calculated from the font - it's now identical to a space.
>
>Of course, this makes me a little curious - as developers, in the future,
>would you rather that we fix bugs like these, or leave them alone?

How about making the fix backward compatible.  I'd have been happy if you
had special cased Chicago-12/left-to-right text and left the old offset
if it found the 'most-likely-to-be-noticed-and-complained-about' case and
done the special processing for all others...

Of course, I dont know enough about the Script Manager -- can you actually tell
that the text is Chicago or is it just (font==0)