This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] GUI Composer 脚本

Guru**** 2020320 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/977370/gui-composer-scriptings

大家好  

在我的应用程序中、我使用 Tab 容器

我需要认识到以下情况。

如果我更改了选项卡、并且该模式变量与所需模式不同、则我想生成一个对话框、用于输入一些保护密码

这里是代码  

gc.DataBind.registration.bind ("gc_Btns.btn7"/*固件中的按钮变量*/、
{
actual_state:"curry_state"、/*固件中的可变*
actual_tab:'widget.ti_tab_container.selected-index'/*preperty,应代表 tab*/
}、
函数(值)
{
if ((values.actual_tab ==1)&&(values.actual_state!= 3))// multipulse
{
templateObj.$.ti_password_dialog.open();/*对话框中有数字框绑定到固件变量*/
返回1;/*模拟按 gc_Btns.btn7*/} 
}); 

我做了什么错了、如何解决?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

      gc.DataBind。registration.bind ('widget.ti_nmbx_tab.value'、'widget.ti_tab_container.selected-index');//这也不起作用

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Gleb、您好!

    要回答原始问题,您可以将绑定更改侦听器添加到 widget.ti_tab_container.selectedIndex 属性并弹出对话框。

    gc.DataBind 注册表.getBinding('widget.ti_tab_container.selectedIndex').addChangedListener ({
    onValueChanged:(oldValue、newValue)=>{
    //在此处打开对话框
    };
    }); 

    要回答第二个问题,请在绑定表达式中将所选索引更改为 SelectedIndex。

    此致、
    Patrick

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    非常感谢、尊敬的 Patrick

    这确实解决了我的问题。  

    我应该注意的是、属性的名称记录在小工具信息中(在 API 部分中)  

    我复制了 Designer 字段中的字段名称