Re: gtktable question



yanxin <ycui wmsvision com> writes:

(I posted this question while back and got no answer, now repost)

Supose I have a 3x3 gtktable with wdgets attached in. Later on, I want
to resize
or reposition the widgets(cell) to use different attach
parameters(left_attach,right_attach,top_attach,bottom_attach). How can I

do this?

I have thought of two methods:
method 1. unparent the widget attached, remove the child from the
gtktable->children, then re-attach the widget with the new parameters;

This would work (make sure to g_object_ref()/g_object_unref() around
this so the child is not freed)
 
method 2.modify the parameters in gtktablechild->left_attach(and also
right_attach, top_attach,bottom_attach), then what should I do next?

This doesn't, you can't modify GTK+ internals like this.

Another technique that works is to use child-properties (documented
in the API docs, e.g.:
http://developer.gnome.org/doc/API/2.0/gtk/gtktable.html#GtkTable--left-attach)

 gtk_container_child_set (GTK_CONTAINER (table), child,
                          "left_attach", new_left, 
                          "right_attach", new_right,
                          "left_attach", new_top, 
                          "right_attach", new_bottom,
                          NULL);

Regards,
                                        Owen




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