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 ?
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.
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.