Continuing on, GtkGrid is similar to GtkTable, but unlike GtkTable, it stores the child's expand and margin property instead of having its container to give allocation to it. Seems to me to be GtkBuilder or GtkUIManager (I never used this before) friendly.
In genie, If you want to create a box with 3 buttons with the following layout
[<button1:!expand><<<<button2:expand>>>>><button3:!expand>]
the old way to do this is
...
var
box = new HBox(false, 0)
b1 = new Button.with_label("button1")
b2 = new Button.with_label("button2")
b3 = new Button.with_label("button3")
box.pack_start(b1, false, true, 0)
box.pack_start(b2, true, false, 0)
box.pack_start(b3, false, true, 0)
... now, with GtkGrid, you had to do like this
...
var
grid = new Grid
b1 = new Button.with_label("button1")
b2 = new Button.with_label("button2")
b3 = new Button.with_label("button3")
b2.expand = true
grid.attach(b1, 0, 0, 1, 1)
grid.attach(b2, 0, 1, 1, 1)
grid.attach(b3, 0, 2, 1, 1)
...
No comments:
Post a Comment