问题
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