BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 10-05-2009, 03:21 PM   #1 (permalink)
New Member
Join Date: Oct 2009
Model: 8310
Carrier: Cellular South
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


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...

public TimerView()
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);


I realize this code probably violates some best practices or standards but I'm planning to clean it up afterward.
Old 10-05-2009, 04:19 PM   #2 (permalink)
New Member
Join Date: Oct 2009
Location: Toronto
Model: 8130
Carrier: Telus
Posts: 13
Post Thanks: 0
Thanked 0 Times in 0 Posts

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).
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

Tektronix TM504/PS-501/DM502A 4-Slot Plug-In Mainframe with 2 Plug-Ins
Tektronix TM504/PS-501/DM502A 4-Slot Plug-In Mainframe with 2 Plug-Ins pictureSummation / Sigma Systems 1110B Mainframe
Summation / Sigma Systems 1110B Mainframe pictureNational Instruments NI SCXI-1001 Mainframe Chassis
National Instruments NI SCXI-1001 Mainframe Chassis pictureTEKTRONIX AM 503 / AM503 CURRENT PROBE AMPLIFIER PLUG IN w/ TM502A MAINFRAME
TEKTRONIX AM 503 / AM503 CURRENT PROBE AMPLIFIER PLUG IN w/ TM502A MAINFRAME pictureSpirent Adtech AX/4000 Broadband Test System XL Chassis Mainframe 400143
Spirent Adtech AX/4000 Broadband Test System XL Chassis Mainframe 400143 picture

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