Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 34341 invoked from network); 5 May 2010 14:03:43 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 May 2010 14:03:43 -0000 Received: (qmail 71821 invoked by uid 500); 5 May 2010 14:03:42 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 71805 invoked by uid 500); 5 May 2010 14:03:42 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 71797 invoked by uid 99); 5 May 2010 14:03:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 May 2010 14:03:42 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [67.217.132.12] (HELO exchange01.sharedmarketing.com) (67.217.132.12) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 May 2010 14:03:34 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CAEC5B.B1483363" X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: TextArea v. TextInput - Selection and Autocomplete Date: Wed, 5 May 2010 09:00:02 -0500 Message-ID: <2701CF596B80DC44815FDBFFF5881A1EA2800F@exchange01.sharedmarketing.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: thread-topic: TextArea v. TextInput - Selection and Autocomplete thread-index: AcrsW7EaOnMJZ6GmTuaH3OsS2zPIMg== From: "David McNelis" To: X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. ------_=_NextPart_001_01CAEC5B.B1483363 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Morning folks, =20 I have a set of information that I'm trying to auto-complete. With a TextInput I didn't have any problems setting the 'result' and then highlighting the suggestion. However, I am having trouble doing something similar in a TextArea. =20 Specifically if I find a valid result the following snippet is called for a TextInput: =20 String text =3D textInput.getText(); String resultString =3D getCompletedString(text); =20 textInput.setText(resultString); =20 int selectionStart =3D text.length(); int selectionLength =3D resultString.length() - selectionStart; =20 textInput.setSelection(selectionStart, selectionLength); =20 =20 The auto-complete functions as I'd want it in the TextInput just fine. But when I port it to a TextArea the selection isn't processed in the same way. I would just use a TextInput, however (and maybe I'm wrong), TextInput can't span multiple lines and the amount of text that might get tossed into the area is often too large to fit on a single line. Also, I can't seem to set a specific index to set the cursor at in a TextArea either...looking at the methods available there is a TextArea.setCursor() method, but that doesn't take in an index at all. =20 Am I missing something simple? Or am I trying to use a TextArea in a way that I shouldn't be? =20 Thanks for your thoughts, David ------_=_NextPart_001_01CAEC5B.B1483363 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Morning folks,

 

I have a set of information that I’m trying = to auto-complete.  With a TextInput I didn’t have any problems = setting the ‘result’ and then highlighting the suggestion.  = However, I am having trouble doing something similar in a TextArea.

 

Specifically if I find a valid result the following = snippet is called for a TextInput:

 

         &= nbsp;      String text =3D textInput.getText();

         &= nbsp;      String resultString =3D getCompletedString(text);

         &= nbsp;     

textInput.setText(resultString);

 

int = selectionStart =3D text.length();

int = selectionLength =3D resultString.length() - selectionStart;

 

textInput= .setSelection(selectionStart, selectionLength);

 

 

The auto-complete functions as I’d want it in = the TextInput just fine.  But when I port it to a TextArea the = selection isn’t processed in the same way.  I would just use a TextInput, however = (and maybe I’m wrong), TextInput can’t span multiple lines and = the amount of text that might get tossed into the area is often too large to = fit on a single line.  Also, I can’t seem to set a specific index to = set the cursor at in a TextArea either…looking at the methods = available there is a TextArea.setCursor() method, but that doesn’t take in an = index at all.

 

Am I missing something simple?  Or am I trying = to use a TextArea in a way that I shouldn’t be?

 

Thanks for your thoughts,

David

------_=_NextPart_001_01CAEC5B.B1483363--