pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David McNelis" <Dmcne...@sharedmarketing.com>
Subject TextArea v. TextInput - Selection and Autocomplete
Date Wed, 05 May 2010 14:00:02 GMT
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);




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,


View raw message