v4.0
Returns or sets the current tab visible on the property page as a String. The tab is identified by its label (see PPGLayout.AddTab).
// Demonstration of the ability to manipulate Tabs on
// a PPG from within PPG logic code.
//
// It is possible to find out what tab is active,
// change the tab, and to get notified when the tab changes.
// Create a basic Custom PSet that doesn't even have any parameters,
// just layout elements.
var oPSet = ActiveSceneRoot.AddProperty( "CustomProperty",false,"TabDemo" )
var oLayout = oPSet.PPGLayout
oLayout.AddTab( "Tab 1" );
oLayout.AddButton( "Tab1Button", "Next" );
oLayout.AddTab( "Tab 2" );
oLayout.AddButton( "Tab2Button", "Previous" );
oLayout.AddTab( "LeaveMeAlone" ) ;
oLayout.AddButton( "NeverSeen" );
oLayout.Language = "JScript";
oLayout.Logic = OnInit.toString() +
Tab1_OnTab.toString() +
Tab2_OnTab.toString() +
LeaveMeAlone_OnTab.toString() +
Tab1Button_OnClicked.toString() +
Tab2Button_OnClicked.toString() ;
InspectObj( oPSet )
//
// The following is the logic code that
// controls the behavior of the PPG.
//
function OnInit()
{
// Note: Currently it is not possible to change
// tabs during the OnInit callback
}
function Tab1Button_OnClicked()
{
// "Next" button
PPG.CurrentTab = "Tab 2" ;
}
function Tab2Button_OnClicked()
{
// Move to the Previous tab
PPG.CurrentTab = "Tab 1" ;
}
function Tab1_OnTab()
{
// Called when Tab1 gets clicked
// and when we first open the PPG.
// (But not called when we change
// the tab programmatically.)
// Notice how the space in the tab label ("Tab 1")
// has been removed to generate the callback name
// ("Tab1_OnTab")
Logmessage( "Current tab is: " + PPG.CurrentTab ) ;
}
function Tab2_OnTab()
{
Logmessage( "Now current tab is: " + PPG.CurrentTab ) ;
}
function LeaveMeAlone_OnTab()
{
// Rather a harsh user interface -
// prevent users from going to this
// tab. This might be useful when implementing
// a Wizard-style workflow
PPG.CurrentTab = "Tab 1" ;
}
|