[comp.sys.mac.programmer] How do you make the little 'down'-arrows in pop-up menu boxes?

vrm@blackwater.cerc.wvu.wvnet.edu (Vasile R. Montan) (05/14/91)

I understand that the user interface guidelines for pop-up menus have
been revised.  Originally, the menu box simply had a 2 pixel 'shadow';
now, it is supposed to have a little arrow that points down to the
right of the text in the menu box.

So how is this little arrow generated?  I suppose it wouldn't be too
hard to draw it by brute force (by calling the appropriate QuickDraw
routines), but this involves the hassle of calculating the string
length, etc.  Is there some easier way to generate the arrow?

Thank you!

--Kurisuto
un020070@vaxa.wvnet.edu

glenn@gla-aux.uucp (Glenn Austin) (05/22/91)

In article <1756@babcock.cerc.wvu.wvnet.edu>, vrm@blackwater.cerc.wvu.wvnet.edu (Vasile R. Montan) writes:
> I understand that the user interface guidelines for pop-up menus have
> been revised.  Originally, the menu box simply had a 2 pixel 'shadow';
> now, it is supposed to have a little arrow that points down to the
> right of the text in the menu box.
> 
> So how is this little arrow generated?  I suppose it wouldn't be too
> hard to draw it by brute force (by calling the appropriate QuickDraw
> routines), but this involves the hassle of calculating the string
> length, etc.  Is there some easier way to generate the arrow?

The simple answer is -- use the built-in popup control definition!  It makes
life simpler, and makes it easier if Apple decides to change the user interface
of popups in the future.

===============================================================================
| Glenn L. Austin                | "Turn too soon, run out of room.           |
| Macintosh Wizard and           |    Turn too late, much better fate."       |
| Auto Racing Driver             |   -- Jim Russell Racing School Instructors |
|-----------------------------------------------------------------------------|
| Usenet:  glenn@gla-aux.uucp         | CI$:       76354,1434                 |
| GENie:     G.AUSTIN3                | AOnline:   GAustin                    |
===============================================================================

jeremyr@cs.qmw.ac.uk (Jeremy Roussak) (05/22/91)

In <0E010021.sv4hwa@gla-aux.uucp> glenn@gla-aux.uucp (Glenn Austin) writes:


>> I understand that the user interface guidelines for pop-up menus have
>> been revised.  Originally, the menu box simply had a 2 pixel 'shadow';
>> now, it is supposed to have a little arrow that points down to the
>> right of the text in the menu box.
>> 
>> So how is this little arrow generated?  I suppose it wouldn't be too
>> hard to draw it by brute force (by calling the appropriate QuickDraw
>> routines), but this involves the hassle of calculating the string
>> length, etc.  Is there some easier way to generate the arrow?

>The simple answer is -- use the built-in popup control definition!  It makes
>life simpler, and makes it easier if Apple decides to change the user interface
>of popups in the future.

Unfortunately, it won't work if the popup CDEF isn't there - under system
6, for example.  I use a little PICT of the arrow and draw it at the
right-hand end of the menu's shadowed box.  Not perfect, I admit.

Jeremy Roussak

dorner@pequod.cso.uiuc.edu (Steve Dorner) (05/22/91)

In article <0E010021.sv4hwa@gla-aux.uucp> glenn%gla-aux.uucp@skinner.cs.uoregon.edu writes:

>The simple answer is -- use the built-in popup control definition!

And if you want your app to run under system 6, too?
--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner

TOGE@SLACVM.SLAC.STANFORD.EDU (Nobukazu Toge) (05/27/91)

I seem to remember that the source-code of Disinfectant (available
from anonymous FTP at a NW University site that its author resides)
had an example showing how to do that.  In the code I _THINK_ John
Norstad was explictly draing this tiny triangle and filling it up
black a black pattern.

John's code example (i.e. a stripped-down version of Disinfectant
written in MPW C) gives a wealth of information on how a serious
application may be written.

- Nobu Toge (Stanford Linear Accelerator Center)

#include <StandardDisclaimer.h>

glenn@gla-aux.uucp (Glenn Austin) (05/28/91)

In article <3708@sequent.cs.qmw.ac.uk>, jeremyr@cs.qmw.ac.uk (Jeremy Roussak) writes:
> In <0E010021.sv4hwa@gla-aux.uucp> glenn@gla-aux.uucp (Glenn Austin) writes:
> 
> 
> >> I understand that the user interface guidelines for pop-up menus have
> >> been revised.  Originally, the menu box simply had a 2 pixel 'shadow';
> >> now, it is supposed to have a little arrow that points down to the
> >> right of the text in the menu box.
> >> 
> >> So how is this little arrow generated?  I suppose it wouldn't be too
> >> hard to draw it by brute force (by calling the appropriate QuickDraw
> >> routines), but this involves the hassle of calculating the string
> >> length, etc.  Is there some easier way to generate the arrow?
> 
> >The simple answer is -- use the built-in popup control definition!  It makes
> >life simpler, and makes it easier if Apple decides to change the user interface
> >of popups in the future.
> 
> Unfortunately, it won't work if the popup CDEF isn't there - under system
> 6, for example.  I use a little PICT of the arrow and draw it at the
> right-hand end of the menu's shadowed box.  Not perfect, I admit.

But (1) that is NOT part of the user interface for System 6, and (2) if
you have the Macintosh Communications Toolbox installed, you DO have the
popup CDEF.  (Just another plug for the CTB! ;-)

===============================================================================
| Glenn L. Austin                | "Turn too soon, run out of room.           |
| Macintosh Wizard and           |    Turn too late, much better fate."       |
| Auto Racing Driver             |   -- Jim Russell Racing School Instructors |
|-----------------------------------------------------------------------------|
| Usenet:  glenn@gla-aux.uucp         | CI$:       76354,1434                 |
| GENie:   G.AUSTIN3                  | AOnline:   GAustin                    |
===============================================================================

jeremyr@cs.qmw.ac.uk (Jeremy Roussak) (05/28/91)

In <0E010021.erbovh@gla-aux.uucp> glenn@gla-aux.uucp (Glenn Austin) writes:


>In article <3708@sequent.cs.qmw.ac.uk>, jeremyr@cs.qmw.ac.uk (Jeremy Roussak) writes:
>>
>> Unfortunately, it won't work if the popup CDEF isn't there - under system
>> 6, for example.  I use a little PICT of the arrow and draw it at the
>> right-hand end of the menu's shadowed box.  Not perfect, I admit.

>But (1) that is NOT part of the user interface for System 6, and (2) if
>you have the Macintosh Communications Toolbox installed, you DO have the
>popup CDEF.  (Just another plug for the CTB! ;-)

Surely you aren't advocating lack of consistency?  If the Gods
of the User Interface decree that from a certain date pop-up
menus shall have downward-pointing arrows, I would think that
an application should have those arrows, whether it runs under
system 7 or system 6.  I take you point about the CTB, though,
but isn't it the user who has to have installed it, rather than
the programmer? (forgive ignorance if I'm wrong on this,
please)

Jeremy Roussak