/
setListViewHandler

setListViewHandler

Description

Enables you to specify script handlers for list view events. Handlers are scripts of your choosing that get called when an event happens, such as the checked state of an item changing.

Calling this command without specifying any of the flags has the effect of clearing all of the handlers for the list view.

Functional area

User Window

Command syntax

Syntax

setListViewHandler userControlID[-selChange string] [-checkChange string]

Arguments

NameTypeRequiredComments
userControlIDintegeryesID of the user control to operate on

Flags

NameFlag argumentsArgument typeExclusive toComments
selChange1stringSpecify the script to be called when the selection state of items in the list view changes.
checkChange1stringSpecify the script to be called when the checked state of items in the list view changes.

Return value

void

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
$windowID = `createWindow "ListViewTesting"`;
$listViewID = `createListView $windowID -form $formID -checkBoxes`;
 
// Create the columnsstring $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;
 
// Set the script we want to get called when the selection state of 
// one of the items changes
setListViewHandler -selChange "MySelChangeHandler";
 
// Save the value of the list control so we can get it our handler script
setGlobalVar "MyListViewID" $listViewID;
//
///////////////////////////////////////
// In "MySelChangeHandler. This script must exist under one
// of your script directories.
int $listViewID = `getGlobalIntVar "MyListViewID"`;
print( `getListViewSelItems $listViewID` );

Additional information

Related commands

Related content


© Copyright Vicon Motion Systems. All rights reserved.

Vicon trademarks