Re: Dazed and confused about menus



On Thu, 2003-11-06 at 15:38, David Sword wrote:

Everything works fine, except for attaching the callback to run the
programs - it always contains the details of the last menuitem created,
as opposed to the one selected, and I don't understand how to make this
work (or even if it CAN work!)

            $progname  = $subname;
          $MenuItem[$cntr]->signal_connect('activate' => sub{
\&RunProg(@_,$progname)} );

Looks like $progname is the problem. You're not using 'my' when you
declare it, thus you don't get a lexically scoped variable (which you
want), but a global.

If you were running under 'use strict;' and 'use warnings;', Perl
would've warned you.

Bye,
-Torsten




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]