Call Statement
Language Items List
Definition:
Transfers program control to and executes an Phoenix method, (i.e Sub or
Function).
Syntax (1):
Call name [(argumentlist)]
Syntax (2)
name [(argumentlist)]
Syntax Description
Call Keyword used to execute a different procedure or DLL, optional.
name Name of the procedure you want to call. Can be a single name or a complex
series.
argumentlist Variables, arrays, or expressions you want to pass to the sub procedure.
Details:
The Call statement can be executed by either including or omitting the
optional Call keyword. If you include the Call keyword when calling a procedure, you
must enclose any arguments that follow in parentheses. If you do not include the
Call keyword, you must also omit the parentheses around any arguments. If the
argument is an entire array, you must use the array name followed by empty
parentheses to pass it to a procedure.
The name argument can be a single name that allows you to make a simple call, such as
calling "Show" while in another method of the Form object. It can also be a
complex series of items as in "Form1.Show()" which means using the object Form1
invokes the Show() method. To make a call involving a complex series, you must
use the dot notation. To use this notation, the items in the series must be
objects, references to objects, or functions that return object references. For
example, Form1.Image1.Picture would first use Form1, a named object, to find an
embedded object named Image1 and then that object would be used to find the
Picture property. So the net result or value of evaluating this series is the
"Picture" property on the Image1 control of Form1.
The following lines show two ways to bring a form to the top:
Example 1: [Call] Form1.BringToTop[()]
Example 2: [Call] BringToTop[()]
The following examples demonstrate how to use the dot notation to move a form
and controls:
Example 1: Form1.Move(0,0,100,100)
Example 2: Call Form1.Move 0,0,100,100
Example 3: Form1.Controls(0).Move(0,0,100,50)
By default, arguments are passed to a procedure by reference. Arguments can
also be passed by value. To pass an argument by value, specify the arguments by
enclosing them in parentheses or declaring them with the ByVal keyword.
Arguments passed by reference allow the sub procedure to modify the actual
contents of the variables passed, because the argument's actual address is
provided by Phoenix. Arguments passed by value are assigned a temporary address, which
prevents the procedure from making any modifications to the values.
When you pass arguments to DLL procedures, you may want to pass them by value.
You can use the ByVal reserved word to declare the arguments at the same time
you declare the DLL procedure. ByVal cannot be used with object reference
variables or arrays. That is, it cannot be used to specify that an object or array
is passed by value.
See Also:
Declare Statement
Sub Statement
Function Statement