Help coloring the selected button

Hi, I’m using gtkmm 4, I have a toolbar with buttons that open popover menus.
When a button is selected, I want to change its color, as seen in the following image:
image
I tried using button::selection (found in CSS Selectors Reference) but it didn’t do the trick.
When I use button:focus, the button color changes briefly, until the popover is shown, then it disappears.
When the popover is closed the focus switches the to next button for some reason. I don’t want that.

This is my css:
#tool-bar>button:focus
{
background-image: image(@bgSelected);
}

… and another question: how can I position the popover to the button left? or to the right?

If you open the popover, the button loses focus, that is why the color disappears.

If you want a button to be permanently styled you should set your own style class on it.

ok, thx. How do I prevent the focus from moving to the next toolbar button when the popover closes?
I want to focus back on the button which was pressed

I solved it by calling grab_focus() on button signal clicked

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.