Yes, Combo boxes and GridWidgets are supported by making a custom property then
modifying the PPGlayout with your desired controls. If you want an interactive
PPGLayout where widgets respond to user interaction (enable/disable based on
button click, for example), then you'll need to define PPG Events (callbacks)
which are functions attached to parameters in the PPGLayout that get called
when the user interacts with them. PPG Event logic implementation is language
specific.
Example (JScript):
function Constants()
{
this.PRG = "MyCustomProperty";
this.PPG_WIDTH = 800;
this.PPG_HEIGHT = 600;
this.PPG_LABEL_WIDTH = 90;
this.GRID_HEIGHT = 400;
this.GRID_COLUMN_WIDTHS = "20:350:350"; // first index is the label
column.
this.GRID_COLUMN_READONLY = "1:0"; // data columns only,
excludes label column.
}
CreateMyProperty();
function CreateMyProperty()
{
var oConstants = new Constants();
//-------------------------------
// Create the custom property (temporary property in this case)
//-------------------------------
var oCustomProperty = XSIFactory.CreateObject( "CustomProperty" );
oCustomProperty.Name = oConstants.PRG;
oCustomProperty.AddParameter( "ComboItems", siUInt4, siClassifUnknown,
siSilent, "", "", "", 0, 0, 9999, 0, 9 );
oCustomProperty.AddGridParameter( "Data" );
// Populate the GridData here
var oGridData = oCustomProperty.Parameters( "Data" ).value;
// Must define dimensions of the grid before populating with data
oGridData.RowCount = 0;
oGridData.ColumnCount = 2;
// column labels
oGridData.SetColumnLabel( 0, "Model" );
oGridData.SetColumnLabel( 1, "Item Name" );
// insert the data
for ( var i = 0; i < Selection.Count; i++ ) {
var oSceneItem = Selection(i);
var ModelName = oSceneItem.Model.Name;
var ItemName = oSceneItem.Name;
// insert a new row
oGridData.RowCount++;
// insert data into the row
oGridData.SetRowLabel( i, (i+1) );
var aRowValues = new Array(
ModelName, ItemName
);
oGridData.SetRowValues( i, aRowValues );
}
//-------------------------------
// Create the PPG layout
//-------------------------------
var oPPGLayout = oCustomProperty.PPGLayout;
oPPGLayout.Clear();
// first, the combo box (menu)
oPPGLayout.AddGroup( "Combo Box", true );
// Combo box menu entries as label/value pairs
// label is what you see in the UI,
// value is what is returned to the script when the user selects the
label.
// When calling Customproperty.AddParameter(), the parameter ValueType
should be defined according
// to the type of data you want your script to use. In this case,
4-byte (32 bit) unsigned integers.
// To retrieve the value selected by the user, use
oCustomProperty.Parameters( “ComboItems” ).value;
var aComboItems = new Array(
"None", 0,
"One", 1,
"Two", 2,
"Three", 3,
"Four", 4,
"Five", 5,
"Six", 6,
"Seven", 7,
"Eight", 8,
"Nine", 9
);
var oPPGItem = oPPGLayout.AddEnumControl( "ComboItems",
aComboItems, "Items", siControlCombo );
oPPGItem.LabelMinPixels = oConstants.PPG_LABEL_WIDTH;
oPPGLayout.EndGroup();
// now, the gridwidget
oPPGLayout.AddGroup( "Grid Widget", true );
var oPPGItem = oPPGLayout.AddItem( "Data", "Selected Items",
siControlGrid );
oPPGItem.SetAttribute( siUINoLabel, true
);
oPPGItem.SetAttribute( siUICY, oConstants.GRID_HEIGHT
);
oPPGItem.SetAttribute( siUIGridColumnWidths,
oConstants.GRID_COLUMN_WIDTHS );
oPPGItem.SetAttribute( siUIGridReadOnlyColumns,
oConstants.GRID_COLUMN_READONLY );
oPPGLayout.EndGroup();
//-----------------------------------
// Embed the custom property into a property panel view
// This allows the PPG to be non-modal
//-----------------------------------
// create the view
var oView = Application.Desktop.ActiveLayout.CreateView( "Property Panel",
oConstants.PRG );
// embed custom property into the view
oView.SetAttributeValue( "targetcontent", oCustomProperty.FullName );
// edit the view as a single undoable operation
oView.BeginEdit();
oView.Resize( oConstants.PPG_WIDTH, oConstants.PPG_HEIGHT );
oView.EndEdit();
// display the view
oView.Visible = true;
return;
}
Matt
Stefan Kubicek
2:32 PM (31 minutes ago)
Enums (e.g. selection lists) are supported afaik, but GridData widgets are not.
- hide quoted text -
> I want to create a Custom Parameter set with a pull down selection list
> similar to what is available in Render Tree Property Pages with the Combo
> lists. Is this possible?
>
> --
> Joey Ponthieux
> LaRC Information Technology Enhanced Services (LITES)
> Mymic Technical Services
> NASA Langley Research Center
> __________________________________________________
> Opinions stated here-in are strictly those of the author and do not
> represent the opinions of NASA or any other party.
>
>
--
-------------------------------------------
Stefan Kubicek
-------------------------------------------
keyvis digital imagery
Alfred Feierfeilstraᅵe 3
A-2380 Perchtoldsdorf bei Wien
Phone: +43/699/12614231
www.keyvis.at [email protected]
-- This email and its attachments are --
--confidential and for the recipient only--