Re: Help with closing a notebook page (GTK2)



On 03/07/11 18:33, Neil Munro wrote:
On 3 July 2011 01:25, Bill C<billc netspace net au>  wrote:
On 03/07/11 07:40, Neil Munro wrote:
Hi, I have used pygtk before so I am familiar with some of the basic
concepts of gtk, but this is my first attempt with an actual gtk+ C
application and I have run into a few issues.

I have a notebook that I wish to have a close button on the page tabs
that when clicked closes the tabs.

I know that it's a bit off a faf to do as you don't know the page
prior to the event. So you have to dynamically detect which tab is
being closed by using a tab child widget.

Now I believe I have done this in code, except it always returns -1
which then firmly tells me I have done something wrong.

I have attached the code for your reference in the hopes that someone
shall be able to point out my no doubt simple mistake.

Many thanks in advance,
Neil Munro


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
I use the switch page signal to keep track of the displayed page, put a
button in the label of the page tab when I create it and delete the page
when it is clicked.

All works without problems.  Not even sure if I need to keep track of the
displayed page...  May just be a hangover from development

If you are doing this, then check your code again

Rgds Bill
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

What if I, or more importantly another user, opt to close a tab that
isn't currently selected? The current tab will be closed instead of
the button they clicked, or have I misunderstood you?

The callback passes the notebook page as a parameter, so you simply close the page. It all works nicely. Haven't looked at this area of my code for at least a year, so can only give basic overview and my recollection may be wrong.

As the whole tab may not be visible if several pages are open , most users will select a page prior to closing it. ( if only to make sure they dont close a page they need... guess this depends on application and how much text is in your tabs)

I assume you are hand coding rather than using an IDE, so use the full power of GTK, rather than what the IDE gives you

Rgds Bill
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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