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) }
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.
![]() | For detailed information, please refer to PtList in the Photon documentation. |
An array of strings; each string specifies one list item.
A number of pixels specifying the amount of extra spacing between list items. Default is 0.
An array of index numbers corresponding to the list items that are currently selected.
This example, ex_PtList.g, is included in the gamma_ph_#_examples_1_QNX4.tgz file available on the Cogent Web Site.
#!/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();