BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-13-2009, 11:51 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please Login to Remove!

Wirelessly posted

Does anyone know of any docs on setting the height of RichTextFields and/or LabelFields?

My searches have turned up a bunch of pages where both RichTextField and Height were on the page but they weren't talking about the height of the field.

I want to go a pt or two smaller than the default height.
TIA!
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 10-13-2009, 12:00 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

You'll have to extend the class and override getPreferredHeight()
Offline  
Old 10-13-2009, 02:08 PM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

GETpreferredHeight SETS the height? And people wonder why there's confusion.

To me, GET would be to find out what the setting is and SET would be to change the setting.

Thanks again!
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 10-13-2009, 02:13 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

getPreferredHeight is called by the UI framework to GET the height, not SET the height.

You override this method to change the default behavior.

Not confusing at all.
Offline  
Old 10-13-2009, 07:51 PM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Dougsg38p View Post
getPreferredHeight is called by the UI framework to GET the height, not SET the height.

You override this method to change the default behavior.

Not confusing at all.
That kind of makes sense--I'm not actually call the method myself. The UIApp class calls it--I'm just redefining it.

So anyway, I created a new class that extends RichTextField. But when I try to create new field using it, I get a message that a constructor is undefined. Surely, I don't have to re-create all the constructors myself.
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 10-13-2009, 09:03 PM   #6 (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

Only the one(s) that you are going to utilize.
Offline  
Old 10-13-2009, 09:14 PM   #7 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I thought the idea of extending an existing class was that any properties/methods in the "parent" class were automatically part of my new class. And unless I override them, they aren't changed.

But since I don't know what the constructor did, how do I know how to create it now? The only difference between my class and a normal RichTextField is that I want to override the getPreferredHeight & paint methods.
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 10-14-2009, 08:28 AM   #8 (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

You don't need to know what it does, just call super().
Offline  
Old 10-14-2009, 12:02 PM   #9 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

So--within my constructor, call super()?

What does super do? I'm having trouble finding docs on it. I've seen it called from within class constructors but I'm still confused as to what it does.

Thanks for all your help!
__________________
Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW
Offline  
Old 10-14-2009, 02:13 PM   #10 (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

super calls the constructor (matching signature) in the base class.

public class Foo extends Bar
{
public Foo (int status){
super(status);
// ... more stuff here
}
}
Offline  
Old 10-26-2009, 09:08 AM   #11 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this

protected void layout(int width, int height){
super.layout(lblWidth, lblHeight);
setExtent(lblWidth, lblHeight);
}

public int getPreferredWidth(){
return lblWidth;
}

public int getPreferredHeight(){
return lblHeight;
}

lblWidth is width of textField or labelfield
lblHeight is height of textfield or labelfield

Both these are calculated manually according to screen width and height.
__________________
Crazy for BlackBerry
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.