Re: [gtk-list] Getting at widget toplevel parent...



>I would like to call gtk_object_set_data() on the root level window
>after I create it, and then, from within callbacks for various widgets
>(menu items, buttons, etc), get back that data.

>
>Is there a way for me to get the toplevel windows data (without making
>its variable global) from anywhere in a GTK app, i.e. via some
>gtk_get_toplevel_window() call?


    You should use this gtk_object_set/get_data(). 
    It's really simple, and very powerfull !

    To get the parent of a widget, you can use 
    GTK_WIDGET(yourwidget)->parent. By iterate this 
    until you find a NULL parent, you should do the 
    trick.
    
    As a conclusion, I don't think there is a get_toplevel_window()
    in gtk+. So you should use one of two method here (or
    another, if you found one).

    Yours,

    pixel@epita.fr
    
>
>Thanks!
>rjf&
>
>P.S. The reason I am needing to do this is that currently, all my
>widget stuff is in a structure, which I pass around as the data into
>various signals. But I have come to need to get at that data, as well
>as another distinct piece of data (which is transient, and cannot be
>made part of the currently passed around struct).




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