通过点击一个FORM的新建按钮,弹出另外一个FORM,相互传值
//点击FORM的新建按钮,触发CREATE方法 public void create(boolean _append = false, boolean bl = false ,boolean CreateNewItemYN=false) { Args args; FormRun formCreate; RGD_PublicationTable newPublicationTable ; MenuFunction PublicationCreate ; ; CreateNewItemYN = false ; if(!CreateNewItemYN && bl == false) { PublicationCreate = new MenuFunction(menuitemDisplaystr(RGD_PublicationCreate),MenuItemType::Display); args = new Args(); args.name(formStr(RGD_PublicationCreate)); args.caller(element); args.parmObject(RGD_PublicationTable_ds); PublicationCreate.run(args); // bl = true ; } else { super(_append); } }
//被弹出的FORM调用的方法
void refreshPublication()
{
RGD_PublicationTable PublicationTable ;
;
select firstonly PublicationTable ;
if(PublicationTable)
{
RGD_PublicationTable_ds.reread();
RGD_PublicationTable_ds.refresh();
}
else
{
RGD_PublicationTable_ds.executeQuery();
}
}
//被弹出的FORM
View Code
public class FormRun extends ObjectRun { RGD_ParmPublicGroup ParmPublicGroup ; Object PublicationTableFormRun ; } //被弹出FORM的初始化方法,获取调用FORM的数据信息和方法 public void init() { super(); if(element.args()) PublicationTableFormRun = element.args().caller(); else throw error('must open from publication !'); } // button click ,back write date and refresh public void closeOk() { FormDataSource formDataSource; Object formDatasourceObj; RGD_PublicationTable PublicationTable ; ; PublicationTable = RGD_ParmPublicGroup.CreatePublicationTable(RGD_ParmPublicGroup.PubliGroup); PublicationTableFormRun = element.args().caller(); if (PublicationTableFormRun) { formDataSource = PublicationTableFormRun.dataSource(1); formDatasourceObj = formDataSource; formDatasourceObj.create(false,true,true); formDataSource.cursor().data(PublicationTable); } formDataSource = PublicationTableFormRun.dataSource(1); formDataSource.reread(); formDataSource.refresh(); formDataSource.findRecord(PublicationTable); element.args().caller().refreshPublication(); super(); }