The stupid question is the question not asked | |
PerlMonks |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello
I am trying to override the Paste function on a macOS, but with no success. I want to read the value in the Pasteboard, modify it, and paste it. With the following the content of the unmodified value of Pasteboard is still inserted in the Text widget. Only by Pasting the second time the modified value is inserted. Any suggestion?
use Tk; use Mac::Pasteboard; $mw = MainWindow->new(); my $t = $mw->Scrolled('Text', -width => 40, -height => 10, -wrap => 'c +har', -bd => '1', -scrollbars => 'e')->pack(-expand => 1, -fill => 'b +oth', -pady => 2, -padx => [2,0]); $t -> bind("<<Paste>>", sub{ my $CLIP = Mac::Pasteboard->new(); #reading what is in the pasteboard my ($data, $flags) = $CLIP->paste (); #modifying value $data .= '_ADDED'; #setting new value $CLIP->clear (); $CLIP->copy($data); }); MainLoop;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk override Paste
by jcb (Parson) on Feb 21, 2021 at 04:21 UTC | |
Re: Tk override Paste
by Anonymous Monk on Feb 20, 2021 at 14:21 UTC |