Re: Callbacks and widgets
- From: Gus Koppel <gtk spamkiller bytechase cx>
- To: gtk-app-devel-list gnome org
- Subject: Re: Callbacks and widgets
- Date: Thu, 30 Mar 2006 10:03:38 +0200
Gonzalo Aguilar Delgado wrote:
1.- Passing a data structure
2.- Using global variables (not good threading support)
3.- Passing window to gpointer and searching.
But the point is.
What is the best way? Is there any other way to do that? Because
structure option looks more suitable for different data to be passed not
just widgets...
I tried to set the widgets as user-data of the widget to be triggered.
But it seems not to work.
I have a 4th way to offer. I also use to access arbitrary widgets from
within widget's signal handlers frequently. I don't keep all widgets to
be reachable as global variables nor do I define or pass any data
structures to the handlers.
My way has proven to be quite comfortable at source level, since the
only precaution you need to take is to assign names to those widgets you
want to refer to, and to provide just one globally accessable variable
per window. The tiny performance impact by this function is absolutely
negligible at runtime, even if you perform 100 widget searches in a row.
http://www.spamkiller.bytechase.cx/democode/widget_find_by_name.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]