Find option??
1 posts in topic
Flat View  Flat View

Posted By:   john_lucas
Posted On:   Tuesday, July 31, 2001 09:39 AM

I have a Text area, find button and text field in an application in which user will type in what he wants to search for. Once the user clicks on find button it should highlight the text it searched, in the text area (just like it does, when the user clicks on edit-->find (on this page) option in browser(IE).
I want the similar functionality(it should highlight the text the user is searching), but in the text area.

Re: Find option??

Posted By:   sanjay_pai  
Posted On:   Wednesday, August 1, 2001 05:26 AM

Use the following method of TextArea class for selecting & highlighting the text in the textarea.

public void select(int selectionStart,
int selectionEnd);

For getting the selectionStart, use indexOf(String str, int fromIndex) of the String class, but before that, assign the TextArea's data to a String variable.

And repeatedly changing the fromIndex, selectionStart & selectionEnd, you can manipulate.

Hope this solves your problem.

About | Sitemap | Contact