Re: Reference to child of child



I have created a notebook dynamically with several pages. Each page
(a vbox) contains a scrolledwindow and the scrolledwindow a gtk_text widget.
I have a pointer to the current notebookpage (generated with
"switch_page" signal, notebookpage = the vbox) but how can I obtain a
pointer to its gtk_text widget? 

Use set_data/get_data functions. 

The widgets have been created with local variables.
The correct way.

If you were trying to reach the immediate child of a container, 
then I would suggest getting it directly with commands like: 
label = GTK_BIN (button)->child;

But if you are trying to go more deep than one level and
you don't have specific functions to do it, then just forget
and use set_data, get_data.

You might find a specific way off getting that information 
for this particular case. The result is, you will end up with 
50 different specific ways of dealing with these particular 
situations, one for each part of your app. That is much more
difficult to maintain than to use get_data/set_data.

Try to use the same approach all over your code. Try to
use the same notation all over your code. If you have 10
different problems and you can solve all of them with a
common solution, that's much better than to have 10 
different solutions.

Carlos




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