How to add mandatory property in the DialogField class

AOT\DialogField

THK_mandatory
// VAR Changed on 24 Mar 2011 at 16:14:28 by 7011 ITF032 dialog field mandatory
void THK_mandatory(boolean _mandatory)
{
    str     name;
    ;

    // If properties exists then we are on server
    if (properties)
    {
        name = #PropertyMandatory;
        if (!properties.exists(name))
            properties.add(name, true);
        properties.value(name, _mandatory);
    }
    else
        this.fieldControl().mandatory(_mandatory);
}

  

unpack
boolean unpack(
    container   packed,
    Dialog      dialog = null
    )
{
    Struct      unpackedProperties;
    container   structCon;
    Counter     i;
    boolean     init = fieldNo == 0;

    [#currentList,structCon] = packed;

    unpackedProperties = Struct::create(structCon);

    if (init)
        this.init(dialog);

    for (i=unpackedProperties.fields();i;i--)
    {
        switch (unpackedProperties.fieldName(i))
        {
            case #PropertyHelp:
                this.helpText(unpackedProperties.valueIndex(i));
                break;
            case #PropertyLabel:
                this.label(unpackedProperties.valueIndex(i));
                break;
            case #PropertyAllowEdit:
                this.allowEdit(unpackedProperties.valueIndex(i));
                break;
            case #PropertyVisible:
                this.visible(unpackedProperties.valueIndex(i));
                break;
            case #PropertyLookupButton:
                this.lookupButton(unpackedProperties.valueIndex(i));
                break;
            case #PropertyAlignControl:
                this.alignControl(unpackedProperties.valueIndex(i));
                break;
            case #PropertyAlignment:
                this.alignment(unpackedProperties.valueIndex(i));
                break;
            case #PropertyBackgroundColor:
                this.backgroundColor(unpackedProperties.valueIndex(i));
                break;
            case #PropertyBorder:
                this.border(unpackedProperties.valueIndex(i));
                break;
            case #PropertyDisplayHeight:
                this.displayHeight(unpackedProperties.valueIndex(i));
                break;
            case #PropertyDisplayLength:
                this.displayLength(unpackedProperties.valueIndex(i));
                break;
            case #PropertyEnabled:
                this.enabled(unpackedProperties.valueIndex(i));
                break;
            case #PropertyFrameType:
                this.frameType(unpackedProperties.valueIndex(i));
                break;
            case #PropertyHideFirstEntry:
                this.hideFirstEntry(unpackedProperties.valueIndex(i));
                break;
            case #PropertyLabelWidth:
                this.labelWidth(unpackedProperties.valueIndex(i));
                break;
            case #PropertyLimitText:
                this.limitText(unpackedProperties.valueIndex(i));
                break;
            case #PropertyMultiLine:
                this.multiLine(unpackedProperties.valueIndex(i));
                break;
            case #PropertyShowLabel:
                this.showLabel(unpackedProperties.valueIndex(i));
                break;
            case #PropertySkip:
                this.skip(unpackedProperties.valueIndex(i));
                break;
            case #widthMode:
                this.widthMode(unpackedProperties.valueIndex(i));
                break;
            case #heightMode:
                this.heightMode(unpackedProperties.valueIndex(i));
                break;
            case #setHeightFromLines:
                this.setHeightFromLines(unpackedProperties.valueIndex(i));
                break;
            case #PropertyPasswordStyle:
                this.passwordStyle(unpackedProperties.valueIndex(i));
                break;
            case #PropertyConfigurationKey:
                this.configurationKey(unpackedProperties.valueIndex(i));
                break;
            // VAR Changed on 24 Mar 2011 at 16:15:20 by 7011 ITF032 dialog field mandatory - Begin
            case #PropertyMandatory:
                this.THK_mandatory(unpackedProperties.valueIndex(i));
                break;
            // VAR Changed on 24 Mar 2011 at 16:15:20 by 7011 ITF032 dialog field mandatory - End
            default:
                throw error(strfmt("@SYS67326",unpackedProperties.fieldName(i),classId2Name(classidget(this))));
        }
    }

    return true;
}
原文地址:https://www.cnblogs.com/Fandyx/p/2429925.html