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
Trusted Contributor
Posts: 184
Registered: ‎11-26-2010
My Device: Not Specified

Horizontal scrollable text edit field issue on 7.0(9900) devices

Hi I am using CustomEditBox according to this Arkadyz Article; This worked perfeectly on OS 5.0 devices, but when I tried to run on the OS 6.0 I faced trouble with Horizontal Scrolling  mentioned here by William8. I managed to fix it with an work around very similar to it. I am attaching the code below,

	protected boolean navigationMovement(int dx, int dy, int status, int time) {
		int sizeEditField = ((BasicEditField) editField).getText().length();
		int postnEditField = ((BasicEditField) editField).getCursorPosition();
		if (dx == 1 || dx == -1) {
			if (dx == 1 && sizeEditField == postnEditField
			/* && postnEditField != 0 */) {
				//textHolderManager.setHorizontalScroll(postnEditField);
				Manager m = this.getManager();
				int myIndex = this.getIndex();
				int managerFieldCount = m.getFieldCount();
				Field nextFocus = null;
				int k = 0;
				for (int i = myIndex + 1; i < managerFieldCount; i++) {
					k = i;
					Field testField = m.getField(i);
					if (testField.isFocusable()) {
						nextFocus = testField;
						break;
					}
				}
				if (nextFocus != null) {
					try {
						nextFocus.setFocus();
					} catch (Error e) {
						Field testField = m.getField(k-1);
						testField.setFocus();
					}
				}

				return true;
			} else {
				return super.navigationMovement(dx, dy, status, time);
			}
		}
		if (dy == 1 || dy == -1) {
			return super.navigationMovement(dx, dy, status, time);
		}
		return true;
	}

 This worked perfect on OS 6.0 Devices, but when I try to run this on BB 7.1 (9900) Simulator the infinite scrolling of HorizontalFieldManager is again popping up. I am not able to understand the nature of this problem. Please shed some Ghyan on how to solve this. I welcome help of any sort.

 

A Y.

,