Re: Set background color to ToggleButton



On Tue, 10 Nov 2015, Daniel Peñalba wrote:

Hi, I'm writing a simple GTK# application trying to change the background
color to a ToggleButton:

            ToggleButton firstButton = new ToggleButton ("Push me",
targetColor);
            firstButton.ModifyBg (StateType.Active, targetColor);

However, the background color does not change when it's pushed.
[IMAGE]
Do you know how can I change the toggle's background color when the button
is pushed?

GTK# is some sort of wrapper around GTK. How exactly it behaves will, I suppose, depend on the GTK version. In current GTK 3, the APIs that used to do things such as changing the background color of widgets have been disabled: they're still present, but they don't actually do anything any more. You now have to use CSS or low-level cairo (graphics library) operations to do this sort of thing. Maybe GTK# will catch up with these changes at some point.

Allin Cottrell


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