BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-30-2008, 02:43 PM   #1 (permalink)
New Member
 
Join Date: Jun 2008
Model: 8800
Carrier: n/a
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Make field take up remaining space on screen.

Please Login to Remove!

Hello,
I have a custom field which needs to take up the space that's left on the screen when I add it. So if it's the third field added or the only field added, it needs to take up the rest of the screen.
I can already set the height to whatever I want, but I don't know how to calculate the space that hasn't been used yet. naturally I don't want to use any more space than is on the screen, because that creates an ugly scroll bar.
Also I don't want to use hard coded numbers. Every screen/blackberry/theme is different so this needs to be dynamic as well.

Basically if there is a way to get the total space on the screen then subtract the space already used, it should give the space left.

Note: I am using JDE 4.1.0


Thank you for your help.
Offline  
Old 06-30-2008, 04:17 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Model: 8800
Carrier: Orange
Posts: 181
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can get the screen height with Display.getHeight(), and you can get the height of each added field with Field.getHeight().
Offline  
Old 06-30-2008, 04:39 PM   #3 (permalink)
New Member
 
Join Date: Jun 2008
Model: 8800
Carrier: n/a
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you but what about the height of the Title field. How do I get that?

Like, the first screen that uses this actually only has the title field and the rest of the space is devoted to the field in question.

The following does not work... (A vertical scroll bar is still there)
Code:
LabelField temp = new LabelField("this is the title", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); //Temp is simply used so that the program can get the height of the title field, but failes
int heightOfFieldsAboveMainCM = temp.getHeight();
this.setTitle(temp);
mainCM.setHeight(Display.getHeight()-heightOfFieldsAboveMainCM);
this.add(mainCM);
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

(1PCS) TC58NVG1S3ETA00 IC EEPROM 2GBIT 48TSOP TC58 58N
$7.85
(1PCS) TC58NVG1S3ETA00 IC EEPROM 2GBIT 48TSOP TC58 58N picture(1PCS) TMPN3120FE3MG(I) IC NEURON CHIP 2KB EEPROM 32SOP TMPN3120FE3MG 3120 TMPN3
$5.63
(1PCS) TMPN3120FE3MG(I) IC NEURON CHIP 2KB EEPROM 32SOP TMPN3120FE3MG 3120 TMPN3 picture(5PCS) BR95320-WMN6TP IC EEPROM 32KBIT 5MHZ 8SOIC 95320 BR95320
$8.78
(5PCS) BR95320-WMN6TP IC EEPROM 32KBIT 5MHZ 8SOIC 95320 BR95320 pictureSEEQ DM52B33-300/B DM52B33H DQ52B33 8K x 8 EEPROM CDIP28 X 1PC
$6.99
SEEQ DM52B33-300/B DM52B33H DQ52B33 8K x 8 EEPROM CDIP28 X 1PC pictureNEO-6M APM 2.5 GPS Module Arduino EEPROM GY-NEO6MV2 Flight
$12.62
NEO-6M APM 2.5 GPS Module Arduino EEPROM GY-NEO6MV2 Flight picture






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