BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-05-2009, 03:21 PM   #1
gzusphish
New Member
 
Join Date: Oct 2009
Model: 8310
PIN: N/A
Carrier: Cellular South
Posts: 1
Question Newb question - only the first of multiple fields is displaying

Please Login to Remove!

As a first Bb app I'm writing a stopwatch and I want the larger time increments big and the milliseconds small. As part of this I'm trying to display multiple bitmap or label fields side-by-side but when I run it using the simulator, only the first is displayed.

So for example what I want is:

1 2 : 3 4 : 5 6 : 7 8 9

with each number in it's own field but what I'm getting is just

1

i.e. the first field. If I use buttons then they all display both in the default verticalFieldManager and in the horizontalField Manager but if I use labels or bitmaps then all I get is the first field even if I remove the horizontalFieldManager and just use the default verticalFieldManager. I've Googled the issue, searched this forum, and spent several hours reading documentation and code examples but I've yet to figure out why I can't put multiple fields of these types side-by-side. Do I have to have something between them like separators or empty fields?

The code I've got so far is as follows...

Code:
public TimerView()
{
super();
HorizontalFieldManager timerField = new HorizontalFieldManager();

Bitmap hour10 = Bitmap.getBitmapResource("num_1.png");
Bitmap hour01 = Bitmap.getBitmapResource("num_2.png");
Bitmap minute10 = Bitmap.getBitmapResource("num_3.png");
Bitmap minute01 = Bitmap.getBitmapResource("num_4.png");
Bitmap second10 = Bitmap.getBitmapResource("num_5.png");
Bitmap second01 = Bitmap.getBitmapResource("num_6.png");
Bitmap ms100 = Bitmap.getBitmapResource("num_7.png");
Bitmap ms010 = Bitmap.getBitmapResource("num_8.png");
Bitmap ms001 = Bitmap.getBitmapResource("num_9.png");
Bitmap colon = Bitmap.getBitmapResource("Colon.png");

BitmapField bfHour10 = new BitmapField(hour10);
BitmapField bfHour01 = new BitmapField(hour01);
BitmapField bfHourColon = new BitmapField(colon);
BitmapField bfMinute10 = new BitmapField(minute10);
BitmapField bfMinute01 = new BitmapField(minute01);
BitmapField bfMinuteColon = new BitmapField(colon);
BitmapField bfSecond10 = new BitmapField(second10);
BitmapField bfSecond01 = new BitmapField(second01);
BitmapField bfSecondColon = new BitmapField(colon);
BitmapField bfMs100 = new BitmapField(ms100);
BitmapField bfMs010 = new BitmapField(ms010);
BitmapField bfMs001 = new BitmapField(ms001);

timerField.add(bfHour10);
timerField.add(bfHour01);
timerField.add(bfHourColon);
timerField.add(bfMinute10);
timerField.add(bfMinute01);
timerField.add(bfMinuteColon);
timerField.add(bfSecond10);
timerField.add(bfSecond01);
timerField.add(bfSecondColon);
timerField.add(bfMs100);
timerField.add(bfMs010);
timerField.add(bfMs001);

add(timerField);
}
I realize this code probably violates some best practices or standards but I'm planning to clean it up afterward.
Offline  
Old 10-05-2009, 04:19 PM   #2
sorayathomas
New Member
 
Join Date: Oct 2009
Location: Toronto
Model: 8130
PIN: N/A
Carrier: Telus
Posts: 13
Default

At a glance, looks like it should work to me. I'm fairly newb myself, so just a couple of ideas:

- you can pass different flags into the constructor for bitmap field and horizontal field manager, maybe experiment with those?

- extend your own bitmapfield class and override paint - you can use graphics.drawBitmap, this seems to be what I've done in cases where I use images (for some reason).
Offline  
Closed Thread



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


4 Count Case GE ProLine 2 Bulb 120V T12 Electronic Fluorescent Light Ballasts picture

4 Count Case GE ProLine 2 Bulb 120V T12 Electronic Fluorescent Light Ballasts

$49.99



Universal Lighting B234SR120M-A 2-Lamp Rapid Start Ballast 120V 60Hz picture

Universal Lighting B234SR120M-A 2-Lamp Rapid Start Ballast 120V 60Hz

$20.00



Triad B234SR277M-A 2 Lamp F40T12FS Electronic Ballast 277V 60Hz -NIB of 4 picture

Triad B234SR277M-A 2 Lamp F40T12FS Electronic Ballast 277V 60Hz -NIB of 4

$80.00



Triad B232IUNVHP-N 2-Lamp Outdoor Electronic Ballast T8 / ES 120-277V 60Hz picture

Triad B232IUNVHP-N 2-Lamp Outdoor Electronic Ballast T8 / ES 120-277V 60Hz

$20.00



10-Count GE Fluorescent Ballast, GE432-MVPS-L Electronic T8, 120v to 277v picture

10-Count GE Fluorescent Ballast, GE432-MVPS-L Electronic T8, 120v to 277v

$108.99



QHE 4X32T8/UNV ISH-SC Sylvania 51347 4-Lamp T8 Instant Start Fluorescent Ballast picture

QHE 4X32T8/UNV ISH-SC Sylvania 51347 4-Lamp T8 Instant Start Fluorescent Ballast

$10.79







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