C/GTK+ Is it possible? access child widgets having only the its container?
- From: Marcus Reis <marcus lanhelp com br>
- To: gtk-app-devel-list gnome org
- Subject: C/GTK+ Is it possible? access child widgets having only the its container?
- Date: Sat, 19 Nov 2005 21:03:38 -0200
Hello, suppose the scenario that we have a GtkTable declared as global
variable. Inside that table we have 9 event boxes with 1 GtkImage packed
in each one. Now we have a function that must change properties from
some images that are inside event boxes or even destroy the boxes. I
have tried to achieve this with the following (unsuccessful) code:
#######################################################################
static void some_function()
{
int x;
GList *list;
GtkWidget *event_box;
list = gtk_container_get_children(GTK_CONTAINER (global_table));
g_print("We have %d elements",(g_list_length(list)));
event_box = GTK_WIDGET (g_list_nth(list, 0));
gtk_widget_destroy(GTK_WIDGET (event_box));
}
#######################################################################
In g_print I can get the right number of elements in the list (9). But
the rest doesn't work at all, giving me this runtime warning about the
last 2 function lines:
#######################################################################
EXECUTING:
/home/marcus/Projects/jogodavelha2/src/jogodavelha2
----------------------------------------------
We have 9 elements
(jogodavelha2:24950): GLib-GObject-WARNING **: invalid uninstantiatable
type `(null)' in cast to `GtkWidget'
and:
(jogodavelha2:24950): Gtk-CRITICAL **: gtk_widget_destroy: assertion
`GTK_IS_WIDGET (widget)' failed
#######################################################################
Thanks for any help.
_______________________________________________________
Yahoo! Acesso Grátis: Internet rápida e grátis.
Instale o discador agora!
http://br.acesso.yahoo.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]