PList


This class represents a listbox or a popup list.

Synopsis

#include <PLList.h>

Derivation

  • PControl
  • PList
  • Constructors

        PList(PForm* parent, Word resId)
    
    Constructs a listbox from the resource resId and adds it as a child to parent

    Public functions

        int ind();
    
    Returns the index of the selected item or -1 if none selected. Indexing starts at 0.


        PList& ind(int n);
    
    Selects the n-th item. -1 deselect all. Item count starts at 0.


        PString text();
    
    returns the selected item as PString.


        PList& add(const PString& s)
    
    Adds the string as the last item in the listbox.


        PList& ins(const PString& s, int before)
    
    Inserts the string before the specified index.


        PList& remove(int idx);
    
    Deletes the item at the specified index.


        PList& removeAll(int idx);
    
    Deletes all items.


        int count();
    
    Returns the number of items currently in the listbox.


        PList& scroll(enum directions dir, short lines = 0)
    
    Scrolls the listbox. dir can be either up or down. If lines is omitted, the list scrolls the number of visible lines.


        PList& setTop(int idx)
    
    Set the specified item a the topmost item in the listbox if possible.


        PList& showItem(int idx)
    
    Makes the specified item visible (scrolls if not already shown).


        ListPtr listPtr();
    
    Returns the ListPtr if the parent form is already shown, otherwise it returns 0. This can be used to access PalmOS APIs that are not implemented yet.
    NEVER use the LstSetListChoices API, as this is handled internally by PList objects!!!


    See PControl for inherited public functions.
    Note: The enable(Boolean) and usable(Boolean) functions are private, as they are not accessible in PalmOS.