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.

[参考译文] 编译器/MSP430F5659:帮助使用图形库将变量按钮分配给按钮结构

Guru**** 2538960 points


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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/784584/compiler-msp430f5659-help-with-assigning-a-variable-button-to-a-button-structure-using-the-graphics-library

器件型号:MSP430F5659

工具/软件:TI C/C++编译器

大家好、我在一个包含 MSP430和图形显示屏的项目中使用图形库。 这更多是一个软件问题、而不是一个问题。 我定义了一组按钮结构、我想在不指定特定按钮的情况下修改它们。 例如:

graphics_button  but _Menu1={135、250、0、30、2、 0、ClrBlack、ClrWhite、ClrLightGray、ClrWhite、 ClrWhite、154、8、"消息1"、&g_sFontCms18b};
graphics_button  but _Menu2 ={260、375、0、30、2、 0、ClrBlack、ClrWhite、ClrLightGray、ClrWhite、 ClrBlack、288、8、"消息2、&g_sFontCms18b};

//IN 程序、而不是此程序
但是_Menu1.fillColor = ClrLightBlue;

//我想使用变量 myChoice 选择 Menu1还是 Menu2?

mychoice.fillColor = ClrLightBlue;
//how do I do this?(如何执行此操作?)   
//谢谢

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

    我不熟悉这个图形库。  但我有一项建议要考虑。

    将变量 myChoice 设为指针。  下面是一些说明它如何工作的代码...

    graphics_button * mychoice;//指针
    
    //多行后
    
    如果(//此处有一些条件*/)
    mychoice =&b但是_Menu1;
    否则
    mychoice =&b但是_Menu2;
    
    //许多行后
    
    mychoice->fillColor = ClrLightBlue; 

    谢谢、此致、

    乔治

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