Dynamics ax 窗体/数据源更新通知

在子窗体中定义updatecaller方法

void updateCaller()
{
    Common common;
    Object dataSource;
    Object caller;
    ;

    //-----------------------------------
    // 数据源中代码
    common = element.args().record();
    if (common
        && common.isFormDataSource()
        && formDataSourceHasMethod(common.dataSource(), identifierstr(SomethingWasHappend)))
    {
        dataSource = common.dataSource();
        dataSource.SomethingWasHappend();
    }
    //-----------------------------------

    //-----------------------------------
    //窗体中代码
    caller = element.args().caller();
    if (caller
        && classidget(caller) == classnum(SysSetupFormRun)
        && formHasMethod(caller, identifierstr(SomethingWasHappend)))
    {
        caller.SomethingWasHappend();
    }
    //-----------------------------------
}

  父窗体:

//窗体或者数据源方法

void SomethingWasHappend()

{
    ; 
    info("SomethingWasHappend-窗体或数据源");
}

  子窗体添加按钮,并添加方法:

void clicked()
{
    super();

    element.updateCaller();
}

  

posted @ 2012-10-15 10:18  Huaen  阅读(350)  评论(0编辑  收藏  举报