PPGItem

Object Hierarchy | Related C++ Class: PPGItem

Introduced

v4.0

Description

This object represents a component of the user interface of a Property Page. Normally a PPGItem represents a user interface control that is directly related to a Parameter of the object that is inspected. For example a PPGItem of type siControlString would display the value of a String parameter. Similarly a PPGItem of type siControlFCurve would show the FCurve contained inside a FCurve Parameter. The connection between the control and its associated Parameter is established based on the PPGItem.Name.

Other PPGItems do not directly correspond to a parameter, for example Buttons, Tabs and Groups.

Each PPGItem exposes a series of "attributes" that can be used to tweak its appearance. Some of the most common attributes are exposed directly as properties of the object, for example PPGItem.Label, whereas the more specialized or uncommon attributes can be accessed via PPGItem.GetAttribute.

PPGItem objects are accessible via the PPGLayout of a ProjectItem.

Methods

GetAttribute operator SetAttribute operator    
       

Properties

Label operator LabelMinPixels operator LabelPercentage operator Name operator
Type operator UIItems operator WidthPercentage operator  
       

Examples

1. VBScript Example

'example demonstrating using the PPGItem 
'object to set the Labels of an object.
dim oPSet,oPPGLayout, oItem
set oPSet=ActiveSceneRoot.AddProperty("CustomProperty",false,"Demo")
oPSet.AddParameter3 "Check1", siBool
oPSet.AddParameter3 "Check2", siBool
set oPPGLayout = oPSet.PPGLayout
oPPGLayout.AddGroup "", true
oPPGLayout.AddRow
oPPGLayout.AddItem "Check1"
set oItem = oPPGLayout.AddItem( "Check2" )
oItem.Label = "Check Box 2"
oPPGLayout.EndRow
oPPGLayout.EndGroup
'We can look up and change the items afterwards
set oItem = oPPGLayout.Item( "Check1" )
oItem.Label = "Check Box 1"
'Show our PPG
InspectObj oPSet

2. JScript Example

//example building a layout with two Controls for selecting a 
//filepath and one for selecting a folder.
var oPSet=ActiveSceneRoot.AddProperty("CustomProperty",false,"Demo") ;
oPSet.AddParameter3( "ExportFile", siString ) ;
oPSet.AddParameter3( "ImportFile", siString ) ;
oPSet.AddParameter3( "FolderPicker", siString ) ;
var oPPGLayout = oPSet.PPGLayout ;
var oItem = oPPGLayout.AddItem( "ExportFile","Export Filename",siControlFilePath ) ;
// You can use the string directly, or the typdef siUIInitialDir (see siPPGItemAttribute enum)
oItem.SetAttribute( "initialdir", "project" ) ;
oItem.SetAttribute( siUIFileFilter, "Text files (*.txt)|*.txt|All Files (*.*)|*.*||" ) ;
var oItem = oPPGLayout.AddItem( "ImportFile","",siControlFilePath ) ;
oItem.SetAttribute( siUIFileFilter, 
                                "spdl files (*.spdl)|*.spdl|" +
                                "xsiaddon files (*.xsiaddon)|*.xsiaddon|" +
                                "All Files (*.*)|*.*||" );
oItem.SetAttribute( siUIOpenFile, true ) ;
oItem.SetAttribute( siUIInitialDir, "factory" ) ;
oItem.SetAttribute( siUISubFolder, "Application/spdl" ) ;
oItem.SetAttribute( siUIFileMustExist, true );
var oItem = oPPGLayout.AddItem( "FolderPicker", "", "Folder" );
oItem.SetAttribute( siUIInitialDir, "user" ) ;
InspectObj( oPSet );

See Also

PPGLayout PPGLayout.AddItem PPGLayout.Item