Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I'm not sure what exactly is causing the problem. There aren't any past threads I could see on this topic which mention this issue either. Anyway, below is a small program which consistently demonstrates this problem.
This program when run brings up a window with 'OK' button which when clicked brings a dialog box. This dialog box has an Entry widget which displays a text: HAPPY 07-OCT-2014 and also the default buttons (OK and Cancel)
Once the dialog box pops up, here are the steps to re-produce this problem
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('<Key-BackSpace>'=>sub{ print "inside BackSpace callback\n"; $_[0]->icursor(0); $_[0]->eventGenerate('<ButtonPress-1>'); $_[0]->eventGenerate('<ButtonRelease-1>'); $_[0]->eventGenerate('<ButtonPress-1>'); $_[0]->eventGenerate('<ButtonRelease-1>'); $_[0]->selectionClear; $_[0]->focus;}); #workaround code -- end $dialog->Show; } sub dialog_callback { print "inside dialog callback\n"; }
System Configuration: I'm using Windows XP, Strawberry Perl v5.16.3, Tk::DialogBox.pm v4.016, Tk::Entry.pm v4.018 (from strawberry/perl/site/lib/Tk)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A Tk::DialogBox Tk::Entry question. (workarounds are bad)
by Anonymous Monk on Oct 13, 2014 at 08:21 UTC | |
by Anonymous Monk on Oct 13, 2014 at 08:31 UTC | |
by Anonymous Monk on Oct 14, 2014 at 15:04 UTC |