in reply to Use of break in Tkx

Hmm, lets see

 [ddg://site:perlmonks.org tkx break] site:perlmonks.org tkx break

http://search.cpan.org/grep?cpanid=GAAS&release=Tkx-1.09&string=break&i=1&n=1&C=0

http://www.tkdocs.com/tutorial/onepage.html

Nope, no examples

http://www.tcl.tk/man/tcl/TkCmd/contents.htm
-> http://www.tcl.tk/man/tcl/TkCmd/bind.htm
-> http://www.tcl.tk/man/tcl/TclCmd/break.htm

Hmm, try Tk::break(); seems to work

perl -MTkx -e " Tkx::break() " invoked "break" outside of a loop at -e line 1.

Replies are listed 'Best First'.
Re^2: Use of break in Tkx
by Anonymous Monk on Mar 29, 2013 at 15:05 UTC
    Nope, doesn't.
    For information: I am using ActiveState Perl v. 5.14.2, Tkx (and Tcl) are standard included, Tk isn't.
    OS is Windows 7 64-bit.

      Nope, doesn't.

      Sure it does, if you insert it at "break here" it will break -- it still pops up an error dialog (not very useful) but it calls break and breaks :) you should report bug to Tkx author

      ... Tk isn't.

      And then you install Tk

        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;