in reply to Entry Widget (copy and paste issue)

You may be interested in virtual events and real events with eventGenerate seem to not work the same...

Also:

#!/usr/bin/perl use Tk; $top = new MainWindow; $top->eventAdd(qw[<<Copy>> <Key-F4>]); $top->eventAdd(qw[<<Paste>> <Key-F5>]); $top->Text->pack; MainLoop; __END__

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Entry Widget (copy and paste issue)
by rookie_monk (Novice) on Sep 15, 2010 at 15:55 UTC
    I may be communicating my thoughts incorrectly. The copy and paste works. The problem is when I paste it, if there is already text in the entry(text box), even though I have the text in the entry(text box) highlighted, it doe not over-write it but instead it appends to it. For example, lets say I copied the text "TEXT" and I pasted it into a entry(text box) which already contains the text "NEW". The new text in the entry(text box) is now "NEWTEXT" rather than just "TEXT".
      I understood. You need to bind a sub to Paste that will overwrite the hilighted text, because the default binding will not do that, not under any circumstance
        OH, thanks. Just thought everyone didn't understand what I was trying to do. Thanks.
        $MW->bind('Tk::Entry', '<Control-v>',\&overwrite_paste); sub overwrite_paste{ my $entry = $_[0]; if($entry->selectionPresent){ $entry->delete('sel.first', 'sel.last'); $entry->selectionClear; $entry->insert(0,$entry->clipboardGet); } }