ที่ FormA
void
clicked()
{
// Args class is usually used in Axapta for
passing parameters between forms
Args args;
FormRun formRun;
EmplTable emplTable;
// Our custom made class for passing
complex set of parameters
// FormBParams formBParams = new FormBParams();
//Array items = new Array( Types::String );
// int i;
;
args = new args();
// Our values which we want to pass to
FormB
// If we want pass just simple string we
can use 'parm' method of 'Args' class
//-------------------------ส่ง parameter แบบ String,Enumและ Record----------------------
args.parm(CustTable.Name );
// We also can pass enum value to FormB
args.parmEnum( NoYes::Yes );
args.parmEnumType( EnumNum( NoYes ) );
// and also can pass a cursor pointing to
some record (in our case it is EmplTable )
args.record( CustTable );
// Run FormB
args.name( formstr( FormB ) );
formRun = classFactory.formRunClass( Args
);
formRun.init();
formrun.run();
formrun.wait();
/*
if( formrun.closedOk() )
{
//answerFromFormB.text( args.parm() );
info(strfmt("%1",args.parm()));
}
*/
super();
}
ที่ FormB
void clicked()
{
CustTable CustTableRecord;
//FormBParams formBParams;
Array items;
int i;
;
super();
// Check for passed arguments
if( element.args() )
{
// get string parameter
info(strfmt("%1",(element.args().parm())));
if( element.args().parmEnumType() ==
EnumNum( NoYes ) )
{
info(strfmt("%1",(
element.args().parmEnum())));
}
// get record parameter
if( element.args().record() &&
element.args().record().TableId == TableNum( CustTable ) )
{
CustTableRecord = element.args().record();
// emplName.text(
emplTableRecord.Name );
info(strfmt("%1 :
%2",CustTableRecord.AccountNum,CustTableRecord.Name));
}
}
}
static void OpenFormByCode(Args _args)
ตอบลบ{
FormRun fr;
Args args = new Args();
;
args.name(formstr(CustTable));
fr = classfactory.formRunClass(args);
fr.init();
fr.run();
fr.detach();
}
void clicked()
ตอบลบ{
Args args;
FormRun formRun;
;
args = new args();
args.parm(CustTable.Name );
args.parmEnum( NoYes::Yes );
args.parmEnumType( EnumNum( NoYes ) );
args.record(CustTable);// args จัดการกับ record
args.name( formstr( TestCustTableReceiveParm ) ); //args ไปเรียกฟอร์ม
formRun = classFactory.formRunClass( Args ); // object Formrun จัดการ args
formRun.init();
formrun.run();
formrun.wait(); //ให้ฟอร์มพักหน้าจอไว้
super();
}
void clicked()
{
CustTable CustTableRecord;
;
super();
// Check for passed arguments
if( element.args() )
// get string parameter
info(strfmt("%1",(element.args().parm())));
if( element.args().parmEnumType() == EnumNum( NoYes ) )
info(strfmt("%1",( element.args().parmEnum())));
// get record parameter
if( element.args().record() && element.args().record().TableId == TableNum( CustTable ) )
CustTableRecord = element.args().record();
// emplName.text( emplTableRecord.Name );
info(strfmt("%1 : %2",CustTableRecord.AccountNum,CustTableRecord.Name));
// element.
}