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


Renogy 500A Battery Monitor High and Low Voltage Programmable Alarm 500A Shunt picture

Renogy 500A Battery Monitor High and Low Voltage Programmable Alarm 500A Shunt

$85.59



Renogy 500A Battery Monitor with Shunt, High and Low Voltage Programmable Alarm picture

Renogy 500A Battery Monitor with Shunt, High and Low Voltage Programmable Alarm

$76.99



Power Queen 500A Battery Monitor with Shunt High Low Voltage Programmable Alarm picture

Power Queen 500A Battery Monitor with Shunt High Low Voltage Programmable Alarm

$53.99



USB Type C Multimeter Current Meter Voltmeter Voltage Digital Tester Detector US picture

USB Type C Multimeter Current Meter Voltmeter Voltage Digital Tester Detector US

$18.90



USB Type-C Meter Tester Digital Multimeter Current Voltage Power Detector +Cable picture

USB Type-C Meter Tester Digital Multimeter Current Voltage Power Detector +Cable

$19.98



Voltage Electricity Tester Volt Detector Test Pen AC Non-Contact Sensor 90-1000V picture

Voltage Electricity Tester Volt Detector Test Pen AC Non-Contact Sensor 90-1000V

$14.99







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