通过唯一ID查找Glade gtk3小部件 [英] Find glade gtk3 widget by unique id

查看:100
本文介绍了通过唯一ID查找Glade gtk3小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在林间空地中,我可以为每个小部件赋予唯一的ID,但是在C代码中,我不知道如何利用这些ID.

In glade I can give a unique id to each widget, however in the c-code, I have no idea how I can make use of these id's.

方法"gtk_widget_get_name"似乎返回了其他内容.至少目前我只能从中获取类型名称,例如"GtkGrid","GtkComboBoxText","GtkStatusbar"……如果我没有在C代码中设置其他名称,那可能就是默认设置.

The method "gtk_widget_get_name" seems to return something else. At least currently I only get the typenames from it, e.g. "GtkGrid", "GtkComboBoxText", "GtkStatusbar" ... thats probably the default if I did not set a different name in the c-code.

那么我该如何读取我在glade中键入的gtkwidget的ID?

So how can I read the id of a gtkwidget, which I typed into glade ?

推荐答案

Glade ID与

The Glade ID is used with gtk_builder_get_object() to retrieve an object or widget by its ID from a Glade file.

name 属性,其中gtk_widget_get_name()检索并实现其他功能:从CSS文件引用窗口小部件.它仅适用于小部件,而不适用于对象,此外,没有任何因素迫使其唯一.

The name property which gtk_widget_get_name() retrieves, fulfills a different function: referring to your widget from a CSS file. It's for widgets only, not objects, and moreover there's nothing that forces it to be unique.

这篇关于通过唯一ID查找Glade gtk3小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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