Find glade gtk3 widget by unique id

妖精的绣舞 提交于 2019-12-25 04:15:40

问题


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.

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.

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


回答1:


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

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.



来源:https://stackoverflow.com/questions/38254924/find-glade-gtk3-widget-by-unique-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!