SilverScreen Solid Modeler

LocationChange Event

LocationChange Event

Previous topic Next topic  

LocationChange Event

Previous topic Next topic JavaScript is required for the print function  

SilverSharpAPI

 

The LocationChange Event

 

Synopsis

The LocationChange event is raised whenever the position of the 3D cursor changes.

 

 

Delegate

The LocationChange delegate is declared as follows:

 

C# Code

   

 delegate void LocationChangeEventHandler();

 

 

A delegate is similar to a C/C++ function pointer, but delegates are type-safe and can only refer to a method that matches the signature of the delegate. The LocationChange delegate declares a function signature that must be used when installing an event handler for the LocationChange event.

 

 

Event

The LocationChange event is declared within Events as follows:

 

C# Code

   

 static event LocationChangeEventHandler LocationChange;

 

 

An event maintains a list of methods to call when it is raised (usually in response to an important activity). LocationChange allows your application to subscribe to or unsubscribe from the LocationChange event.

 

 

Raise method

The method to raise the LocationChange event is declared within Events as follows:

 

C# Code

   

 static void RaiseLocationChange()

 

 

The SilverSharp assembly will automatically raise the LocationChange event when the 3D Cursor position is changed. It would not be typical for a SilverSharp application to raise the event itself.

 

 

See Also

Events, set_location_change_handler

 

Example

The following code shows a sample LocationChange event handler. Note that the method declaration must match the delegate for this event in parameters and return type:

 

C# Code

   

 using SilverSharp;

 

 . . .

 

 void OnLocationChange()

    {

    // Perform operations dependent upon 3D cursor position

    }

 

 

The following example shows how to subscribe to the LocationChange event, assigning the above handler:

 

C# Code

   

 Events.LocationChange += new LocationChangeEventHandler(OnLocationChange);

 

 

The following example shows how to unsubscribe from the LocationChange event, removing the above handler:

 

 

C# Code

   

 Events.LocationChange -= new LocationChangeEventHandler(OnLocationChange);