Re: nameless instances of objects
- From: Tristan Van Berkom <vantr touchtunes com>
- To: Azrael <azrael azrael-uk f2s com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: nameless instances of objects
- Date: Wed, 11 Dec 2002 16:01:17 -0500
I was wondering if it was possible to namelessly generate instances of
'objects' in Gtk.
I think that widget names are only for
theeming purposes (or at least thats
all I've used them for).
If I can create un-named objects/widgets/buttons how do I go about
attaching signals to them? As obviously each new button would need to
have a signal attached to it relating to the purpose it was created for.
You dont attach signals to widgets;
widgets come with signals. if you want to connect a handler
to a signal emitted by that widget; all you need is the
address (returned by g_object_new(G_TYPE...)).
if you add the widgets to a container implementation
(i.e. A window) than you dont really need to worry about
freeing them. (they become the property of the container
unless you hold an explicit reference on them).
so basicly you want to:
widget = gtk_???_new(...);
g_signal_connect(... widget ... handler ...);
gtk_container_add(GTK_CONTAINER(container), widget);
if you want to remove that widget from the
container before the container is destroyed you'll
need to hold on to its address.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]