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
Regular Contributor
gillaraz
Posts: 69
Registered: ‎10-19-2010
Accepted Solution

How to ignore click on button after implementing navigationClick()

My application has 3 buttons to be clicked as menu and I have set FieldChangeListener to each of them.

It work perfectly ! but when I implement my listField with

 

 

  public boolean navigationClick(int status, int time) {
	  Field focus = view.getLeafFieldWithFocus();
	  Dialog.alert("Focus String :: " + focus.getIndex());

	  if (focus instanceof ListField) {
	  ListField listField=(ListField)focus;


	  Dialog.alert("Selected Index"+listField.getSelectedIndex());
	  Dialog.alert("Selected List Value"+listField.getCallback().get(listField, listField.getSelectedIndex()).toString());


	  }else{}
	  return true;
	  
	  	  
	  }

 The listener on buttons are override with navigationclick and ignore fieldlistenser.

 

How can solve this problem ?

 

Thanks

 

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Carrier: airtel

Re: How to ignore click on button after implementing navigationClick()

[ Edited ]

you left else block empty try with

 

 

protected boolean navigationClick(int status, int time) {
		Field focus = getLeafFieldWithFocus();
		 if (focus instanceof ListField) {
			  ListField listField=(ListField)focus;
			  Dialog.alert("Selected Index"+listField.getSelectedIndex());
			  Dialog.alert("Selected List Value"+listField.getCallback().get(listField, listField.getSelectedIndex()).toString());
			return true;
		}else{
			return super.navigationClick(status, time);
		}
		
		
	}

 

 

Please use plain text.
Regular Contributor
gillaraz
Posts: 69
Registered: ‎10-19-2010

Re: How to ignore click on button after implementing navigationClick()

Thanks for fast reply but it's not work

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Carrier: airtel

Re: How to ignore click on button after implementing navigationClick()

i edited my reply to show complete function .

i think you left last return true unchanged because of that it didn't work.

Please use plain text.
Regular Contributor
gillaraz
Posts: 69
Registered: ‎10-19-2010

Re: How to ignore click on button after implementing navigationClick()

It's still not ignore button click. Anyway I think may be it is not possible to solve this issue.

Please use plain text.
Regular Contributor
gillaraz
Posts: 69
Registered: ‎10-19-2010

Re: How to ignore click on button after implementing navigationClick()

Still can't find any solution, when the user click on listfield, it will be directed to other screen but I don't but for button, it directed to other screen too.

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Carrier: airtel

Re: How to ignore click on button after implementing navigationClick()

when you are clicking on button getLeafFieldWithFocus(); is returning ListField instance or ButtonField instance .

Please use plain text.
Regular Contributor
gillaraz
Posts: 69
Registered: ‎10-19-2010

Re: How to ignore click on button after implementing navigationClick()

oh God!!

 

My stupid mistake :smileysad:

 

I found my error. I forget to change to

 

 Field focus = getLeafFieldWithFocus();

 

Everything is working fine :smileyhappy:

 

Thanks million times vivart

 

Please use plain text.