in reply to Re^3: Use of break in Tkx
in thread Use of break in Tkx

Here's my Tcl/Tk bind/break test. Just keep hitting <tab> and break stops you reaching the second entry. Where and in what form would you specify break in Perl/Tkx to get the second example working. Thank you in anticipation.
_______TCL EG. WORKS WELL______ pack [entry .e1 -textvar v1 -width 50] set v1 blob pack [entry .e2 -textvar v2 -width 50] set v2 blob proc cb_entry {my_str} { puts -nonewline $my_str; flush stdout} bind .e1 <KeyPress> {cb_entry $v1; break} ;#<======= break here bind .e2 <KeyPress> {cb_entry $v2} ; _______PERL EG. NEEDS BREAK_______ use Tkx; my $mw; sub cb_entry {my $win=$_[0]; $mw->g_wm_title("this is $win m8");} sub main_loop { my $v1; my $v2; $mw = Tkx::widget->new("."); #WHERE AND HOW TO SPECIFY BREAK IN HERE???? my $e1 = $mw->new_ttk__entry( -width => 50, -textvariable => \$v1, ); $e1->g_pack( -expand => 1, -fill => 'both', ); Tkx::bind($e1, "<Key>", [ sub { cb_entry($_[0]); }, Tkx::Ev("%W") ]); my $e2 = $mw->new_ttk__entry( -width => 50, -textvariable => \$v2, ); $e2->g_pack( -expand => 1, -fill => 'both', ); Tkx::bind($e2, "<Key>", [ sub { cb_entry($_[0]); }, Tkx::Ev("%W") ]); Tkx::MainLoop(); } main_loop;

Replies are listed 'Best First'.
Re^5: Use of break in Tkx
by Anonymous Monk on Oct 03, 2015 at 10:16 UTC

    use it anywhere you want, Tkx::break(), and then suffer the popup bug (its a bug)

      Yes I get the popup every time I use it. another anon monk advised to try "next" in place of break and this worked a treat i.e. we're back in business but getting the translation from break to next by reading TK's documentation as activestate suggested is at best optimistic I fear i.e. one continues a loop whereas the other drops out of a loop. That's far from intuitive to me without visibility of the additional structures involved or a well-documented lookup table e.g. for "break"...use "next" in callbacks.