Re: Search for lowest level widget



Peter Krueger wrote:
On Mon, 10 May 2004, Russell Shaw wrote:

I have a GtkTable with cells filled with a widget that contains
another widget, and another. The lowest level widget in each cell
is a GtkEntry. Given the GtkTable, how can i get a pointer to the
lowest level GtkEntry in a cell?

Hello Russell!
First you have to find the widget that is directly attached to the table
cell. There is no simple function call since a widget can span more than
one cell in a table. You would need to access the GtkTableChild structure,
but I'm not sure how to do this. You could try whether GtkTable->children
really only stores GtkWidgets like the doc says, or if you're lucky it
stores GtkTableChild's.
When you found the top widget of the desired table cell you have to go
down the tree until you find your GtkEntry. How this is done in detail
depends on the type of widgets you pack between the table and the entry.
GList*      gtk_container_get_children      (GtkContainer *container);
and
GtkWidget*  gtk_bin_get_child               (GtkBin *bin);
can be used for that.
Probably it's easier to store global pointers to the entry widgets you
need to access later.

Regards,
                     Peter

Hi,
I thought of the gtk_container method too. Descsending down widget
hierarchies seems all too hard. I'll store pointers to each lowest
level widget in a NxN array that matches the GtkTable cells.
Thanks




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