
固定テキスト コントロールは、プロパティ ページにテキストを表示します。 固定テキスト コントロールはパラメータと関連付ける必要はありませんが、必要に応じて、String パラメータの値を固定テキストとして表示することができます。
プロパティ ページに固定テキストを追加するには、PPGLayout.AddStaticText または 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;
}
PPGLayout.AddStaticText または PPGLayout::AddStaticText は、PPGLayout.AddItem または PPGLayout::AddItem を siControlStatic 属性を指定して呼び出すためのショートカットです。
// 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 );
固定テキストはユーザがプロパティ ページのサイズを変更しても禁則処理されないため、PPGLayout.AddStaticText または PPGLayout::AddStaticText の呼び出しで幅と高さを指定することをお勧めします。
固定テキスト コントロールには、PPGLayout.Item または PPGLayout::GetItem プロパティを使用してアクセスします。これにより、固定テキストの PPGItem または PPGItem が返されます。 固定テキストを変更するには、PPGItem.Label または PPGItem::GetLabel または PPGItem::PutLabel プロパティを設定します。
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;
}
String パラメータの値を固定テキストとして表示する場合は、PPGLayout.AddItem または PPGLayout::AddItem を使用して、パラメータ用の固定コントロールを追加します。
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;
}