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