Показать сообщение отдельно
Старый 05.01.2022, 13:14   #1  
Blog bot is offline
Blog bot
Участник
 
24,922 / 825 (77) +++++++
Регистрация: 28.10.2006
a33ik: Override form control Lookup using extensions
Источник: http://daxonline.org/1740-override-f...xtensions.html
==============

Expand controll Events node and right click on OnLookup and select Copy event handlr method.

To supress standard lookup method and following warning message:

More than one form was opened at once for the lookup control.
Use following code:
FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs; ce.CancelSuperCall();
Full lookup method:
[FormControlEventHandler(formControlStr(AssetParameters, VKInterfacesGroup_VKFixedAssetJournalNameId), FormControlEventType::Lookup)] public static void VKInterfacesGroup_VKFixedAssetJournalNameId_OnLookup(FormControl sender, FormControlEventArgs e) { Query query = new Query(); QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventJournalName), sender); sysTableLookup.addLookupField(fieldNum(InventJournalName, JournalNameId)); sysTableLookup.addLookupField(fieldNum(InventJournalName, Description)); queryBuildDataSource = query.addDataSource(tableNum(InventJournalName)); queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventJournalName, JournalType)); queryBuildRange.value(SysQuery::value(InventJournalType::Asset)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs; ce.CancelSuperCall(); }






Источник: http://daxonline.org/1740-override-f...xtensions.html