Public Member Functions
EventInfo Class Reference

Detailed Description

The EventInfo class contains the information on a particular event such as its mute value, event handler, etc.

You access the name and the type of the event with SIObject::GetName and SIObject::GetType. Use EventInfo::PutMute to enable or disable events. EventInfo objects are created with Application::GetEventInfos.

See also:
Application::GetEventInfos
Since:
5.0
Example:
Demonstrates how to create EventInfo objects and to access event information.
        using namespace XSI;

        // Function prototype for creating an event plug-in
        CString LoadEventPluginHelper();

        // Load the sample event plug-in
        CString strEventPlugin = LoadEventPluginHelper();

        // Iterate over the EventInfo Objects
        Application app;
        CRefArray eventInfoArray = app.GetEventInfos();

        for (LONG i=0; i<eventInfoArray.GetCount(); i++ )
        {
            EventInfo eventInfo = eventInfoArray[i];

            LONG lToken = eventInfo.GetToken();
            app.LogMessage( L"event token identifier: " + CString(lToken) );

            CString str = eventInfo.GetName();
            app.LogMessage( L"event name: " + str );

            str = eventInfo.GetType();
            app.LogMessage( L"event type: " + str );

            str = eventInfo.GetHandler();
            app.LogMessage( L"event handler: " + str );

            str = eventInfo.GetFileName();
            app.LogMessage( L"event handler file name: " + str );

            str = eventInfo.GetLanguage();
            app.LogMessage( L"event handler implementation language: " + str );

            bool bMute = eventInfo.GetMute();
            app.LogMessage( L"event is muted: " + CString(bMute) );
        }

        // Unload the plugin and deletes it
        app.UnloadPlugin( strEventPlugin, true );

        CString LoadEventPluginHelper()
        {
            // Loads the sample event plug-in if one is defined
            Application app;
            CString strEventPlugin = app.GetInstallationPath(siUserPath);
        #ifdef unix
            strEventPlugin += L"/Application/Plugins/SimpleEventPlugin.js";
        #else
            strEventPlugin += L"\\Application\\Plugins\\SimpleEventPlugin.js";
        #endif

            Plugin myEventPlugin = app.LoadPlugin( strEventPlugin );

            if (myEventPlugin.IsValid())
            {
                return strEventPlugin;
            }

            // Gets the event wizard property
            CommandArray cmdArray = app.GetCommands();
            Command cmd = cmdArray.GetItem( L"CreateEventWizard" );

            CValue retVal;
            cmd.Execute(retVal);

            CustomProperty eventWizard(retVal);

            // Set the plug-in info
            eventWizard.PutParameterValue(L"PluginName", CString(L"MySimpleEventPlugin") );
            eventWizard.PutParameterValue(L"FileName", CString(L"SimpleEventPlugin") );
            eventWizard.PutParameterValue(L"ScriptLanguage", CString(L"JScript") );

            // Tell the wizard to register the following events
            eventWizard.PutParameterValue(L"siOnKeyUp", true );
            eventWizard.PutParameterValue(L"siOnKeyUpName", CString(L"MyOnKeyUpEvent") );
            eventWizard.PutParameterValue(L"siOnKeyDown", true );
            eventWizard.PutParameterValue(L"siOnKeyDownName", CString(L"MyOnKeyDownEvent") );

            // For the purpose of this example we use internal commands that are
            // part of the Event Wizard implementation to generate a plug-in
            // containing the new events

            cmd = cmdArray.GetItem( L"EventWizardGenerateCode" );

            cmd.Execute(retVal);

            // Load the plug-in
            app.LoadPlugin( strEventPlugin );

            return strEventPlugin;
        }

#include <xsi_eventinfo.h>

Inheritance diagram for EventInfo:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 EventInfo ()
 ~EventInfo ()
 EventInfo (const CRef &in_ref)
 EventInfo (const EventInfo &in_obj)
bool IsA (siClassID in_ClassID) const
siClassID GetClassID () const
EventInfooperator= (const EventInfo &in_obj)
EventInfooperator= (const CRef &in_ref)
LONG GetToken () const
CString GetHandler () const
CString GetFileName () const
CString GetLanguage () const
CStatus PutMute (bool in_bVal)
bool GetMute () const

Constructor & Destructor Documentation

EventInfo ( )

Default constructor.

~EventInfo ( )

Default destructor.

EventInfo ( const CRef in_ref)

Constructor.

Parameters:
in_refconstant reference object.
EventInfo ( const EventInfo in_obj)

Copy constructor.

Parameters:
in_objconstant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassIDclass type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from SIObject.

Reimplemented in TimerEvent.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from SIObject.

Reimplemented in TimerEvent.

EventInfo& operator= ( const EventInfo in_obj)

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_objconstant class object.
Returns:
The new EventInfo object.
EventInfo& operator= ( const CRef in_ref)

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_refconstant class object.
Returns:
The new EventInfo object.

Reimplemented from SIObject.

Reimplemented in TimerEvent.

LONG GetToken ( ) const

Returns the connection token for this event. Once an event is bound to an event handler function, XSI creates a connection token that uniquely identifies this connection.

Returns:
Token identifier (LONG).
CString GetHandler ( ) const

Returns the name of the event handler function used for responding to the event.

Returns:
Handler name as CString.
CString GetFileName ( ) const

Returns the name of the file implementing the event handler function.

Returns:
Handler file name as a CString.
CString GetLanguage ( ) const

Returns the language name used to implementing the event handler function. VBScript, JScript, PerlScript, Python and C++ are all valid languages.

Returns:
Language name as a CString.
CStatus PutMute ( bool  in_bVal)

Enables or disables the event. When set to true the event is muted (disabled). All handlers connected to a muted event are simply ignored by XSI when the event is fired.

Parameters:
in_bValTrue to disable the event, false to enables it
Returns:
CStatus::OK Success.
bool GetMute ( ) const

Returns whether this event is muted.

Returns:
True for muted (disabled)

The documentation for this class was generated from the following file: