Re: Confused about $data=undef in API documentation
- From: muppet <scott asofyet org>
- To: Joseph Thames <beartham gmail com>
- Cc: gtk-perl-list gnome org
- Subject: Re: Confused about $data=undef in API documentation
- Date: Sat, 11 Jul 2009 14:15:43 -0400
On Jul 11, 2009, at 10:58 AM, Joseph Thames wrote:
Hello,
I am confused about your use of $data=undef in the Glib
documentation, as in:
unsigned = $instance->signal_connect ($detailed_signal, $callback,
$data=undef)
• $detailed_signal (string)
• $callback (subroutine)
• $data (scalar) arbitrary data to be passed to each invocation of
callback
Does this simply mean that undef (NULL) is the default value of the
$data parameter, or does it mean that passing unique user_data to a
callback is not yet supported in this API?
Yes, it means that if you don't specify that argument, it will be
treated as though you passed undef. The syntax is borrowed from C++'s
default parameters.
I am trying to figure out a way to employ a common callback function
for an "unlimited" number of menu items (determined at run-time) by
passing unique user_data for each signal.
This does not seem to be supported by the $builder->connect_signals
method, which can only pass the same user_data to a group of unique
callback functions.
Your single callback is free to inspect the widget / object names (as
set in the xml) and dispatch to the correct place based on that.
--
Doing a good job around here is like wetting your pants in a dark
suit; you get a warm feeling, but no one notices.
-- unknown
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]