Re: [gtk-devel-list] notebook api a pain...

On Mon, 31 Aug 1998, Michael K. Johnson wrote:

> The notebook API is a pain for certain uses.  In particular, if you
> want to keep track of a page you have added, you have to jump through
> hoops.  For example, I have an application where I need to add pages
> in no particular order, then remove them at random.  There is no real
> way to identify a page right now.  :-(

not fully correct. you add a page by providing the (container) widget
that needs to appear as a notebook page later on. this widget pointer
is more or less the handle you'd like to have.

> It would be really nice if the functions that add a page to a notebook
> would return a handle that could be used to address the page, just like
> the gdk_input_add returns a tag.  That tag could be used to manipulate
> a page; at the very least a function could convert the tag to a page
> number, but it would be more convenient to directly manipulate the
> pages via the handle.

just save the widget pointer and use it for removal later on, e.g.

gtk_notebook_prepend_page (notebook, my_page, NULL);
[certain other stuff]
gtk_container_remove (notebook, my_page);

there needs to be a function, though, that returns the current
page number for a given notebook child, i.e.

gint gtk_notebook_get_page_num (GtkNotebook *notebook,
                                GtkWidget   *page);

which will return -1 if page is not a child of the notebook, and its
position otherwise.
this position can then also be used for existing functions like
gtk_notebook_set_page, gtk_notebook_remove_page, gtk_notebook_insert_page
or gtk_notebook_reorder_child.

> michaelkjohnson
> "Ever wonder why the SAME PEOPLE make up ALL the conspiracy theories?"


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