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
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified
Accepted Solution

Trouble Scrolling in PopupScreen

Hello,

 

I have added a PopupScreen to my application that will display some text given to it. When the text is displayed, the scroll arrow appears indicating that there is more text to show, however it will not let me scroll when I click down (testing on a BlackBerry with a track ball).

 

The text is displayed in a LabelField (which I believe is not Focusable by default), but even when I say new LabelField("text", Field.FOCUSABLE), it still does not let me scroll down. I have tried adding other fields (such as EditFields) and it seems to work. So I am guessing the issue is with the focus?

 

Can anyone tell me why this is? Here is my code:

 

 

package com.kflicks.ui.Screens;

import java.util.Vector;

import net.rim.device.api.system.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;

public class SynopsisScreen extends PopupScreen implements KeyListener {

	Vector results;

	LabelField label;

	public SynopsisScreen(String synopsis) {
		super(new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR),
				Field.FOCUSABLE);

		label = new LabelField(synopsis);
		add(label);
	}

	public void close() {
		UiApplication.getUiApplication().popScreen(this);
	}

	// ///////////////////////////////////
	// / implementation of Keylistener
	// ///////////////////////////////////
	public boolean keyChar(char key, int status, int time) {
		// intercept the ESC key - exit the app on its receipt
		boolean retval = false;
		switch (key) {
		case Characters.ENTER:
			break;
		case Characters.ESCAPE:
			close();
			break;
		default:
			retval = super.keyChar(key, status, time);
		}
		return retval;
	}

	/** Implementation of KeyListener.keyDown */
	public boolean keyDown(int keycode, int time) {
		return false;
	}

	/** Implementation of KeyListener.keyRepeat */
	public boolean keyRepeat(int keycode, int time) {
		return false;
	}

	/** Implementation of KeyListener.keyStatus */
	public boolean keyStatus(int keycode, int time) {
		return false;
	}

	/** Implementation of KeyListener.keyUp */
	public boolean keyUp(int keycode, int time) {
		return false;
	}
}

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Trouble Scrolling in PopupScreen

Try swapping your LabelField for a RichTextField and see if that resolves your issue. 

Highlighted
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: Trouble Scrolling in PopupScreen

That did the trick, thanks!