BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-13-2009, 04:15 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 72
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default how can I select text in a TextField programatically?

Please Login to Remove!

I have a TextField and after setting its contents (with setText()) I want to select part of it. How can this be done from the TextField API?
Offline  
Old 04-13-2009, 07:05 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Why don't you just use getText() to retrieve the current string and create a new string with the part of the string that is of interest?
Offline  
Old 04-13-2009, 07:16 PM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 72
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I say "select" I mean that the string (or part thereof) is both highlighted and will be captured by the framework if the user does a copy. Further more, any typing would immediately replace the selected text.
Offline  
Old 04-13-2009, 08:00 PM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

I don't see any support for this in the API.

However, I imagine this can be accomplished by utilizing event injection to simulate the required keystrokes.
Offline  
Old 04-19-2009, 12:58 PM   #5 (permalink)
New Member
 
Join Date: Apr 2009
Model: 9530
PIN: N/A
Carrier: no
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i want to see
Offline  
Old 04-19-2009, 02:53 PM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 72
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had asked the same question on the RIM BB Forum. It was suggested by someone to override the TextField and call MoveFocus (or Navigate??- don't recall full method name right now). One person said they tried it and it work. I have not had the time to come back to this issue yet.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.