Contents page

InitListInfo()


    USAGE

        ListItem = (struct ListItem *) InitListInfo(ListInfo)

    FUNCTION

        This initialises a ListInfo structure, allocates Gadget structures for the
        scroll, clickdown, and list gadgets, and draw the list.
        When submitting the ListInfo structure, you must prepare the following
        fields:

              LeftEdge  indicates the left boundary of the list.
               TopEdge  indicates the top boundary of the list.
                 Width  indicates the width of the list.
                Height  indicates the height of the list.
            ItemHeight  specifies how tall each item is. This is divided into Height
                        to determine how many items are displayed at once.
              ScrollID  This is the GadgetID number you would like the scroll bar to
                        have. A scroll gagdget will be created with this number in
                        in its GadgeID field. Later, when your Program receives
                        GADGETUP events with this GadgetID, call ScrollList to scroll
                        the display.
                ListID  This is the GadgetID number for the list display. Later, when
                        your program receives a GADGETUP event with this GadgetID,
                        this will indicate the user is clicking on an item in the
                        list, so call GetListItem which will highlight that item and
                        return a pointer to it.
             ClickUpID  Yet another GadgetID number, this is for the arrow gadget at
                        the top of the scroll bar, indicating the user wants to
                        scroll the display down one. When you receive a GADGETUP
                        event with this id call ClickList.
           ClickDownID  The last GadgetID number, this is for the down arrow below
                        the scroll bar. This is also used to call ClickList.
             BorderPen  The pen number for the border of the box that surrounds the
                        list.
               FillPen  The pen number for the inside of the box.
               TopItem  If you have a list of items to work with, put the pointer to
                        the top one here. If not, this must be NULL.
        TopDisplayItem  This is a pointer to the first item that should be displayed.
                        This might be the top item, or could be somewhere in the
                        middle of the list. If there is no list, make this NULL.
            ActiveItem  This is the currently highlighted item. If there is none,
                        make it NULL.
                Window  You must provide a pointer to the window this list is being
                        displayed in.
           DrawRoutine  This is a pointer to a routine that you provide to display
                        information about an item. When this routine is called later
                        on, it is passed five parameters:
                        * The rastport to draw in.
                        * A pointer to the item to display.
                        * X and Y coordinates for drawing.
                        * A flag that is set to TRUE if this is to be highlighted,
                                                FALSE if not.
                          How you go to highlighted is up to you.

        The remaining parameters should be left alone.
        When you are done displaying the list, call RemoveListInfo to clear it out and
        deallocate the gadgets.

    INPUTS

        ListInfo = Pointer to the ListInfo structure that describes the list.

    RESULT

        ListItem = Pointer to the active (highlighted) item in the list,
                   NULL if none.

    SEE ALSO

        GetListItem, DrawList, ScrollList, ClickList, InsterListItem,
        SetScrollBar, DupeListInfo, DeleteListInfo, RemoveListItem