You aren't supplying enough information for anyone to really help you figure out your problem. The best I can come up with is "You're doing it wrong."

Try this code snippet to see if it gives you any pointers.

use strict; use warnings; use Tk; my %w; $w{mw} = MainWindow->new; $w{topfr} = $w{mw}->Frame()->pack( -expand => 1, -fill => 'x' ); $w{textfr} = $w{mw}->Frame()->pack( -expand => 1, -fill => 'both' ); $w{topfr}->Button( -text => 'Previous', -command => sub { nextText('-backwards') } )->pack( -side => 'left' ); $w{searchstring} = $w{topfr}->Entry( -text => 'text', )->pack( -side => 'left' ); $w{topfr}->Button( -text => 'Next', -command => sub { nextText('-forwards') } )->pack( -side => 'left' ); $w{textWindow} = $w{textfr}->Scrolled( 'Text', -scrollbars => 'ose' ) ->pack( -expand => 1, -fill => 'both' ); $w{textWindow}->insert( 'end', q|I have a Scrolled Text widget in my application. I am trying to implement an incremental search of a string on this text widget. I have come up with the following logic , but it only highlights the first occurence and not the remaining ocuurences. Please help me to make it incremental for the entire text widget. Following is my code | ); $w{textWindow}->focus; MainLoop; sub nextText { my $direction = shift; my $string = $w{searchstring}->get; $w{textWindow}->FindNext( $direction, '-exact', '-nocase', $string + ); }

In reply to Re: Perl tk FindNext in a text widget by thundergnat
in thread Perl tk FindNext in a text widget by ghosh123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.