Sorry the command should have read
Um, thats not the only typo. No matter, here is some working code
#!/usr/bin/perl -- ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr +-ce -nibc -i=4 -pt=0 "-nsak=*" use strict; use warnings; use Data::Dump qw/ dd pp/; $Tkx::TRACE = 64; use Tkx; use Tkx::FindBar; my $name; my $mw = Tkx::widget->new( '.' ); my $text = $mw->new_text( -width => 20, -height => 10, ); foreach( qw/David Mary William/ ) { $text->insert( 'end', "$_\n" ); } my $findbar = $mw->new_tkx_FindBar( -textwidget => $text, ); $mw->g_bind( '<Control-f>' => [ \&Tkx::FindBar::show, $findbar ], +); $mw->g_bind( '<F3>' => [ \&Tkx::FindBar::next, $findbar ], +); $mw->g_bind( '<Shift-F3>' => [ \&Tkx::FindBar::previous, $findbar ], +); $mw->g_bind( '<Return>', \&fudge, ); $findbar->g_pack(); $text->g_pack(); $findbar->show(); Tkx::MainLoop(); sub fudge { dd( \@_ ); dd [ $text->m_tag_configure( 'highlight' ) ]; $name = $text->get( qw/highlight.first highlight.last/ ); print "The name is $name\n"; dd [ $text->tag( qw' ranges highlight' ) ]; $text->m_tag_add( 'sel', qw/highlight.first highlight.last/ ); $text->g_focus; ## g_focus is g_focus not m_focus $findbar->hide; } ## end sub fudge
In reply to Re^10: Getting selection from Tkx text (typos)
by Anonymous Monk
in thread Getting selection from Tkx text
by dabella12
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |