Static Text

 

Static text controls display text on property pages. Static text controls do not have to be associated with a parameter, but if you want, you can display the value of a String parameter as static text.

To add static text to a property page, use PPGLayout.AddStaticText.

function EmbeddedSynoptic_DefineLayout( ctxt )
{
   var oLayout,oItem;
   oLayout = ctxt.Source;
   oLayout.Clear();

   // UI text that explains how to use the synoptic view
   oLayout.AddStaticText( 
          "Click the sphere to translate the object by the specified increment.\n" + 
          "Click the large cone to reset the translations."
          0,     // Use default width
          0      // Use default height
          );

   return true;
}

AddStaticText is a shortcut for calling PPGLayout.AddItem with the siControlStatic attribute:

// Use the name "Static" to display static text on the ppg
// The second parameter, which usually specifies the label, is the static text

oLayout.AddItem( "Static", "Static Text", siControlStatic );
oLayout.AddItem( "Static", "More Static Text", siControlStatic );

Static text does not word wrap when a user resized the property page, so you may want to specify a width and height in the call to AddStaticText.

You access a static text control through the PPGLayout.Item property, which returns the PPGItem for the static text. To change the static text, set the Label property:

function EmbeddedSynoptic_OnInit( )
{
   // The static text we want to display
   // Use "\n" to insert a line break
   var sUIText = "Click a sphere to translate " + 
                 PPG.Inspected(0).Parent +
                 " by the specified increment.\n" + 
                 "Click the large cone to reset the translations.";

   // Set the static text
   // Static text controls are named "Static"
   PPG.PPGLayout.Item("Static").Label = sUIText;

   // If you have more than one static text control,
   // use the index number instead of the name "Static".
   // The index numbers correspond to the order
   // in which the controls were added to the layout.
// PPG.PPGLayout.Item(0).Label = sUIText;

}

If you want to display the value of a String parameter as static text, use AddItem to add a static control for the parameter.

function MyProperty_Define( ctxt )
{
   var oCustomProperty;
   oCustomProperty = ctxt.Source;
   oCustomProperty.AddParameter2("Param1",siString,"This is a Text parameter",null,null,null,null,0,siPersistable);
   return true;
}

function MyProperty_DefineLayout( ctxt )
{
   var oLayout;
   oLayout = ctxt.Source;
   oLayout.Clear();

   // Add a static control for the string parameter Param1
   // No label required: the control displays the parameter value
   oLayout.AddItem( "Param1", "", siControlStatic );

   return true;
}

 

You can break static text into several lines by using line-return characters (for example, \n for most languages and vbCRLF in VBScript).

The following item attributes are available:

Available on all Controls also as a
property on the PPGItem object:

Common to many Controls:

siUILabel

siUIItems

siUIType

siUIWidthPercentage

siUILabelPercentage

siUILabelMinPixels

siUINoLabel

siUIValueOnly

siUIContinue

siUICX

siUICY



Autodesk Softimage v7.5