#!/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( '' => [ \&Tkx::FindBar::show, $findbar ], ); $mw->g_bind( '' => [ \&Tkx::FindBar::next, $findbar ], ); $mw->g_bind( '' => [ \&Tkx::FindBar::previous, $findbar ], ); $mw->g_bind( '', \&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