Method Call Syntax

Previous Next

See Also

In simple cases, method calls have the following syntax:

[<object name>.]<method name> ([<parameter 1> [,<parameter 2>...]])

Note that parentheses () are mandatory in method calls.

Object name

This is the name of the object, which is the context of the method, as it can be obtained in the Object Activator.

· To call a specific method exposed by some object within the class currently being designed; the object name is used to identify this object. ControlSetActiveTab(<tab page>) is an example of a specific method exposed by a Tab object.

 

· To call a specific method exposed by some object OUTSIDE the class currently being designed, first analyze the situation and create user-defined properties. For more information, see Method Calls Between Windows.

 

· To call a method of the class currently being designed, you do not need to specify the context. By default, the object is the class currently being designed. For example, in an info box class with an embedded child box; the default context of a method is the info box even when a method is triggered from a button within the child box.

 

· To call a method at application level, precede the method with the Application object, for example:

Application.ErrorRaise()

Object names in method calls cannot contain spaces. Use an underscore (_) instead of a space. If you use the Object Activator to compose method calls, this happens automatically.

For example, the Object Activator will display an inserted instance of the MyBrowser web browser control as:

MyBrowser_1

If you inserted the browser control on a tab page, the object name will look like:

Tab_1.Page_1.MyBrowser_1

Method name

This is the name of the method you want to call.

Use the Object Activator to find out about methods exposed by objects. First click the object in the Object Browser pane. The methods the object exposes are now listed on the Methods tab page. Methods exposed by all objects are on the Application Methods tab page.

For example, the Microsoft Web Browser control exposes a Navigate method that allows you to tell it that it should browse to a web page. You can call this method by writing

MyBrowser_1.Navigate(<parameter(s)>)

Properties are a special case of methods. You can get a property value by calling the property without parameters. You can (re)set the value of a property by calling the property with a value:

Info_Box_1.displayHeight()

query.name.value('SMITH')

Parameters

Many methods expect one or more parameter values when they are called.

For example, the Navigate method of the Microsoft Web Browser control expects a URL (Universal Resource Locator) string as a parameter value. If you want to design a button that makes the web browser go to the USoft web site, compose the following method call as the value of the button's Action property:

MyBrowser_1.Navigate('www.usoft.com')

Strings are surrounded by single quotes as shown in this example. The Object Activator automatically quotes strings. Embedded single quotes must be written as two separate, consecutive single quotes:

Variables.Text_Box_1('Rosemary''s Baby')

When a parameter is not surrounded by single quotes, USoft will assume that it is an embedded method call which produces a string output. The string output will then function as the string parameter of the main method call. For example:

MyBrowser_1.Navigate(Variables.Text_Box_1())

To find out about expected mandatory or optional parameters, use USoft reference documentation for native methods and third-party object-specific documentation for methods of ActiveX objects.

Related Topics

Method Calls versus Actions

Getting a Property Value Using a Method Call

Setting a Property Value Using a Method Call

Argument Types in Method Calls

Type Mismatches in Method Calls

Syntax of Complex Method Calls

Method Calls Embedded in SQL

Method Calls Between Windows

Permanent Window Interaction

User-Defined Global Variables in Method Calls

System-Defined Global Variables in Method Calls