Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Contributor
Posts: 14
Registered: ‎05-18-2011
My Device: 9300, 9700
My Carrier: T-Mobile

Custom navigation bar, and BrowserField

[ Edited ]

I have top HorizontalFieldManager with several BitmapField that is focusable.

 

Below I have BrowserField that show HTML content from web.

I'm using default navigation mode, when I move the navigator the focus on top is removed.

 

how can I, that when I'm moving my pointer to the top bar, then I can programmatically change the focus to the top navigation bar, and set focus on one of BitmapField listed above.

 

Anyone have issue around this?

 

Here's my code for the NavigationBar (placed above the BrowserField)

 

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.HorizontalFieldManager;

public class NotificationBar extends HorizontalFieldManager {
	BitmapField[] _bmpField;

	Bitmap[] _bitmap;

	public NotificationBar() {
		super(USE_ALL_WIDTH);

		// assume only one bitmap first
		setExtent(Display.getWidth(), 25);

		_bitmap = new Bitmap[2];

		_bitmap[0] = BitmapIconContext._rss;
		_bitmap[1] = BitmapIconContext._blog;

		_bmpField = new BitmapField[2];
		_bmpField[0] = new BitmapField(_bitmap[0], FOCUSABLE);
		_bmpField[0].setMargin(2, 2, 2, 2);
		
		_bmpField[1] = new BitmapField(_bitmap[1], FOCUSABLE);
		_bmpField[1].setMargin(2, 2, 2, 2);
		
		add(_bmpField[0]);
		add(_bmpField[1]);
	}

	public void setBitmapIndicator(int index, boolean showIndicator) {
		switch (index) {
		case 0: // rss
			if (showIndicator) {
				_bitmap[0] = BitmapIconContext._rss2;
			} else {
				_bitmap[0] = BitmapIconContext._rss;
			}
			break;
		case 1: // rss
			if (showIndicator) {
				_bitmap[1] = BitmapIconContext._blog2;
			} else {
				_bitmap[1] = BitmapIconContext._blog;
			}
			break;
		}
	}
}

My BrowserScreen constructor should

 

public BrowserScreen() {
		progressTracker = new BrowserFieldLoadProgressTracker(10f);

		// Set the displayed title of the screen
		_notificationBar = new NotificationBar();
		setTitle(_notificationBar);

		_browserField = createBrowserField();
		add(_browserField);

		hfm = new HorizontalFieldManager();

		progressBar = new GaugeField("", 0, 100, 0, USE_ALL_WIDTH | GaugeField.LABEL_AS_PROGRESS);
		progressBar.setBorder(BorderFactory.createSimpleBorder(new XYEdges(0,
				0, hfm.getWidth(), hfm.getHeight())));
		hfm.add(progressBar);
		setStatus(hfm);

		UiApplication.getUiApplication().invokeLater(new Runnable() {
			public void run() {
				              _browserField.requestContent(URL);

			}
		});
	}

 Required behavior:

 

1. User has already can browse on the browser field using pointer navigation (default, NAVIGATION_MODE_NONE)

2. How can user go to one of BitmapField above, when the pointer move into the top Navigation Bar, the pointer should be dismissed, and one of BitmapField should be focus, so user can navigating on them.

 

Thanks

 

Until you spread your wings, You will have no idea how far you can fly