in reply to Re: Entry Widget (copy and paste issue)
in thread Entry Widget (copy and paste issue)

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".
  • Comment on Re^2: Entry Widget (copy and paste issue)

Replies are listed 'Best First'.
Re^3: Entry Widget (copy and paste issue)
by Anonymous Monk on Sep 15, 2010 at 16:24 UTC
    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
      $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); } }
      OH, thanks. Just thought everyone didn't understand what I was trying to do. Thanks.