develooper Front page | perl.beginners | Postings from August 2009

Perl-Tk, copy/paste context-menu for entries

Thread Next
From:
Mishustin Alexey
Date:
August 9, 2009 04:31
Subject:
Perl-Tk, copy/paste context-menu for entries
Message ID:
1249817490.3986.31.camel@localhost
Hi,

Another question about Perl-Tk.

I need to make context-menus with 'Copy' and 'Paste' commands for
'entry' widgets. I found the following syntax for it.

my $popup = $mwindow->Menu(
	-tearoff   	=> 0,
	-menuitems 	=> [
		[Button      => 'Copy', -command => [\&copy]],
		[Button      => 'Paste', -command => [\&paste]]
	]
);
$where_entry->bind(
	"<Button-3>" 	=> sub {$popup->Popup(
		-popover 	=> "cursor",
		-popanchor 	=> 'nw'
		)}
	);
$limit_entry->bind(
	"<Button-3>" 	=> sub{$popup->Popup(
		-popover 	=> "cursor",
		-popanchor 	=> 'nw'
		)}
	);

sub copy {
#?
}

sub paste {
#?
}

The question is: how to pass the event widget name to subroutines
($where_entry or $limit_entry)?

-- 
Regards,
Alex


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About