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: 33
Registered: ‎05-12-2010
My Device: none
My Carrier: none
Accepted Solution

Set a field as focusable but not clickable

Hey devs,

 

I am trying to make a field that could be focused but not clicked, I have searched the forum and found different solutions. I finally came up with this:

 

FontField fontField = new FontField(FOCUSABLE | Field.VISUAL_STATE_FOCUS | Field.USE_ALL_WIDTH){

protected boolean navigationClick(int status, int time){
return true;};};

However the menu still pops up when I click on the field. Any clues?


Thanks a lot for your help... Smiley Happy

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

Re: Set a field as focusable but not clickable

Try overriding navigationUnclick as well.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Contributor
Posts: 33
Registered: ‎05-12-2010
My Device: none
My Carrier: none

Re: Set a field as focusable but not clickable

[ Edited ]

Thanks for the fast reply!

 

Here is my new code, which still does not work, is it correctly written at least?

 

FontField fontField = new FontField(FOCUSABLE | Field.VISUAL_STATE_FOCUS | Field.USE_ALL_WIDTH){

protected boolean navigationClick(int status, int time){
return true;};
protected boolean navigationUnClick(int status, int time){
return true;}};

Eclipse does say that "NavigationUnClick" is never read locally, I am not sure of what that means.

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Set a field as focusable but not clickable

It is navigationUnclick, not navigationUnClick (notice the difference in capitalization).

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Set a field as focusable but not clickable

If you're using Eclipse, put @Override in front of every method you (think you) are overriding. Then Eclipse will report an error when you make a typo like that. Smiley Happy




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Contributor
Posts: 33
Registered: ‎05-12-2010
My Device: none
My Carrier: none

Re: Set a field as focusable but not clickable

It worked, thanks for the tips and solution! Smiley Wink