如何在对话框对象中启用-禁用元素-DLGEnabled [英] How to enable-disable an element in dialog object - DLGEnabled

查看:55
本文介绍了如何在对话框对象中启用-禁用元素-DLGEnabled的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么下面的脚本没有像应该那样禁用按钮?

Why is the following script not disabling the push button, as it is supposed to do?

class ElementEnableTest : UIFrame {

    void Action( object self ) {
        self.LookUpElement("StopButton").DLGEnabled(0);
        result( "button clicked\n" );
    };

    ElementEnableTest( object self ) {
        TagGroup tgDialog = DLGCreateDialog( "" );
        TagGroup tgButton = DLGCreatePushButton("stop","Action");
        tgButton.DLGIdentifier("StopButton");
        tgDialog.DLGAddElement( tgButton);
        self.init( tgDialog );
        self.Display( "test" );
    };
};

alloc(ElementEnableTest);

推荐答案

脚本操作

 self.LookUpElement("StopButton").DLGEnabled(0);

将在关联的tagStructure(描述对话框)中设置属性值,但不会强制更新对话框图形.(请注意,其他UI命令,例如 DLGTitle DLGSetProgress 确实会强制进行更新.)

will set the property value in the associated tagStructure (which describes the dialog), but it does not force an update of the dialog drawing. (Note that other UI commands like DLGTitle or DLGSetProgress do force an update.)

在显示期间禁用/启用UI元素的命令是 SetElementIsEnabled .因此,请使用以下行代替您的行:

The command to disable/enable UI elements during display is SetElementIsEnabled. So use the following line instead of yours:

 self.SetElementIsEnabled("StopButton",0);

这会做你想要的.

第二种暴力方式是关闭并重新创建对话框窗口,但我认为您通常希望避免这种情况.

A second brute-force way would be to have the dialog window be closed and recreated, but I think you would generally want to avoid this.

void Action( object self ) {
    self.LookUpElement("StopButton").DLGEnabled(0);
    self.close()
    self.display("")
    result( "button clicked\n" );
};

这篇关于如何在对话框对象中启用-禁用元素-DLGEnabled的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆