18.07.2009, 02:28 | #1 |
Участник
|
C# and AX Development: Updating the caller Form/DataSource
Источник: http://olondono.blogspot.com/2009/07...atasource.html
============== If we need to notify events to the caller form we can try this pattern: In the child form, make a method named updateCaller and invoke it when you want to notify the parent: void updateCaller(){ Common common; Object dataSource; Object caller; ; //----------------------------------- //We are notifying using the dataSource common = element.args().record(); if (common && common.isFormDataSource() && formDataSourceHasMethod(common.dataSource(), identifierstr(SomethingWasHappend))) { dataSource = common.dataSource(); dataSource.SomethingWasHappend(); } //----------------------------------- //----------------------------------- //We are notifying using the form caller = element.args().caller(); if (caller && classidget(caller) == classnum(SysSetupFormRun) && formHasMethod(caller, identifierstr(SomethingWasHappend))) { caller.SomethingWasHappend(); } //-----------------------------------} Implement the handling method in the parent form: void SomethingWasHappend(){ ; info("Something was happend (Form)");} Or if you prefer, in the DataSource: void SomethingWasHappend(){ ; info("Something was happend (DataSource)");} Invoking it from a simple button inside the child form: void clicked(){ super(); element.updateCaller();} See a pratical sample in the form MarkupTrans (DataSource -> method write). Источник: http://olondono.blogspot.com/2009/07...atasource.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|