BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-13-2009, 10:51 AM   #1
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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, 11:00 AM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

You'll have to extend the class and override getPreferredHeight()
Offline  
Old 10-13-2009, 01:08 PM   #3
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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, 01:13 PM   #4
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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, 06:51 PM   #5
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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, 08:03 PM   #6
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Only the one(s) that you are going to utilize.
Offline  
Old 10-13-2009, 08:14 PM   #7
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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, 07:28 AM   #8
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

You don't need to know what it does, just call super().
Offline  
Old 10-14-2009, 11:02 AM   #9
doni49
Thumbs Must Hurt
 
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Posts: 84
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, 01:13 PM   #10
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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, 08:08 AM   #11
renuka_anil
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Schneider Electric Energy Server EBX510 Server For Energy Management- picture

Schneider Electric Energy Server EBX510 Server For Energy Management-

$4350.00



MEDIA SERVER DOLBY IMS2000 MSIP-REM-DIB-IMS2000 picture

MEDIA SERVER DOLBY IMS2000 MSIP-REM-DIB-IMS2000

$799.99



MOXA NPort 5410 4 Port Serial Device Server picture

MOXA NPort 5410 4 Port Serial Device Server

$65.00



Intel PRO/1000 PT Dual Port Server Adapter LP - Network Adapter (EXPI9402PTBLK) picture

Intel PRO/1000 PT Dual Port Server Adapter LP - Network Adapter (EXPI9402PTBLK)

$19.99



Weidmüller WI-MOD-945-E (6720005015) Wireless Ethernet & Serial Device Server picture

Weidmüller WI-MOD-945-E (6720005015) Wireless Ethernet & Serial Device Server

$129.99



Schneider Electric Energy Server EBX510 Server For Energy Management picture

Schneider Electric Energy Server EBX510 Server For Energy Management

$865.64







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