/*
This example shows how you can set up a toggle button for
a view by creating a runtime property page with a button
with logic attached that negates whatever the value the
View.Visible property is currently set to.
*/
NewScene("", false);
var oPSet = ActiveSceneRoot.AddProperty("CustomProperty", false, "ViewToggleExample");
// Define layout
var oLayout = oPSet.PPGLayout;
oLayout.AddButton("Toggle");
// Connect the logic
oLayout.Logic = Toggle_OnClicked.toString();
oLayout.Language = "JScript";
// Show the property page and immediately delete it
InspectObj(oPSet, null, "Toggle View Demo", siModal, false);
DeleteObj(oPSet);
// ------------------------------------------------------
// Handler function
function Toggle_OnClicked()
{
var oLayout = Desktop.ActiveLayout;
oLayout.Views(0).Visible = !oLayout.Views(0).Visible;
}
|