Group Checkboxes in Dialog

Hi,

I was wondering is it possilble to group checkboxes in Dialog ( RunBase)?
For example I have Checkbox Apple, Pear, Potato.

protected Object dialog(DialogRunbase _dialog, boolean forceOnClient)

{ Dialog dialog;

;

dialog = super();

appleDialog = dialog.addFieldValue(TypeId(NoYes),NoYes::YES,“Apple”);

pearDialog = dialog.addFieldValue(TypeId(NoYes),NoYes::YES,“Pear”);

potatoDialog = dialog.addFieldValue(TypeId(NoYes),NoYes::YES,“Potatoe”);

return dialog;

}

The question is: Is it possible to group for example fruits, and have something like general checkbox fruits, and when it checked, have apple and pear chekcboxes, checked /unchecked ?

Hi Nastia, welcome to Dynamics User Group.

Please always mention your version of AX (you can conveniently attach a tag with the version). For example, your code wouldn’t work in AX 2012 and solutions for AX 2012 wouldn’t work for you.

Form groups have FrameOptionButton property and if you set it to Check, you’ll get a form group with a checkbox and fields inside the group will be editable only if the checkbox it ticked. It’s not exactly what you asked for, but it’s easy to do.

It would look like this:

fruitGroup = dialog.addGroup("Fruit");
fruitGroup.frameType(FormFrameType::Thin);
fruitGroup.frameOptionButton(FormFrameOptionButton::Check);

appleDialog = dialog.addFieldValue(typeId(NoYes),NoYes::YES,"Apple");
pearDialog  = dialog.addFieldValue(typeId(NoYes),NoYes::YES,"Pear");

vegGroup = dialog.addGroup("Vegetable");
vegGroup.frameType(FormFrameType::Thin);
vegGroup.frameOptionButton(FormFrameOptionButton::Check);

potatoDialog = dialog.addFieldValue(typeId(NoYes),NoYes::YES,"Potatoe");

If you really want to react to a change of a dialog control’s value, you’ll have to use a little hack to override the corresponding method. Or you could use a normal form (build at design time) instead of building it at runtime through the Dialog class.