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
Contributor
Posts: 48
Registered: ‎07-20-2010
My Device: Not Specified
My Carrier: developer

listfield navigation problem...

hi.. this doubt may be silly.. but sorry i cant able to find solution for this.. i have a list field in first screen which takes to a another list field in second screen when the items are selected..i had implemented this in the device.. its working .. but .. i cant able to select the listfield items through track ball.. i need to select the items by pressing enter (return key)key in the keypad.. i dono how to change it to trackball click event..please help......

Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: listfield navigation problem...

Usually you do this by overriding navigationClick.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Contributor
Posts: 48
Registered: ‎07-20-2010
My Device: Not Specified
My Carrier: developer

Re: listfield navigation problem...

@Ted

 

i tried.. but some errors are there.. i dont knw how to do it exactly.. is there any sample codes ??? this is my coding part.....

public nextscreen() {

		super(DEFAULT_MENU | DEFAULT_CLOSE);
		
		add(new BitmapField(Bitmap.getBitmapResource("logo.gif"),  DrawStyle.HCENTER));
		myFont = Font.getDefault().derive(Font.DROP_SHADOW_RIGHT_EFFECT, 18); 
		
 addKeyListener(new KeyListener() {   
			  
	         public boolean keyChar(char key, int status, int time) {   
	        	 if (key == Characters.ESCAPE)   
	                 return false;   
	             if (key == Characters.ENTER) {   
	                System.out.println(_list.getSelectedIndex()); 
	                valueurl = (String) urllist.elementAt(_list.getSelectedIndex());
	                 //vid = videoscreen.sr;
	                 
	                //UiApplication.getUiApplication().pushScreen(new bridge());
	                 //UiApplication.getUiApplication().pushScreen(new videoscreen())
	                           if (_list.getSelectedIndex() == 0) 	            	 
		  	            	UiApplication.getUiApplication().pushScreen(new WebIcon());
		  	              else if (_list.getSelectedIndex() == 1)   
		     	        	  UiApplication.getUiApplication().pushScreen(new WebIcon());
		                  else if (_list.getSelectedIndex() == 2)   
		                	UiApplication.getUiApplication().pushScreen(new WebIcon());
		                  else if (_list.getSelectedIndex() == 3)   
		            	   UiApplication.getUiApplication().pushScreen(new WebIcon());
		                  else if (_list.getSelectedIndex() == 4)   
		            	   UiApplication.getUiApplication().pushScreen(new WebIcon());
		                  else if (_list.getSelectedIndex() == 5)   
		            	   UiApplication.getUiApplication().pushScreen(new WebIcon());
		                  else if (_list.getSelectedIndex() == 6)   
		            	  UiApplication.getUiApplication().pushScreen(new WebIcon());
		                  else if (_list.getSelectedIndex() == 7)   
		            	  UiApplication.getUiApplication().pushScreen(new WebIcon());
		                   else if (_list.getSelectedIndex() == 8)   
		            	   UiApplication.getUiApplication().pushScreen(new WebIcon());
		             }
		            return true;    
	         }   

	        public boolean keyDown(int keycode, int time) {   
	             return false;   
	         }   

	        public boolean keyUp(int keycode, int time) {   
	             //UiApplication.getUiApplication().pushScreen(new ascreen());   
	            return false;   
	         }   

	        public boolean keyRepeat(int keycode, int time) {   
	            return false;   
	         }   

	        public boolean keyStatus(int keycode, int time) {   
	            return false;   
	         }   
	     }); 
		
	_connectionthread = new Connection();
	_connectionthread.start();
	
	}

 

 

Developer
Posts: 51
Registered: ‎07-15-2008
My Device: Not Specified

Re: listfield navigation problem...

 

Hi,

 

I guess you are not handling navigation events on listField.

 

Try to handle invokeAction or navigationClick on listField and in respective action you can push the new screen or whtever you want to do...

 

 

protected boolean invokeAction(int action) {
switch (action) {
case ACTION_INVOKE:
int index = this.getSelectedIndex();
if (index != -1) {
MSProject proj = (MSProject) this.getCallback().get(this, index);
UIController.getInstance().projItemClicked(proj);
}
return true;
}
return super.invokeAction(action);
}

 

protected boolean invokeAction(int action)

{

switch (action)

{

  case ACTION_INVOKE:  

  //do your action here 

  return true;

  }

  return super.invokeAction(action);

 }