/
createListView

createListView

Description

Creates a list view user control. List views are different from list boxes in that they can have multiple columns, check boxes, and grid lines.

Functional area

User Window

Command syntax

Syntax

createListView parentWindowID[-hidden] [-pos integer array] [-form integer] [-singleSel] [-checkBoxes] [-headerDragDrop] [-gridLines] [-editable]

Arguments

NameTypeRequiredComments
parentWindowIDintegeryesID of the user window to place the list view on.

Flags

NameFlag argumentsArgument typeExclusive toComments
hidden0Causes the list view to be initially hidden.
pos1integer arrayA four element integer array holding the rectangular coordinates, from the top left corner of the parent window, of the list view. The order of values should be left, top, right, and bottom.
form1integerAdds control as a child of the given form. Forms are used as layout managers for other controls.
singleSel0Makes the list view single-selection. By default, multiple items can be selected.
checkBoxes0Adds a check box in the first column of each item in the list view
headerDragDrop0Allows columns in the list view header to be dragged and dropped in the order of the users choosing.
gridLines0Causes lines to be drawn around items in the list view, giving the appearance of a grid.
editable




Return value

integer

Returns the ID of the list view user control.

Examples

// Demonstrate usage of a list view user control
int $windowID, $listViewID, $formID;
 
// Destroy window if it already exists
if( `windowExists "ListViewTesting"` == true )
{
     destroyWindow "ListViewTesting";
}
 
// Create window and list view and position them
$windowID = `createWindow "ListViewTesting"`;
$formID = `getTopLevelForm $windowID`;
$listViewID = `createListView $windowID -form $formID -checkBoxes`;
setControlAnchor $listViewID "left" "left" 3;
setControlAnchor $listViewID "top" "top" 3;
setControlAnchor $listViewID "right" "right" 3;
setControlAnchor $listViewID "bottom" "bottom" 3;
 
// Create the columns
string $columns[3];
int $widths[3];
$columns[0] = "Name";
$columns[1] = "Age"; 
$columns[2] = "Gender";
$widths[0] = 150;
$widths[1] = 50;
$widths[2] = 100;
setListViewColumns $listViewID $columns $widths;
 
// Add some items to the list view. The text we supply is for the 
// first column. We supply text for subsequent columns using 
// setListViewItemText
addListViewItem $listViewID "Bob";
addListViewItem $listViewID "Mary";
addListViewItem $listViewID "Jim";
addListViewItem $listViewID "Ann";
 
// Set additional details
setListViewItemText $listViewID 0 1 "50";
setListViewItemText $listViewID 0 2 "Male";
setListViewItemText $listViewID 1 1 "32";
setListViewItemText $listViewID 1 2 "Female";
setListViewItemText $listViewID 2 1 "21";
setListViewItemText $listViewID 2 2 "Male";
setListViewItemText $listViewID 3 1 "44";
setListViewItemText $listViewID 3 2 "Female";
 
// Set the check box to true for the males.
setListViewItemCheck $listViewID 0 true;
setListViewItemCheck $listViewID 2 true;
 
// Change Bob's name
setListViewItemText $listViewID 0 0 "Ken";
 
// Select Mary and Jim 
selectListViewItem $listViewID 2 true;
selectListViewItem $listViewID 1 true;
 
// Print out some of what we just did
print( `getListViewSelItems $listViewID` );
print( `getListViewItemText $listViewID 1 2` );
print( `getListViewItemCheck $listViewID 1` );
print( `getListViewItemCheck $listViewID 0` );
layoutForm $formID;

Additional information

Related commands

Related content


© Copyright Vicon Motion Systems. All rights reserved.

Vicon trademarks