use warnings; use strict; use Tk; my $mw = MainWindow->new; $mw->Button (-text=>'OK', -command=>\&popup_dialog)->pack; MainLoop; sub popup_dialog { my $dialog = $mw->DialogBox( -title=>'A Tk DIALOG BOX', -buttons=>['OK', 'Cancel'], -default_button=>'OK', -cancel_button=>'Cancel', -command=>\&dialog_callback); my $entry = $dialog->Entry( -text=>'HAPPY 07-OCT-2014', -borderwidth=>3, -takefocus=>1, -font=>'{Architects Daughter} -15 bold') ->grid(-padx=>"1m", -pady=>"2m", -sticky=>'w'); #workaround code -- begin $entry->bind(''=>sub{ print "inside BackSpace callback\n"; $_[0]->icursor(0); $_[0]->eventGenerate(''); $_[0]->eventGenerate(''); $_[0]->eventGenerate(''); $_[0]->eventGenerate(''); $_[0]->selectionClear; $_[0]->focus;}); #workaround code -- end $dialog->Show; } sub dialog_callback { print "inside dialog callback\n"; }