Re: CSS # selectors and UI IDs



Hi Chris,

Unfortunately no, the id in the gtkbuilder xml is only useful in apis such as gtk_builder_get_object(), one 
must actually set the "name" property of the widget before addressing it as #name in the css.

This is at least partly because css parsing does not strictly enforce a policy that every widget have a 
unique #name.

Cheers,
    -Tristan

On Apr 8, 2016, at 9:11 PM, Chris Larsen <clarsenipod gmail com> wrote:

Hello Everyone,

Forgive the cross-posting. I originally asked this in the language-bindings mailing list, but I don't think 
anyone actually uses that one.

Working on the Ruby bindings for GTK, and a question came up regarding the relationship between CSS 
selectors and UI elements. On the Gnome developer page for GtkCssProvider, it says:

Selectors work very similar to the way they do in CSS, with widget class names taking the role of element 
names, and widget names taking the role of IDs. When used in a selector, widget names must be prefixed with 
a '#' character. The '*' character represents the so-called universal selector, which matches any widget. 

I take that to mean that when the GtkBuilder object parses the UI file, the name property of the created 
widget object should be identical to the ID in the UI file. Can someone please confirm if this is the case?
_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]