caller in args

本文详细介绍了Args类的作用及使用方法,包括如何通过Args类传递构造函数参数、枚举类型及对象等信息。此外还介绍了如何利用caller方法获取调用者信息,并通过实例演示了在不同表单或类间传递信息的具体应用。
 
First let learn what is a args:
The Args class is used to pass arguments to a class-constructor. Args can pass information such as name, caller, and parameters to a new class.
Forms, reports and queries all use this class as their first argument in the constructor. The preferred way to use this class is to construct an Args object, supplying a name-string, and then pass this Args object to the forms constructor or a ClassFactory Class method.
If you need to refer to the Args object passed to one of these classes, it can be reached using that class' args() method.
There are four methods that can be used to pass extra information to the new class:
·   Args.parm Method - for passing strings
·   Args.parmEnum Method and Args.parmEnumType Method - for passing enums
·   Args.parmObject Method - for passing an object of any type.
For example:
{
    Args a = new Args("CustTable");
    formRun fr = ClassFactory.FormRunClass(a);
    fr.init();
    fr.run();
}
Caller:
public Object caller([Object value])
while your call a form or report via a menu item the system will pass it automatically,in the called form you can use method like this to access it:
     Object _object;
    _object = element.args().caller();
You can also use the caller manually.For example:
In a class,there is a methos:
Public void demo()
{
Args args;
FormRun formRun;
;
Args = new Args(FormStr(“myformname”));
Args.caller(this);
Formrun = classFactory.formClassRun(args);
Formrun.init();
Formrun.run();
Formrun.wait();
}
When this method is called ,the form:myformname ran.And in this running form:myformname we can access the class whick called this form like this:
void init()
{
         Object _object;
         ;
         Super();
         _object = element.args().caller();
         //then we can use methods in the class:
         _object.methodname();//when you press the’.’the method name will not automatically appear.
}
this is very usefull when you have a variable or any other things in a Form A,and you need the Form B modify this variable ,but after the Form B modified the variable you need use this variable in Form A.
for example in form A you have a class classa which hold those usefull variables,you use the classa call the form b,and pass classa as a caller,after the form b modified the classa the form b closed,then you can access those variables in the classa in form a.
Traceback (most recent call last): File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\multiprocessing\process.py", line 313, in _bootstrap self.run() File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\mmdeploy\apis\core\pipeline_manager.py", line 107, in __call__ ret = func(*args, **kwargs) File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\mmdeploy\apis\pytorch2onnx.py", line 98, in torch2onnx export( File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\mmdeploy\apis\core\pipeline_manager.py", line 356, in _wrap return self.call_function(func_name_, *args, **kwargs) File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\mmdeploy\apis\core\pipeline_manager.py", line 326, in call_function return self.call_function_local(func_name, *args, **kwargs) File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\mmdeploy\apis\core\pipeline_manager.py", line 275, in call_function_local return pipe_caller(*args, **kwargs) File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\mmdeploy\apis\core\pipeline_manager.py", line 107, in __call__ ret = func(*args, **kwargs) File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\mmdeploy\apis\onnx\export.py", line 122, in export torch.onnx.export( File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\torch\onnx\__init__.py", line 271, in export return utils.export(model, args, f, export_params, verbose, training, File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\torch\onnx\utils.py", line 88, in export _export(model, args, f, export_params, verbose, training, input_names, output_names, File "D:\Anaconda\envs\RF1_multichannel_ceshi\lib\site-packages\torch\onnx\utils.py", line 694, in _export _model_to_graph(model, args, verbose, input_names
05-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值