07.07.2015 Views

COM/MTS Guide - Prolifics

COM/MTS Guide - Prolifics

COM/MTS Guide - Prolifics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Working with <strong>COM</strong> ComponentsActiveX controls have additional functionality. Their properties are listed in theProperties window and can be accessed at runtime using the property API syntax. Formore information on property access for ActiveX controls, refer to “Setting Propertiesat Runtime” on page 19-6 in Using the Editors.Even though you cannot pass an array as a parameter to these functions, indexedproperties are supported. The following command would get the 6th element of theproperty's array:ret = sm_obj_get_property(id, "Name[6]")Designating an Error HandlerYou can define an error handler for <strong>COM</strong> method invocations, for example:call sm_obj_onerror ("ErrorHandlerName")The string passed to sm_obj_onerror is the name of a function that you want todesignate as the error handler. If a <strong>COM</strong> operation (method call, property access, orobject invocation) generates a negative exception code, the error handler function willbe called. The specified function is passed three parameters: the error number indecimal format, the error number in hexadecimal format, and a description of the error.<strong>COM</strong> methods can also return exception codes using the JPL verb raise_exceptionor its C equivalent sm_raise_exception. You can get the value returned by callingsm_com_result. The function sm_com_result_msg looks up the exception code ina Windows system table and returns the message to which it corresponds.Designating an Event HandlerYou can designate event handlers for <strong>COM</strong> components using sm_com_set_handler.Events are mainly programmed for ActiveX controls in response to user-initiatedevents, such as mouse clicks. For example:call sm_com_set_handler (id, "Event", "EventHandlerName")For more information, refer to “Specifying an ActiveX Event Handler” on page 19-11in Using the Editors.4-6 Building Client Screens

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!