The example defines a special Button Class - that opens and closes the
Central tab in Scorpion.

#The bitmap shows the buttom placed on a OverlayPanel connected to a
custompage with name Demo.
import CLR
import CLR.System.Windows.Forms as WinForms
class OpenCentralButton(WinForms.Button):
def __init__(self):
# Create the button
self.Text = "Open Central Start"
# Register event handler for button.Click
self.Click += self.button_ClickHandler
def button_ClickHandler(self, sender, args):
# Handles the button Click event
if self.Text == "Open Central Start":
self.Text = "Close Central Start"
# open service
ExecuteCmd('AccessControl','Service=1')
#activate Service
mp = GetPageControl('pcMain')
mp.activePage = 'Service'
#activate Advanced
sp = GetPageControl('pcService')
sp.activePage = 'Advanced'
# activate Central
sap = GetPageControl('pcServiceAdvanced')
sap.activePage = 'Central'
elif self.Text == "Close Central Start":
self.Text = "Open Central Start"
# open service
ExecuteCmd('AccessControl','Service=0')
mp = GetPageControl('pcMain')
mp.activePage = 'Operation'
|