文章目录
- 前言
- 一、复制onLookUp事件方法
- 二、LookUp方法
前言
在Form的字段的onLookUp方法中,添加下拉框。
一、复制onLookUp事件方法
二、LookUp方法
[FormControlEventHandler(formControlStr(EcoResProductDetailsExtended, VyaKeyItemType_VyaMaterialSubCode), FormControlEventType::Lookup)]public static void VyaKeyItemType_VyaMaterialSubCode_OnLookup(FormControl sender, FormControlEventArgs e){FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;FormRun formRun = sender.formRun();FormStringControl vyaMaterialCodeCtrl = formRun.design().controlName(formControlStr(EcoResProductDetailsExtended, VyaKeyItemType_VyaMaterialCode));str vyaMaterialCodeStr = vyaMaterialCodeCtrl.text();Query query = new Query();QueryBuildDataSource qbds;QueryBuildRange qbr;SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(VyaMaterialsSubCategories), sender);sysTableLookup.addLookupfield(fieldNum(VyaMaterialsSubCategories, VyaCode));sysTableLookup.addLookupfield(fieldNum(VyaMaterialsSubCategories, VyaDescription));qbds = query.addDatasource(tablenum(VyaMaterialsSubCategories));qbr = qbds.addRange(fieldNum(VyaMaterialsSubCategories,VyaParentMaterial));qbr.value(queryValue(vyaMaterialCodeStr));sysTableLookup.parmQuery(query);sysTableLookup.performFormLookup();ce.CancelSuperCall();}