ISDBScriptControl::RegisterEvent

From MediaMonkey Wiki
Revision as of 22:08, 20 April 2013 by Michal.kocarek (talk | contribs) (note about registering events to ui_object.Common)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

CoClass SDBScriptControl, Interface ISDBScriptControl

Sub RegisterEvent(ObjectVar As Object, EventName As String, HandlerName As String)


Parameters

Name Type Description
ObjectVar Object Object of the event
EventName String Event name – check manual for actual event names for given object
HandlerName String Name of the handler procedure as string


Method description

Registers COM object event to be handled by a script.

JScript note: Method does not accept anonoymous functions or callbacks. A handler function must be defined within global script scope. Then handler function's name should be passed to the method.

UI events note: Events from SDBUICommon class should be registered to the ui_object.Common property and not to the ui_object itself.

Example code

VBScript:

Sub ShutdownHandler
  ' Event code goes here...
End Sub

Script.RegisterEvent SDB, "OnShutdown", "ShutdownHandler"

JScript:

function shutdown_handler() {
  // Event code goes here...
};

Script.RegisterEvent(SDB, 'OnShutdown', 'shutdown_handler');