GTKD - get CSS class for button

Gerald via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 22 05:22:56 PDT 2016


On Wednesday, 22 June 2016 at 08:08:20 UTC, TheDGuy wrote:
> Hello,
> i would like to know if it possible to get the CSS-class which 
> is asigned to a button (for example)? I didn't find any 
> documentation about this, just the function 
> "getStyleContext().getProperty()", my current attempt:
>
> Value value;
> bArr[0].getStyleContext().getProperty("Class",StateFlags.NORMAL,value);
>
>
> (bArr is an array of buttons).
>
> I get the error, that 'Value' is not defined, if i use 'GValue' 
> (as it is described here: 
> https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-style-context-get-property) i get 'function is not callable with GValue'
>
> Any ideas? Thanks alot!

widget.getStyleContext().listClasses() to get a list of all 
classes assigned to the widget. If you just want to see if a 
specific class is assigned to the widget you can use 
widget.getStyleContext().hasClass()


More information about the Digitalmars-d-learn mailing list