Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 如何将所有子窗口小部件移动到另一个容器_C_User Interface_Gtk - Fatal编程技术网

C 如何将所有子窗口小部件移动到另一个容器

C 如何将所有子窗口小部件移动到另一个容器,c,user-interface,gtk,C,User Interface,Gtk,我有一个gtk小部件(来自gtk_dialog_new()),它是在不同的函数中创建的,并添加了一堆小部件。现在我想把这个小部件的所有子部件重新租到另一个容器中。 比如: get_widget_get_all_childrent(list); //loop over list and reparent all children 事实上,我在谷歌上搜索了一下才找到答案 首先,我需要一份儿童名单: GList* list = gtk_container_get_children();

我有一个gtk小部件(来自gtk_dialog_new()),它是在不同的函数中创建的,并添加了一堆小部件。现在我想把这个小部件的所有子部件重新租到另一个容器中。 比如:

get_widget_get_all_childrent(list);
//loop over list and reparent all children

事实上,我在谷歌上搜索了一下才找到答案

首先,我需要一份儿童名单:

GList* list = gtk_container_get_children();

      //then loop over and reparent

     g_object_ref(widget);
     gtk_container_remove(GTK_CONTAINER(old_parent), widget);
     gtk_container_add(GTK_CONTAINER(new_parent), widget);
     g_object_unref(widget);