Call-back methods

Call-back methods
Sometimes it is useful to call methods on the parent/caller of your class. If you are using the runbase framework you can call accessors methods from the form that called your run method to initialize a new object.

In general, you should use the formHasMethod method to first ensure the required method actually exists on the caller. You can then call the method by ensuring that you are operating on an object of type object. In the example below, _args.caller will return an Object. If this is not the case, then a compile error will almost certainly result.

public static void main(Args _args) {   str callerName; ;   if(_args.caller != null) {       callerName = _args.caller.name;

if(_args.dataset == tableNum(BankAccountTrans) &&           formHasMethod(_args.caller, identifierStr(bankAccountStatement)))//check the form for an accessor method for the statement {           statement = _args.caller.bankAccountStatement;//get the bankStatment from the accessor method engine = new BankRecEngine(_args,_args.record, statement.AccountId);//create a new runbase, fill params from the form calling this runbase

if(engine.prompt)//ask the user for information {               engine.run; }      }

} }