Contents page

Rules for Tools/ScrollingPopUpMenu()

     APTR ScrollingPopUpMenu(struct Screen screen, APTR list,
                        void (*drawroutine)(),
                        short height, short width, short number)

    `struct Screen *screen'
          Screen to open menu in.

    `APTR list'
          Linked list of your structures.

    `void (*drawroutine)()'
          Routine to draw one list item.

    `short height'
          Pixel height of one item.

    `short width'
          Pixel width of one item.

    `short number'
          Length of displayed list.

     Call `ScrollingPopUpMenu()' whenever the user must select an item
     from a variable length linked list.  Provide
     `ScrollingPopUpMenu()' with `screen', a pointer to the screen
     (`functions->screen') will do,) list, a pointer to the top of your
     linked list, `drawroutine', a routine that draws one list item,
     the `height' and `width' of a displayed list item, and `number',
     the maximimum number of items to display at one time in the list
     (the rest will be hidden under the scroll bars.)
     `ScrollingPopUpMenu()' returns a pointer to the list item the user
     selects or 0, if they don't choose anything.

     drawroutine is passed three parameters: the rastport to draw in,
     the list item to draw, and the y coordinate of the list item
     within the rastport.  The x coordinate is not needed because it is
     always 0.

     Here's an example drawroutine that displays the value of a MIDI
     note Event:

struct RastPort *rastport;      /* Rastport to draw in. */ 
struct NoteEvent *item;         /* Linked list item to draw. */ 
short y; /* Top edge. */ 
    char text[50];

     We can use the above routine to let the user select from a list of
     MIDI Note Events:

  struct NoteEvent  *list;
  struct NoteEvent  *choice;

  choice = (struct NoteEvent  *)(*functions->ScrollingPopUpMenu)