Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有个问题要问你。我想使用 int 变量的值使菜单可更新(如果变量的值更改也修改了菜单项)。我知道在单击单个菜单项时更新其字符串的可能性(通过在信号 connect() 中创建一个更新菜单项的单个字符串的函数),但对于第一种情况,我没有暂时在互联网上找不到任何东西!谢谢!
去做就对了。
您不需要在所有 GTK+ 对象和事件机制中包装一个简单的整数;如果您知道值何时更改,您可以为菜单项计算一个新的标签文本并设置它(使用gtk_menu_item_set_label())。
gtk_menu_item_set_label()