For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > June 2006 > MListbox and popup menus: post over the cursor









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MListbox and popup menus: post over the cursor
filippo

2006-06-02, 8:02 am

Hello again,

I'm trying to post my popup menu right over the curson on MListbox
widget.

The code

$goofy_mlistbox->bind('<ButtonPress-1>' =3D> [sub {
my($w, $x, $y) =3D @_;
$menu->post($x, $y);
}, Ev('X'), Ev('Y')]);

simply doesn't bind to the ButtonPress, so that chunk is not evaluated
at all. If I change ButtonPress-1 to 'p', it works (!?!) but I need to
bind to mousebutton.


The code

$goofy_mlistbox->bindRows('<ButtonPress-1>' =3D> [sub {
my($w, $x, $y) =3D @_;
$menu->post($x, $y);
}, Ev('X'), Ev('Y')]);

is actually evaluated but produce errors like this

Tk::Error: '=E2=94=9C=C3=A2=E2=94=AC=E2=95=9D=E2=98
=BC%=E2=99=A5=E2=99=A5' =
isn't numeric at
C:/Perl/site/lib/Tk.pm line 252.
Tk callback for .frame1.frame.menu
<Button-3>
(command bound to event)

I discovered that bindRows pass to the callback different arguments
that bind, and it seems that doen't pass the cursor position. Am I
right?

My questions are:
- is it possible to post to cursor position using bindRows?
- why bind (on mlistbox) doesn't work on mousebuttons events?

Thanks and best regards,

Filippo

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com