Jack
Jack

Reputation: 16724

How to put a widget into any column inside a grid?

I'm writing by hand an application that use Gtk+. I'm using a GtkGrid to hold my GtkWidgets, but I can't put a GtkWidget into specific colum, as the second parameter of gtk_grid_attach() function says. E.g, the last element was placed into the 4-column, if I try to put into the 6-column it does not works; the GtkWidget is auto placed by the gtk into the 5-column.

Upvotes: 0

Views: 387

Answers (2)

liberforce
liberforce

Reputation: 11454

You can't just "skip" a column, this has no meaning. An empty column is just 0 pixels wide. You need to put something there, either in the same row, or in another, if you want it to have a width > 0. You can just put a GtkFixed widget there if you want, but if this is just to separate 2 widgets, you may want to use the row-spacing and/or column-spacing properties instead. The official GTK documentation gives some advice about how GtkGrid works.

Upvotes: 2

unwind
unwind

Reputation: 399753

If all you want is to have some blank space between the widgets, you should be able to achieve that with someting simpler. Like a plain GtkBox, and using the padding support when adding the widgets.

Upvotes: 1

Related Questions