GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Nov 28, 2014 9:27 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: close tab in notebook
PostPosted: Tue Oct 18, 2011 11:21 am 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
I have added a close button to a tab so how is it possible to close the tab in which the button is placed if i have 5 notebook pages?


Top
 Profile  
 
 Post subject: Re: close tab in notebook
PostPosted: Wed Oct 19, 2011 5:38 am 
Offline
Familiar Face

Joined: Mon Apr 18, 2011 10:23 pm
Posts: 5
It may be done approximately so:

Code:
gtk_box_pack_start(GTK_BOX(label_box), label, FALSE, FALSE, 1);
gtk_box_pack_start(GTK_BOX(label_box), close_button, FALSE, FALSE, 1);

gint page_num = gtk_notebook_append_page(notebook, label_box);

g_object_set_data(G_OBJECT(close_button), "closed_page_num", (gpointer) &page_num);
g_signal_connect(close_button, "clicked", G_CALLBACK(close_page), notebook);

void close_page(GtkWidget *close_button, GtkWidget *notebook)
{
   gint *page_num;
   page_num =  (gint *) g_object_get_data(G_OBJECT(colse_button), "closed_page_num");
   gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), *page_num);
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group