Problem solved: Spinboxfieldmanager, but the cursor can only move back and forth in 3 spin box, cannot move to the other field below

Source: Internet
Author: User

There is a problem, I built 3 Textspinboxfield into the Spinboxfieldmanager, but the cursor can only be moved back and forth in 3 spin box, cannot move to the following other field, I want to rewrite what method or how to deal with

Solve:

The core is the extended Spinboxfieldmanager object, which only handles left and right moves (move dx>0 or DX <0) in its navigationmovement () method.

Do not process dy, by the superior manager to deal with return Super.navigationmovement (Dx,dy,status,time);

public class Helloworlddemo extends UIApplication {/** * Entry point for application * @param args Command line arguments (not used) */public static void main (string[] args) {//Create a new instance of the application and make the currently Running thread the application ' s event dispatch thread. Helloworlddemo Theapp = new Helloworlddemo (); Theapp.entereventdispatcher (); }/** * Creates a new Helloworlddemo object */Public Helloworlddemo () {//Push a screens onto the UI stack for rendering. Pushscreen (New Helloworldscreen ()); }}/** * A class extending the Mainscreen class, which provides default standard * behavior for BlackBerry GUI applicatio Ns. */FINAL class Helloworldscreen extends Mainscreen {richtextfield text = new Richtextfield ("Hello world!", field.focusabl E); Textspinboxfield spinboxdays; Textspinboxfield spinboxmonths; Spinboxfieldmanager Spinboxmgr; Helloworldscreen () {//Set the displayed title of the screen//settitle ("Hello World Demo"); HorizontalfieldmanagEr mgr = new HorizontalFieldManager (); Bitmap image = Bitmap.getbitmapresource ("icon0001. PNG "); BitmapField icon = new BitmapField (image, bitmapfield.non_focusable); Mgr.add (icon); Mgr.add (New LabelField ("Hello World Demo")); Settitle (MGR); Add (text); Spinboxmgr = new Spinboxfieldmanager () {protected Boolean navigationmovement (int dx, int dy, int status, int time) {if (dx>0) {int fieldcount = GetFieldCount (); int focusindex = Getfieldwithfocusindex (); if (Focusindex >= fieldCount-1) {Text.s Etfocus (); return true; }} return Super.navigationmovement (Dx,dy,status,time); } }; Final string[] days = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; Final string[] MONTHS = {"January", "February", "March", "April", "may", "June", "July", "August", "September", "October", " November "," December "}; Spinboxdays = new Textspinboxfield (days); Spinboxmonths = new Textspinboxfield (MONTHS); Spinboxmgr.add (spinboxdays); Spinboxmgr.add (spinboxmonths); Add (spinboxmgr); }

Original:

Http://topic.csdn.net/u/20100813/19/af4d1844-1a55-4915-848f-5191593172ca.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.