BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 04-13-2009, 03: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, 06: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, 06: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, 07: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, 11:58 AM   #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, 01: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  




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