Spencer_Lists wrote:
Greetings perl-win32-users,

This is really a TK question but I can't find a way to join the TK
list in order to post. It does not show up in the subscriptions list.

I have a TK Canvas on which I have drawn 128 polygons representing the
extended MIDI piano keyboard. I have tried everything I can think of,
consulting the documentation etc but I can not figure out a way to
tell which polygon the mouse cursor has entered. Using TK widget, I
only get a reference to the Canvas itself and not the individual
polygon. Nothing else I have tried has worked either.

my $poly0 = $c->createPolygon($NSt + $xadd,$top, $NSt + $xadd,$bot,
$NSt + $NSp + $xadd,$bot,  $NSt + $NSp + $xadd,$mid, $SSt +$xadd,$mid,
$SSt + $xadd,$top,  -outline=> 'black', -fill=> 'white', -tags=>
'note0');

$c -> bind($c ->$poly0, "<ButtonPress-1>",  sub {send_note_on (0)});

$c -> -> bind($poly0, "<ButtonRelease-1>", sub {send_note_off (0)});

You're binding to the poly object, not to the poly identified by the *tag*. Hopefully this snippet from working script will help clarify.

foreach my $entity(qw /bodyshape pin1shape pin2shape/)
        {
        ...
        
$poly{board} = $c->createPolygon($poly{profileArgs}, -outline => 'red', -fill => '',
                -tags => [$entity]);
        ...
        $c->bind($entity, '<1>', sub {
                        #print "ENT = $entity\n";
                                ...
                                }) ;    
        }

 - Lynn.

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to