Re:Removing widgets from VBox.
- From: Muthiah Annamalai <dearestchum yahoo co in>
- To: gtk-app-devel-list gnome org
- Subject: Re:Removing widgets from VBox.
- Date: Fri, 10 Jun 2005 15:21:03 -0700 (PDT)
Hello.
Correction to the actual code to remove widgets
from a VBOX.
I wont recommend 'creating' new widgets for the
case of TIME consumption, speed & resources.
However, it might be easy to program... ;-)
This kinda' works.
-Muthus
P.s: I missent this.. ;0 sorry for breaking the
thread.
P.P.s: this post was also missent.
--- Muthiah Annamalai <dearestchum yahoo co in> wrote:
--- Guenther Sohler <guenther sohler newlogic com>
wrote:
[snip]
I did not yet find a good strategy to delete all
widgets/childs from within a
vbox.
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkBox [base of VBox & HBox], has a GList of
children
it contains. You can simply iterate over the list,
and delete each widget you want.
This code must work. Sorry, I couldnt check it.
Cheers
Muthu.
<CODE>
The code must read
<CODE>
void box_remove(GtkWidget *btn, GtkBox *box)
{
/* Remove all widgets in the Box*/
GtkWidget *widget=NULL;
GtkBoxChild *child,*needed_box;
GList *ptr=box->children;
int len=g_list_length(box->children);
int i=0;
g_assert(btn!=NULL && box!=NULL);
gtk_widget_freeze_child_notify (box);
g_message("Length: %d\n",len);
if(len <= 1)
return;
for(i=0;i<len;i++,ptr=ptr->next){
child=(GtkBoxChild *)ptr->data;
widget=child->widget;
if(GTK_IS_LABEL(widget)){
g_message("Label
{%s}",gtk_label_get_text(widget));
}
if(widget!=btn && widget!=NULL){
g_message("Deleting Child:
%s",gtk_widget_get_name(GTK_WIDGET(widget)));
gtk_widget_unparent(widget);
}
else{
needed_box=child;
}
}
gtk_widget_thaw_child_notify (box);
g_list_free(box->children);
box->children=g_list_alloc();
box->children->data=needed_box;
gtk_container_check_resize(GTK_CONTAINER(box));
len=g_list_length(box->children);
g_message("New Length: %d\n",len);
return;
}
</CODE>
__________________________________
Discover Yahoo!
Use Yahoo! to plan a weekend, have fun online and more. Check it out!
http://discover.yahoo.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]