Modify form design at runtime

    FormGroupControl   formContainer,
                            callCenterContainer;
    int                     controllCount,
                            a,
                            lastControl = 0;
    FormBuildControl        control;

    formContainer       = formRun.form().design().addControl(FormControlType::Group, #FormContainer);
    formContainer.columns(3);
    formContainer.columnspace(0);
    controllContainer   = formContainer.addControl(FormControlType::Group, #ControllContainer);
    //controllContainer.widthMode(FormWidth::ColumnWidth);
    controllContainer.widthValue(controlGroupWidth);
    controllContainer.heightMode(FormHeight::ColumnHeight);

    verticallSplitter = formContainer.addControl(FormControlType::Group, #VerticallSplitter);
    verticallSplitter.style(GroupStyle::SplitterVerticalContainer);

    callCenterContainer = formContainer.addControl(FormControlType::Group, #CallCenterContainer);
    //callCenterContainer.widthValue(400);
    callCenterContainer.widthMode(FormWidth::ColumnWidth);
    callCenterContainer.heightMode(FormHeight::ColumnHeight);

    controllCount = formRun.form().design().controlCount();
    for (a = controllCount; a > 0; a--)
    {
        control = formRun.form().design().controlNum(a);
        if (control && control.id() != formContainer.id() && control.handle() != classNum(FormBuildActionPaneControl))
        {
            controllContainer.moveControl(control.id(), lastControl);
            lastControl = control.id();
        }
    }

    //callCenterContainer.addControl(FormControlType::String, #CallCenterHost);
    ManagedHostControl = callCenterContainer.addControl(FormControlType::ManagedHost, #CallCenterHost);
    ManagedHostControl.assemblyName(#AssemblyName);
    ManagedHostControl.typeName(#TypeName);
    ManagedHostControl.sizing(Sizing::SizeToContent);
    ManagedHostControl.widthMode(FormWidth::ColumnWidth);
    ManagedHostControl.heightMode(FormHeight::ColumnHeight);

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags