How to get radio buttons on a dialog

There is no dialog.addRadioButtonContol(…) function so how do you do it?

static void Job1(Args _args)
{
    Dialog                dialog;
    FormRadioControl      formRadioControl;
    FormBuildRadioControl formBuildRadioControl;
    FormBuildGroupControl formBuildGroupControl;
    int                   formBuildRadioControlId;
    ;
    //Build dialog with radio buttons
    dialog = new Dialog("Test Dialog");
    formBuildGroupControl = dialog.mainFormGroup();
    formBuildRadioControl = formBuildGroupControl.addControl(FormControlType::RadioButton,'radiobuttons');
    formBuildRadioControlId = formBuildRadioControl.id();
    //set number of buttons
    formBuildRadioControl.items(3);
    //add descriptions
    formBuildRadioControl.item(1);
    formBuildRadioControl.text("Radiobutton 1");
    formBuildRadioControl.item(2);
    formBuildRadioControl.text("Radiobutton 2");
    formBuildRadioControl.item(3);
    formBuildRadioControl.text("Radiobutton 3");
 
    if(dialog.run())
    {
        if(formBuildRadioControl)
        {
            //get control
            formRadioControl = dialog.formRun().control(formBuildRadioControlId);
            //get index
            info(strfmt("Radiobutton %1 selected",formRadioControl.selection()+1));
        }
    }
}

Find Datatypes

I like reusing/extending data types that already exist, however it is not always easy to find them. The following job lets you search the existing data types for a keyword:

static void findEDT(Args _args)
{
    #AOT
    Dialog              dialog = new Dialog('Find EDT');
    SearchString        searchString;
    DialogField         dialogField = dialog.addField('SearchString');
    boolean             stopAfterFound;
    void searchNodes(boolean _extendedDataTypes)
    {
        TreeNode            treeNode;
        TreeNodeIterator    treeNodeIterator;
        SysDictType         sysDictType;
        SysDictEnum         sysDictEnum;
        Boolean             found;
        ;
        if(_extendedDataTypes)
        {
            treeNode = TreeNode::findNode(#ExtendedDataTypesPath);
        }
        else
        {
            treeNode = TreeNode::findNode(#BaseEnumsPath);
        }
        treeNodeIterator = treenode.AOTiterator();
        treeNode = treeNode.AOTfirstChild();
        treeNode = treeNodeIterator.next();
        while(treeNode)
        {
            if(treeNode.treeNodeName() like "*" + searchString + "*")
            {
                if(_extendedDataTypes)
                {
                    sysDictType = sysDictType::newTreeNode(treeNode);
                }
                if(sysDictType)
                {
                    if (sysDictType.extend() && sysDictType.enumId())
                    {
                        info(strfmt("%1 (%2 - %3 -> %4)",treeNode.treeNodeName(), sysDictType.baseType()
                            , extendedTypeId2name(sysDictType.extend()), enumId2Name(sysDictType.enumId()) ));

                    }
                    if(sysDictType.extend())
                    {
                        info(strfmt("%1 (%2 - %3)",treeNode.treeNodeName(), sysDictType.baseType()
                            , extendedTypeId2name(sysDictType.extend()) ));

                    }
                    else if (sysDictType.enumId())
                    {
                        info(strfmt("%1 (%2 - %3)",treeNode.treeNodeName(), sysDictType.baseType()
                            , enumId2Name(sysDictType.enumId()) ));

                    }
                    else
                    {
                        info(strfmt("%1 (%2)",treeNode.treeNodeName(), sysDictType.baseType()));
                    }
                }
                else
                {
                    info(strfmt("%1",treeNode.treeNodeName()));
                }
                found = true;
            }
            else if(stopAfterFound && found)
            {
                return;
            }
            treeNode = treeNodeIterator.next();
        }
    }
    ;
    if(dialog.run())
    {
        searchString = dialogField.value();
        if(!strScan(searchString, "*", 1, 999)) //no "*"
        {
            searchString = "*" + searchString + "*";
        }
        else if(strKeep(searchString,"*") == "*" && subStr(searchString,strLen(searchString),1)=="*") //just one final "*": beginns with
        {
            stopAfterFound = true;
        }
        info(strfmt("Find %1",searchString));
        if(searchString)
        {
            setPrefix('Extended Data Types');
            searchNodes(true);
            setPrefix('Base Enums');
            searchNodes(false);
        }
    }
}

Update: slight improvement “stopAfterFound”