Re: How do I expose a specific widget and all it parents?
- From: "Egon Andersen, Talura" <post talura dk>
- To: "Cupitt, John" <John Cupitt ng-london org uk>
- Cc: gtk-list <gtk-list gnome org>
- Subject: Re: How do I expose a specific widget and all it parents?
- Date: Thu, 12 Sep 2002 15:29:26 +0200
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?
Hiya,
Sure, just it depends on what info you're tracking. For example, if you
know the widget that each notebook page is showing, you can do
gint page = gtk_notebook_page_num( nb, my_page_widget );
gtk_notebook_set_page( nb, page );
(or have I misunderstood?)
Basicly I just know the widget pointer, so it requires some processing
to find the correct parent notebooks and setting the page... but that
part is close to working. The code you show is just a small but
important part of this :-)
To get one out, do
gtk_widget_get_ancestor( widget->parent, GTK_TYPE_WHATEVER )
Approximately how I did it.
> 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?
What are you using inside the scrolled window to layout your widgets?
You might be able to just read child->allocation.x/y, or you might need
to poke about inside the layout widget.
Mostly a mix of vboxes and hboxes added some frames and sometimes tables.
So it seems to be quite a job and still I'm totally confused about how
to get the adjustment of anything at all.
E.g. how do I get the adjustment of an entry inside a vbox?
Best regards
Egon Andersen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]