Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a <Tab> binding for a entry widget, where I destroy the widgets parent after processing. I get an error because after running my subroutine Tkx tries to find the field for the next focus for the parent widget that does not exist anymore:
bad window pathname ".t.e"
I would like to use the break command (as mentioned in the documentation of bind) to prevent Tkx from executing further bindings. However, all syntaxes I could think of give an error. Obviously I can't think of the right syntax OR the break command does not funktion.
This is the stripped code:
use strict; use warnings; use Tkx; my $mw = Tkx::widget -> new ('.'); $mw -> g_wm_iconify; my $Fkrs = $mw -> new_toplevel; my $fac = ''; my $Ffac = $Fkrs -> new_entry (-textvariable => \$fac, -width => 8); $Ffac -> g_grid (-row => 0, -column => 0, -sticky => 'ew'); $Ffac -> g_bind ('<Tab>', [\&fac, \$fac, \$Ffac, \$Fkrs]); Tkx::update (); while (Tkx::i::call('winfo', 'exists', $Fkrs)) {Tkx::i::DoOneEvent(0)} +; Tkx::update (); die "Normal end"; sub fac { my ($p_fac, $p_Ffac, $p_Fkrs) = @_; if ($$p_fac =~ /^(?=.+)\d*(\.\d+)?$/) { # I would like to use the break here!!; $$p_Fkrs -> g_destroy; } else { $$p_fac = ''; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Use of break in Tkx
by previous (Sexton) on Oct 03, 2015 at 10:17 UTC | |
by Anonymous Monk on Oct 03, 2015 at 10:23 UTC | |
by Anonymous Monk on Oct 03, 2015 at 11:17 UTC | |
by Anonymous Monk on Oct 04, 2015 at 02:28 UTC | |
by Anonymous Monk on Oct 04, 2015 at 14:44 UTC | |
| |
by previous (Sexton) on Oct 05, 2015 at 09:57 UTC | |
|
Re: Use of break in Tkx
by Anonymous Monk on Mar 29, 2013 at 13:31 UTC | |
by Anonymous Monk on Mar 29, 2013 at 15:05 UTC | |
by Anonymous Monk on Mar 29, 2013 at 15:11 UTC | |
by previous (Sexton) on Oct 03, 2015 at 10:00 UTC | |
by Anonymous Monk on Oct 03, 2015 at 10:16 UTC | |
|