Hello Monks,
I have a perltk program with several widgets that display data in different ways. I want to send a "<<record_added>>" event and have anything that should do something ... do it. But it seems that only the last widget bound to the event will find out about the event. The code below shows an example of this:
use Tk;
my $app = new MainWindow;
my $entry1 = $app->Entry()->pack();
my $entry2 = $app->Entry()->pack();
$entry1->bind('all', '<<customEvent>>' => sub{ print "entry 1" });
$entry2->bind('all', '<<customEvent>>' => sub{ print "entry 2" });
$app->Button(-text => 'gen event',
-command => sub{ $app->eventGenerate('<<customEvent>>')}
+)->pack();
MainLoop;
Do I just have the wrong mindset or am I doing something wrong in the code? I would think that once an event was fired off every widget would get a chance at responding to it; at least every widget you asked to listen for it.
Thanks,