[TOC] [Prev] [Next] [Bottom]

<@CALLMETHOD>

Syntax

<@CALLMETHOD OBJECT=variable METHOD=method&parameters [SCOPE=scope] [METHODTYPE=get|set|invoke] [PARAMTYPES=paramtypes]>

Description

This meta tag calls a specified method of an object.

The OBJECT attribute defines the name of a variable containing an object instance. The optional SCOPE attribute defines the scope of the variable.

The METHOD attribute defines the name of the method to call and the parameters. The METHOD attribute is of the following form:

methodname(param1, param2, ...)

For COM and JavaBean methods, the method name is case-sensitive.

A parameter must be quoted (single or double quotes) if it contains a comma or has significant spaces at the beginning or end, but otherwise quoting is unnecessary. Literal quotes in parameter values must be specified using the <@SQ> and <@DQ> meta tags. Initial and trailing spaces outside of quotes are ignored.

Overloaded Methods and PARAMTYPE

An overloaded method occurs when an object has more than one method with the same name. These methods have different parameter lists.

The PARAMTYPES attribute must be specified for overloaded methods. This attribute is specified as a comma-delimited list of data types which have a one-to-one correspondence with the parameters specified in the METHOD attribute. If the attribute is not specified for overloaded methods, the method call may fail because Tango Server does not know which method of the object to call (it chooses the first one).

Type Conversion

At execution time, if the PARAMTYPES attribute is not specified, Tango Server introspects the named method to determine the data types of its parameters and does the necessary conversion.

Passing Parameters "By Reference"

For more information, see <@VARPARAM>.

Values from an out or in/out parameter are obtainable by binding the parameter to a Tango variable using the <@VARPARAM> meta tag. Object variables and arrays may be passed with <@VARPARAM> as well. This is equivalent to using the Variable option in the Format column of the Call Method action parameter. For more information on the Call Method action, see Chapter 22 of the User's Guide.


! Note: The <@VARPARAM> meta tag must be used with parameters of type Variant (COM-only).


The METHODTYPE attribute specifies one of GET, SET, or (the default) INVOKE. The METHODTYPE attribute must be specified for getter and setter methods in order to prevent ambiguity of method names (a standard method called GetProperty would, at least with COM, conflict with the getter for the property property).

Meta tags are allowed in all attribute values. The return value of the tag is the return value of the method call.

Example

<@CALLMETHOD OBJECT=myObject METHOD='foo(1,"test")'>

Calls the method foo with the specified parameters on the myObject object instance variable.

<@CALLMETHOD OBJECT=myCOMObject METHOD="ContentID()" METHODTYPE=GET>

This example gets the value of the ContentID attribute of the myComObject instance. The GET is omitted from the name which appears in Tango Editor's Attributes folder for that object.

Examples of METHOD specifications using <@VARPARAM>:

<@CALLMETHOD OBJECT=myVar METHOD=foo(<@VARPARAM NAME=myFirstParam SCOPE=local>, secondparam)>

The value for the first parameter comes directly from the myFirstParam local variable. After execution, the variable contains the output for that parameter.

<@CALLMETHOD OBJECT=myVar METHOD=foo(<@VARPARAM NAME=user$myVar DATATYPE=LONG>)

If the first parameter of foo expects a Variant, this METHOD specification causes the data in myVar to be passed as a long.

See Also

<@CREATEOBJECT>
<@GETPARAM>
<@NUMOBJECTS>
<@OBJECTAT>
<@OBJECTS></@OBJECTS>
<@SETPARAM>
<@VARPARAM>



[TOC] [Prev] [Next] [Bottom]

docs@pervasive.com
Copyright © 1999, Pervasive Software. All rights reserved.