Re: How do I expose a specific widget and all it parents?



Cupitt, John wrote:
Egon Andersen, Talura wrote:
 > I have a notebook with several pages and I want to be able to from the
 > application to show/expose any specific page I want.

I think you need gtk_notebook_set_page()

I thought of this function, but then I need to make it top-down. I can in no way just say that I want to see the page (and its parents) containing a specific widget? I can probably use the gtk_widget_get_parent/gtk_widget_get_ancestor to find the parent notebook(s), so I try that even though it seems a little clumsy.

BTW When I used gtk_widget_get_ancestor(notebook1, GTK_TYPE_NOTEBOOK), I got the pointer equal to 'notebook1', not the parent notebook as I had expected. Is this the intended behaviour of gtk_widget_get_ancestor() or is it a simple bug? (It is easy to work around in a consistent way, so it is no big deal.)


 > I also have scrollable windows and want a specific entry to be visible -
 > just another complication I imagine.

It depends on what sort of thing you're displaying. Widgets like clist, for example, have methods which will scroll to make a specific row visible.

If it's not a clever widget, then you just set the adjustment on the scrolled window to the position of the child.

It is 'any widget', so it can not be expected to be a clever widget :-)
But how do I get the position of the widget, so that I can set the adjustment?

Basicly what I have access to is the widget pointer. So I have to determine the position of the widget relative to the scrolled window somehow...??

Best regards
Egon Andersen




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