Args Class
The Args class is used to pass arguments such as a name, a caller, and parameters between application objects.
class Args extends Object
|
Method |
Description |
|---|---|
|
Gets or sets the instance of the object that created this instance of the Args class. | |
|
Cancels a previous method call to the Object.setTimeOut Method. (Inherited from Object.) | |
|
Gets the table ID of the table in which the caller object is working. | |
|
Gets or sets a string that indicates a design on a report or form. | |
|
Determines whether the specified object is equal to the current one. (Inherited from Object.) | |
|
Removes the current instance of the Args class from memory. | |
|
Returns the timer handle for the object. (Inherited from Object.) | |
|
Retrieves the handle of the class of the object. (Inherited from Object.) | |
|
Gets or sets the field ID in a table to use to look up a specified record. | |
|
Finds a record in the specified table. | |
|
Gets or sets a string to use with the LookupField method to find a value in a field of a table. | |
|
Gets or sets the name of a menu item to use to start the application object. | |
|
Gets or sets the type of the menu item to use to start the called application object. | |
|
Gets and sets the name of the application object to call. | |
|
Overridden. Constructs an instance of this class, which is used to pass information to high-level classes such as FormRun and ReportRun. | |
|
Releases the hold on an object that has called a wait method on this object. (Inherited from Object.) | |
|
Releases a lock on the object that was issued by a wait method on this object. (Inherited from Object.) | |
|
Gets and sets the application name of the object of which to open a new instance. | |
|
Determines whether the object is on a server. (Inherited from Object.) | |
|
Returns the instance that owns the object. (Inherited from Object.) | |
|
Gets or sets a string that specifies miscellaneous information for the called object. | |
|
Gets or sets the enumeration value of the enumeration type that is specified in the parmEnumType method. | |
|
Gets or sets the ID value of any enumeration type. | |
|
Gets or sets an instance of any object to pass to the called object. | |
|
Gets and sets the record from the table on which the caller object is working. | |
|
Sets up the scheduled execution of a specified method. (Inherited from Object.) | |
|
Overridden. Returns a string representation of an instance of the Args Class. | |
|
Returns the current number of references (the value of the reference counter) that the object has. (Inherited from Object.) | |
|
Pauses a process. (Inherited from Object.) | |
|
Returns an XML string that represents the current object. (Inherited from Object.) |
Forms, reports, and queries all use this class as the first argument in the constructor. The preferred way to use this class is to construct an Args object, supply a name-string, and then pass the Args object to the forms constructor or a ClassFactory Class method.
There are four methods that can be used to pass extra information to the new class:
-
The parm method – to pass strings
-
The parmEnum and parmEnumType method – to pass enumeration values
-
The parmObject method – to pass an object of any type.
If you need to refer to the Args object passed to a class, it can be reached using the args method of that class.
The instance of the Args class that is sent from the caller can be created automatically by the kernel or explicitly by the caller. When the caller uses a menu item to call an object, an instance of the Args class is created by the kernel code. The menu item name will be set to the name of the menu item used. If the menu item has values for the Parameters, EnumParameter, or EnumTypeParameter properties set, the kernel will set the values of the corresponding Parm, ParmEnum, or ParmEnumType properties for this instance of the Args class.
The following example demonstrates how to explicitly create an instance of the Args class:
public static void main(Args args)
{
BankPaymCancel bankPaymCancel;
Args localArgs = new Args();
;
// Check the instance of the args class passed into this main method.
if (args && args.record())
{
bankPaymCancel = BankPaymCancel::newBankPaymCancel(args.record());
if (bankPaymCancel.prompt())
{
//The following lines set the caller and record methods on the instance of the localArgs class.
localArgs.caller(bankPaymCancel);
localArgs.record(args.record());
BankPaymCancel::serverRun(localArgs);
}
}
}
The following code example consumes an instance of the Args class:
public void init()
{
super();
//Check to see if the parmEnumType method has been set.
if (element.args().parmEnumType())
{
//Get the enum value specified in the parmEnum method.
salesUpdate = element.args().parmEnum();
selectionUpdate.selection(salesUpdate);
}
//Get the TableId value of the table record passed in the record method.
switch(element.args().record().TableId)
{
case tablenum(SalesTable) :
break;
case tablenum(SalesParmTable) :
salesParmTable= element.args().record();
selectionUpdate.allowEdit(false);
selectionUpdate.skip(true);
selectionUpdate.visible(false);
groupSelectionUpdate.visible(true);
break;
case tablenum(SalesBasket) :
salesBasket= element.args().record();
selectionUpdate.allowEdit(false);
selectionUpdate.skip(true);
selectionUpdate.visible(false);
groupSelectionUpdate.visible(true);
break;
}
}