PintoDoido
PintoDoido

Reputation: 1051

How to add spacer in GTK+3?

I am using C GTK+3, using Glade for the GUI design. I have a GtkGrid with 1 row and 3 columns. I have a button on column 2 and I want to add a spacer in column 1 and 3 so the button stays in the middle of the window. Which GTK3 widget should I use to act as a simple 'spacer'?

Upvotes: 2

Views: 2072

Answers (1)

Zander Brown
Zander Brown

Reputation: 637

From your description I'm assuming your interface looks like so:

Current

I think your trying to achieve an interface like so:

Belive

Which can be achieved by changing the alignment from fill to centre in the 'Common' tab:

How

However if you wanted the button to be centred regardless of any content placed in Col 1 / 3 you would be better off with a GtkBox with a center widget:

Might be

Which is achieved like so:

Add a horizontally orientated GtkBox and enable center child

Centre

Add your button to the extra placeholder displayed

Set any content you want to the right of the button as pack end

Pack End

Upvotes: 7

Related Questions