pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David McNelis" <Dmcne...@sharedmarketing.com>
Subject RE: TextArea v. TextInput - Selection and Autocomplete
Date Thu, 06 May 2010 12:20:23 GMT
Thank you Noel and Greg.  It was the caret that I was trying to
place...and at the same time I was trying to highlight the remain text
that followed the caret position.

 

I've got the caret correctly moving now, which is a bonus.  But not so
much with the selection of the following text.  However its not much of
an issue for me at this point, as I opted to change that part of the
functionality to something a little more useful...

 

From: Greg Brown [mailto:gkbrown@mac.com] 
Sent: Thursday, May 06, 2010 6:25 AM
To: user@pivot.apache.org
Subject: Re: TextArea v. TextInput - Selection and Autocomplete

 

The selection logic should work the same for TextArea as it does for
TextInput. Not sure what the problem might be.

 

Re: cursor - do you mean "cursor" or "caret"? Cursor generally refers to
the mouse pointer, whereas caret refers to the blinking line
representing the insertion point for text. setCursor() controls the
cursor style - calling setSelection() with a selection length of 0
positions the caret.

 

On May 5, 2010, at 10:00 AM, David McNelis wrote:





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:

 

                String text = textInput.getText();

                String resultString = getCompletedString(text);

               

textInput.setText(resultString);

 

int selectionStart = text.length();

int selectionLength = 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

 


Mime
View raw message