BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-09-2008, 08:58 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default EditField

Please Login to Remove!

net.rim.device.api.ui.component.EditField

Hi Folks,

I'd like to have my cake and eat it too. I like the way the EditField automatically resizes itself as the text you enter grows bigger than the field. I also like how the getPreferredHeight() method allows you to set the height of the field to whatever you want. However, is there a way to kind-of combine these two features? What I want to do is to set the height of one of my text fields to double the normal height. However, when I enter more text than what will fit in those two lines, I'd like the EditField to automatically grow like it normally does. I was hoping that there would be a method like getMinimumHeight() or something like that, but I don't see one.

Or, might there be a way to make such an edit field (one where I've set the height) automatically "scroll" as you type in characters? Right now, it shows the first two lines I've typed, and nothing after that. It still allows me to enter more text, but doesn't show it.

Thanks in advance, if anyone can give me a pointer
Offline  
Old 04-09-2008, 11:27 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you could use Font.getAdvance to get the length of a line and change the height of the field accordingly
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 04-10-2008, 12:59 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Model: 8703e
PIN: N/A
Carrier: vfw
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had a similar problem except that I also wanted to make the Field grow vertically instead of horizontally. What I did was wrap the EditField in an altered VerticalManager. You can make the EditField style USE_ALL_HEIGHT and override the VerticalManager's sublayout method. In the sublayout you call the super method, then check the extent of the Manager and change the extent height to a minimum height if it is smaller than you prefer. It is a roundabout fix, but it worked for me.
Offline  
Old 04-10-2008, 01:51 PM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks to both of you for your responses!
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.