[Memphis.pm] GTK-Perl and signal handlers
Phil Groce
phil_groce at cmcsmart.com
Wed May 10 08:53:24 CDT 2000
At 08:30 AM 5/10/00 -0500, I wrote:
>At 11:18 PM 5/9/00 -0500, Ed wrote:
>>Also, the signal handlers do allow for passing additional args into the
>>call. You should be able to pass a $ref off.
>
>I haven't been able to get this to work. My current workaround is
>specifically referencing a hash in the main:: namespace. So any info on
>doing this last bit is appreciated.
Answered my own question, sort of.
I poked around in the default handlers Glade builds and found the following
magic:
my ($class, $data, $object, $instance, $event) = @_;
# [...snip... --pg]
# Get ref to hash of all widgets on our form
my $form = $__PACKAGE__::all_forms->{$instance};
$instance is always passed to each signal handler. Using $form, I can
directly access each widget by name, so I don't have to install handlers
for each event and populate a struc -- er, hash independently. :)
Hope this make someone's life easier. Now that I know this, I'm especially
psyched about Glade. I may need to poke around some more and see what other
internal structures it builds, though. Kinda wish I knew if this was going
to go away some day. But hey, it's here now. :)
phil
----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------
More information about the Memphis-pm
mailing list