RE: Reference to child of child



        Carlos,

        I agree with you but how to do that?
        I understand GTK_BIN(button)->child but when there are several
(damn) not really.
        Could you confirm me if my approach with set_data/get_data is
correct?

        I have already used set_data to attach infos to an object: I
understand the method. So, the solution would be to attach all children
info's to the parent (notebookpage) with set_data. Each info = a pointer to
the child (my GTK_TEXT widget). What about gtk_widget_set_name? Should I use
it?

        Thanks for your help.

        Fabrisio


-----Original Message-----
From: Carlos Pereira [mailto:carlos pehoe civil ist utl pt]
Sent: Monday 26 February 2001 16:14
To: gtk-app-devel-list gnome org
Subject: 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

**** DISCLAIMER **** 
"This e-mail and any attachments thereto may contain information 
which is confidential and/or protected by intellectual property 
rights and are intended for the sole use of the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, 
total or partial reproduction, communication or distribution in any form) 
by persons other than the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either 
by telephone or by e-mail and delete the material from any computer. 
Thank you for your cooperation."





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