PtList

PtList — A scrollable list of items.

Synopsis

class PtList PtGenList
{
    items;                // string array  (Pt_ARG_ITEMS)    
    list_spacing;         // short  (Pt_ARG_LIST_SPACING)    
    selection_indexes;    // unsigned short array  (Pt_ARG_SELECTION_INDEXES)    
}
		

Base Classes

PtWidget <-- PtBasic <-- PtContainer <-- PtGenList <-- PtList

Description

This widget is a list of items that can be selected individually or in groups. If the number of items exceeds the size of the widget, a scrollbar is created for accessing them. The widget supports several methods for making single and multiple selections, including browse mode and individual, extended, and range selections. The variables for implementing these options are available from the parent widget, PtGenList.

[Note]

For detailed information, please refer to PtList in the Photon documentation.

Instance Variables

items

An array of strings; each string specifies one list item.

list_spacing

A number of pixels specifying the amount of extra spacing between list items. Default is 0.

selection_indexes

An array of index numbers corresponding to the list items that are currently selected.

Callbacks

The following callbacks are associated with this widget:

CallbackDescription
Pt_CB_SELECTIONThis callback is generated when an item is selected from the list.
Pt_CB_LIST_INPUTThis callback is generated from mouse and key events.

Associated Classes

PtComboBox, PtListCallback, PtListInput, PtCallbackInfo

Example

This example, ex_PtList.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
 * This example demonstrates a PtList widget.
 */

require_lisp("PhotonWidgets.lsp");
PtInit(nil);

listitems = array();
for (i=0; i<10; i++)
{
  listitems[i] = string("Item number ", i+1);
}

win = new(PtWindow);

lst = new(PtList);
lst.SetDim(150,100);
lst.items = listitems;

PtAttachCallback(lst, Pt_CB_SELECTION,
		 `princ("The following indexes have been selected: ",
			(@lst).selection_indexes, "\n"));

PtRealizeWidget(win);
PtMainLoop();