如何在Dialog中添加checkBox并获取值?

我想在对话框中添加一个CheckBox.

我用过这段代码

Dialog dialog;
DialogField dialogField;
NoYesId checkValue;
;
dialog = new Dialog("New dialog with checkBox");

dialogField = dialog.addFieldValue(identifierStr(NoYes),checkValue);
checkValue= dialogField.value();
dialog.run();
info(strfmt("Value %1",checkValue));

所以,在Debug中我看到变量(checkValue)的值始终为NO.

在网络教程中,我看到了这段代码

dialog.addFieldValue(typeid(NoYes),NoYes::Yes,"tip");

我有一个错误方法typeid不存在.

这是什么方式?
谢谢大家,

请享用!

解决方法

您只能在扩展数据类型(EDT)上使用typeId(AX 2009及更早版本)或extendedTypestr(AX 2012),而不能使用NoYes之类的枚举.它可以在NoYesId上使用,因为它是EDT.
dialog.addFieldValue(typeid(NoYesId),"Check");

您必须先调用run才能有意义地获取值.

Dialog dialog = new Dialog("New dialog with checkBox");
NoYesId checkValue = NoYes::No;
DialogField dialogField = dialog.addFieldValue(extendedTypestr(NoYesId),checkValue,"Check it");
if (dialog.run())
{
    checkValue = dialogField.value();
    info(strfmt("Value %1",checkValue));
}

相关文章

Mip是什么意思以及作用有哪些
怎么测试Mip页面运行情况
MIP安装的具体步骤有哪些
HTML添加超链接、锚点的方法及作用详解(附视频)
MIP的规则有哪些
Mip轮播图组件中的重要属性讲解