如何 disable/enable 对话框元素

How to disable/enable dialog elements

在这个简短的对话框中,我试图 enable/disable 整数字段。 DLGEnabled() 命令在这里似乎没有做任何事情:

class BTW_Dialog : UIFrame
{   
     BTW_Dialog(object self) { Result( "\n Object `" + self.ScriptObjectGetClassName() + "` ID:" + self.ScriptObjectGetID() + " created."   ); }
    ~BTW_Dialog(object self) { Result( "\n Object `" + self.ScriptObjectGetClassName() + "` ID:" + self.ScriptObjectGetID() + " destroyed." ); }

    TagGroup CreateDLGTagGroup( object self )
    { 
        //  Dialog building method
        TagGroup DLGtgs, DLGItems
        DLGtgs = DLGCreateDialog( "Analyze", DLGItems );

        TagGroup RadioList = DLGCreateRadioList( 0, "AActOnRadio" )
            RadioList.DLGAddRadioItem( "LP", 0 ).DLGIdentifier("0").DLGSide( "Left" );
            RadioList.DLGAddRadioItem( "LF", 1 ).DLGIdentifier("1").DLGSide( "Left" );
        DLGitems.DLGAddElement(RadioList).DLGAnchor("West");

        TagGroup field = DLGCreateIntegerField( 55, 4 ).DLGSide( "Left" ).DLGIdentifier("xyz");
        DLGitems.DLGAddElement(field).DLGAnchor("West");

        return DLGtgs
    } 

    object LaunchAsModelessDialog( object self )
    { 
        self.init( self.CreateDLGTagGroup() );
        self.Display( "Analyze" );
        return self
    } 

    void AActOnRadio( object self, tagGroup itemTG )
    { 
        number radioButtonState = itemTG.DLGGetValue();
        vtagGroup xyz_tag = self.LookupElement("xyz")
        if(radioButtonState)
        {   //  trying to disable integer field:  <<<-------||
            DLGEnabled( xyz_tag, 0)
        } 
    }
}   

Alloc(BTW_Dialog).LaunchAsModeLessDialog();

是否有任何其他命令可以禁用 and/or 在按下单选按钮时隐藏整数字段?谢谢

您要查找的命令是

void SetElementIsEnabled( ScriptObject, String identifier, Boolean is_enabled )

即在你的例子中替换

DLGEnabled( xyz_tag, 0)

来自

self.SetElementIsEnabled(  "xyz", 0 )

注意,有一个类似的命令可以制作对话框元素"hidden",即

void SetElementIsShown( ScriptObject, String identifier, Boolean is_shown )