API Guide > IMathcadPrimeEvents2
IMathcadPrimeEvents2
IMathcadPrimeEvents2 is a COM event interface declared in Ptc.MathcadPrime.Automation.dll, that is available in the PTC Mathcad Prime installation directory. Client applications can handle PTC Mathcad Prime events by using this interface. To do this, register an object that implements IMathcadPrimeEvents2 using the InitializeEvents2 function.
The following COM event interfaces are available with PTC Mathcad Prime:
IMathcadPrimeEvents (obsolete)
IMathcadPrimeEvents2 (expands and supersedes IMathcadPrimeEvents)
* 
PTC recommends using IMathcadPrimeEvents2. The obsolete IMathcadPrimeEvents interface is not documented in this API Guide.
The following events are available with IMathcadPrimeEvents2:
public interface IMathcadPrimeEvents2
{
void OnWorksheetSaved([In] string documentFullNameArg);

void OnWorksheetClosed([In] string documentFullNameArg,
[In] string documentNameArg);

void OnWorksheetModified([In] string documentFullNameArg,
[In] string documentNameArg,
[In] bool isModifiedArg);

void OnWorksheetRenamed([In] string previousFullNameArg,
[In] string currentFullNameArg,
[In] string previousDocNameArg,
[In] string currentDocNameArg);

void OnWorksheetInputsOutputsSelected([In] string documentFullNameArg,
[In] string documentNameArg,
[In] IMathcadPrimeInputs inputsArg,
[In] IMathcadPrimeOutputs outputsArg);
void OnExit();

void OnWorksheetStatesGenerated([In] [MarshalAs(UnmanagedType.BStr)] string documentFullNameArg,
[In] [MarshalAs(UnmanagedType.BStr)] string documentNameArg,
[In] WorksheetOperations operationsArg,
[In] [MarshalAs(UnmanagedType.Interface)] IMathcadPrimeInputsOutputsStates itemsStatesArg,
[In] [MarshalAs(UnmanagedType.Interface)] IMathcadPrimeInputsOutputsConflicts conflictsArg);

void OnWorksheetStatesGenerating([In] string documentFullNameArg,
[In] string documentNameArg,
[In] WorksheetOperations operationsArg,
[In] IMathcadPrimeInputsOutputsStates itemsStatesArg,
[In] IMathcadPrimeInputsOutputsConflicts conflictsArg);

void OnWorksheetRequestToUpdateInputs([In] string documentFullNameArg,
[In] string documentNameArg,
[In] IMathcadPrimeValuesSetter setterArg);
}
Event Syntax and Arguments
OnWorksheetSaved 
Occurs when you save the worksheet.
Syntax
void OnWorksheetSaved([In] string documentFullNameArg);
Arguments
documentFullNameArg—The full name and path of the worksheet.
OnWorksheetClosed 
Occurs when the worksheet is closed.
Syntax
void OnWorksheetClosed([In] string documentFullNameArg,
[In] string documentNameArg);
Arguments
documentFullNameArg—The full name and path of the closed worksheet. If the worksheet is a new, unsaved document, the argument is null.
documentNameArg—The worksheet name.
OnWorksheetModified 
Occurs when the worksheet is modified.
Syntax
void OnWorksheetModified([In] string documentFullNameArg,
[In] string documentNameArg,
[In] bool isModifiedArg);
Arguments
documentFullNameArg—The full name and path of the modified worksheet. If the worksheet is a new, unsaved document, the argument is null.
documentNameArg—The worksheet name.
isModifiedArg:
True—The worksheet is marked as modified.
False—The worksheet is marked as non-modified.
OnWorksheetRenamed 
Occurs when the worksheet is renamed using Save As.
Syntax
void OnWorksheetRenamed([In] string previousFullNameArg,
[In] string currentFullNameArg,
[In] string previousDocNameArg,
[In] string currentDocNameArg);
Arguments
documentFullNameArg—The previous full name and path of the worksheet.
documentNameArg—The current full name and path of worksheet.
previousDocNameArg—The previous name of the worksheet.
currentDocNameArg—The current name of the worksheet.
OnWorksheetInputsOutputsSelected 
Occurs when any inputs and/or outputs are selected in the worksheet.
Syntax
void OnWorksheetInputsOutputsSelected([In] string documentFullNameArg,
[In] string documentNameArg,
[In] IMathcadPrimeInputs inputsArg,
[In] IMathcadPrimeOutputs outputsArg);
Arguments
documentFullNameArg—The full name and path of the worksheet. If the worksheet is a new, unsaved document, the argument is null.
documentNameArg—The worksheet name.
inputsArg—A list of selected inputs.
outputsArg—A list of selected outputs.
OnExit 
Occurs when PTC Mathcad Prime is closed by another COM Client, or through any non-COM method.
The event does not occur when a COM Client closes PTC Mathcad Prime using IMathcadPrimeApplication3.Quit.
Syntax
void OnExit();
OnWorksheetStatesGenerated 
Occurs when states generation is complete.
Syntax
void OnWorksheetStatesGenerated([In] [MarshalAs(UnmanagedType.BStr)] string documentFullNameArg,
[In] [MarshalAs(UnmanagedType.BStr)] string documentNameArg,
[In] WorksheetOperations operationsArg,
[In] [MarshalAs(UnmanagedType.Interface)] IMathcadPrimeInputsOutputsStates itemsStatesArg,
[In] [MarshalAs(UnmanagedType.Interface)] IMathcadPrimeInputsOutputsConflicts conflictsArg);
Arguments
documentFullNameArg—The full name and path of the worksheet.
documentNameArg—The name of the worksheet.
operationsArg—The worksheet operations that triggered the event.
itemsStatesArg—A list of input and output items with their extracted values.
conflictsArg—A collection of conflicts caused by itemsStatesArg.
OnWorksheetStatesGenerating 
Occurs during states generation.
Syntax
void OnWorksheetStatesGenerating([In] string documentFullNameArg,
[In] string documentNameArg,
[In] WorksheetOperations operationsArg,
[In] IMathcadPrimeInputsOutputsStates itemsStatesArg,
[In] IMathcadPrimeInputsOutputsConflicts conflictsArg);
Arguments
documentFullNameArg—The full name and path of the worksheet that is generating the states.
documentNameArg—The name of the worksheet.
operationsArg—The worksheet operations that triggered the event.
itemsStatesArg—A list of input and output items with their extracted values.
conflictsArg—A collection of conflicts caused by itemsStatesArg.
OnWorksheetRequestToUpdateInputs 
Occurs when Mathcad needs new values of input regions.
Syntax
void OnWorksheetRequestToUpdateInputs([In] string documentFullNameArg,
[In] string documentNameArg,
[In] IMathcadPrimeValuesSetter setterArg);
Arguments
documentFullNameArg—The full name and path of the worksheet.
documentNameArg—The name of the worksheet.
setterArg—A setter of new input values. The argument is supplied by the client.
Related Links
Was this helpful?