DIAdem Help

Content Type
Programming Language
Current manual

Event: OnActiveSheetChanged

Event: OnActiveSheetChanged

Runs in DIAdem VIEW when the active worksheet changes.

The event starts the user command that you assigned to the property OnActiveSheetChanged. If the script of the user command contains an error, DIAdem aborts the script without an error message. The DIAdem logfile contains information on the error.

The user command receives two parameters: Both parameters each correspond to the Sheet object. When the user command is called the first parameter contains the new worksheet and the second parameter the old worksheet. The second parameter is optional, for example, during an initialization.

Refer to Working with Events in DIAdem for further information on events in DIAdem.

Object.OnActiveSheetChanged
ObjectEvents
Object with this event
Object.OnActiveSheetChangedString with read and write access
Note  To test the example script, you must first save the script and register it as a user command in the dialog box that opens when you select Settings»Extensions»User Commands.

The following example executes the user command TransCursor to change the active worksheet. The user command transfers the cursor settings from the present worksheet to the new worksheet:

VBScriptPython

 

Call AddUserCommandToEvent("View.Events.OnActiveSheetChanged","TransCursor")

Sub TransCursor(oNewSheet, oOldSheet) 
  oNewSheet.Cursor.Mode = oOldSheet.Cursor.Mode 
  oNewSheet.Cursor.Type = oOldSheet.Cursor.Type 
  oNewSheet.Cursor.X1 = oOldSheet.Cursor.X1 
  oNewSheet.Cursor.Y1 = oOldSheet.Cursor.Y1 
  oNewSheet.Cursor.X2 = oOldSheet.Cursor.X2 
  oNewSheet.Cursor.Y2 = oOldSheet.Cursor.Y2 
  oNewSheet.Cursor.P1 = oOldSheet.Cursor.P1 
  oNewSheet.Cursor.P2 = oOldSheet.Cursor.P2 
End Sub

Note Use the AddUserCommandToEvent command to assign several user commands to one event. Use the RemoveUserCommandFromEvent command to delete a single user command from a list of user commands which you assigned to an event. Assign an empty string to an event so that the event is no longer assigned to a user command.

In This Section
Was this information helpful?