在 Dynamics AX 4.0 中为 dialox 创建查找过滤器

发布于 2024-11-14 11:14:42 字数 1481 浏览 3 评论 0原文

我正在尝试在 AX 的对话框中创建自定义查找过滤器。

我已按照这篇文章 x++ 过滤器在对话框中查找中的说明进行操作,并得到了当我运行代码时,堆栈跟踪错误 - FormRun 对象未初始化。

我想做的是根据 ItemId EDT 中的选择过滤 ConfigId EDT 的 Lookup() 。我已经准备好自定义 Lookup() 并正常工作,但我无法从对话框中调用它。

public Object dialog(DialogRunbase _dialog, boolean _forceOnClient)
{
    DialogRunBase   dialog;
    ;

    dialog = super(_dialog, true);

    dialog.caption('@RID2885');

    dfItem = dialog.addField(typeid(ItemId));
    dfInventLoc = dialog.addField(typeid(InventLocationId));
    dfReplaceCost = dialog.addField(typeid(PdsCost));
    dfItemConfig = dialog.addField(typeid(ConfigId));
    dfColorId = dialog.addField(typeid(InventColorId), '@RID101');

    return dialog;
}

这是对lookup()的调用:

void Fld_7_lookup()
{
    Formrun fr = this.dialogModify().parmDialog();
    Object control = fr.controlCallingMethod();    
    ;

    ConfigTable::lookupConfigIdSimple(control, dfItem.value());    
}

这就是它不断收到堆栈跟踪错误的地方:

public void dialogPostRun(DialogRunbase _dialog)
{
    ;
     super(_dialog);
    **_dialog.formRun().controlMethodOverload(true);** // Causes Stack Trace error
    _dialog.formRun().controlMethodOverloadObject(this);       
}

我已尝试使用该对话框进行多种配置。当代码到达该点时,它仍然具有从dialog() 方法传入的信息,但是当它去获取FormRun 时,该对象是空白的。

有人可以帮助我理解为什么没有与传入的 DiaglogRunBase 关联的 FormRun 对象吗?

谢谢。

I'm trying to create a custom lookup filter in a dialog in AX.

I've followed the instructions in this post x++ filter lookup in dialog and am getting a Stack Trace error -- FormRun object not initialized -- when I'm run my code.

What I am trying to do is filter the lookup() for the ConfigId EDT based on the selection from the ItemId EDT. I have the custom lookup() ready to go and working properly, I just can't get it called from my dialog box.

public Object dialog(DialogRunbase _dialog, boolean _forceOnClient)
{
    DialogRunBase   dialog;
    ;

    dialog = super(_dialog, true);

    dialog.caption('@RID2885');

    dfItem = dialog.addField(typeid(ItemId));
    dfInventLoc = dialog.addField(typeid(InventLocationId));
    dfReplaceCost = dialog.addField(typeid(PdsCost));
    dfItemConfig = dialog.addField(typeid(ConfigId));
    dfColorId = dialog.addField(typeid(InventColorId), '@RID101');

    return dialog;
}

Here's the call to the lookup():

void Fld_7_lookup()
{
    Formrun fr = this.dialogModify().parmDialog();
    Object control = fr.controlCallingMethod();    
    ;

    ConfigTable::lookupConfigIdSimple(control, dfItem.value());    
}

And this is where it keeps getting the Stack Trace error:

public void dialogPostRun(DialogRunbase _dialog)
{
    ;
     super(_dialog);
    **_dialog.formRun().controlMethodOverload(true);** // Causes Stack Trace error
    _dialog.formRun().controlMethodOverloadObject(this);       
}

I have tried multiple configurations with the dialog box. When the code reaches that point, it still has information passed in from the dialog() method, but when it goes to get the FormRun, that object is blank.

Could someone please help me understand why there is no FormRun object associated with the DiaglogRunBase that is passed-in?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

早茶月光 2024-11-21 11:14:42

也许您应该在 dialogPostRun 方法中最后调用 super(_dialog)

查看类似的解决方案一个更多

Mayby you should call super(_dialog) last in the dialogPostRun method.

Have a look on a similar solution and one more.

樱花坊 2024-11-21 11:14:42

您是否检查过您的课程是否设置为在“Called From”运行?

这是覆盖修改后的方法的示例代码。也许lookup有相同的要求:

public void dialogPostRun(DialogRunbase _dialog)
{
// Must be overriden to enable overriding modified method
;
    _dialog.dialogForm().formRun().controlMethodOverload(true);
    _dialog.dialogForm().formRun().controlMethodOverloadObject(this);
    _dialog.formRun().controlMethodOverload(true);
    _dialog.formRun().controlMethodOverloadObject(this);

    super(_dialog);
}

对于自定义方法:

boolean Fld2_1_modified()
{
    FormStringControl c = dialog.formrun().controlCallingMethod();
    boolean ret;
    ;

    ret = c.modified(); // Super() Call the FormControl ->modified

    dlgCustomField.value(MyClass::someMethod(dlgCustomField.value())); // example

    return ret;
}

Did you check to see if your class is set to run at "Called From"?

Here is an example code for overriding the modified method. Maybe lookup has the same requirements:

public void dialogPostRun(DialogRunbase _dialog)
{
// Must be overriden to enable overriding modified method
;
    _dialog.dialogForm().formRun().controlMethodOverload(true);
    _dialog.dialogForm().formRun().controlMethodOverloadObject(this);
    _dialog.formRun().controlMethodOverload(true);
    _dialog.formRun().controlMethodOverloadObject(this);

    super(_dialog);
}

And for the custom method:

boolean Fld2_1_modified()
{
    FormStringControl c = dialog.formrun().controlCallingMethod();
    boolean ret;
    ;

    ret = c.modified(); // Super() Call the FormControl ->modified

    dlgCustomField.value(MyClass::someMethod(dlgCustomField.value())); // example

    return ret;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文