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> ComponentsIf a component is running under <strong>MTS</strong>, its life cycle can be managed for you by <strong>MTS</strong>,depending on whether the component is marked as belonging to a transaction andwhether the work in the transaction is complete.In our sample screens, the components are programmatically destroyed during screenexit:proc exitcall sm_obj_delete_id(id)returnAccessing the Component's MethodsIn order to access a <strong>COM</strong> component's methods, you need to know the component'sparameters and call the function sm_obj_call. The syntax in JPL is as follows:ret = sm_obj_call (objid, methodName, parm1, parm2, ....)The function's first parameter is the object ID of the component whose method youwish to use. The second parameter is the name of the method you are calling. The restof the parameters are a comma-separated list of the parameters to the method itself.Specifying the method's parameters<strong>COM</strong> components can take three kinds of parameters: in parameters, out parametersand in/out parameters. Parameters can be passed as literal strings or using the propertyAPI syntax. For out and in/out parameters, Panther assigns the returning values tothe variables, fields or properties originally specified.For example, you have a component called cEmployee that supports a method callednewEmployee. newEmployee takes three parameters in the following order:! An out parameter EmpId, which places its return value in a field on the clientscreen.! An in/out parameter EmpName, which derives its input value from a field onthe client screen.! An in parameter StartDate, which derives its input value from a field on theclient screen.You can invoke NewEmployee method with the following JPL:<strong>COM</strong>/<strong>MTS</strong> <strong>Guide</strong> 4-3

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

Saved successfully!

Ooh no, something went wrong!