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
Developer
Posts: 57
Registered: ‎03-24-2009
My Device: Not Specified
Accepted Solution

Is there any way to make a HorizontalFieldManager clickable?

I have a list of results coming back from a web service and I'm currently displaying them in a HorizontalFieldManager (I'm using it because there is a bunch of different data that makes up a single result), what I'm wondering is if there's a way to allow the user to select an entire field as if it were a ButtonField or something like that.  Are there any built in methods that I can use?  Or would I have to write a new class extending the standard HorizontalFieldManager?

 

I know on a BitmapField I can put brackets after I declare it and override the navigationClick method to make it clickable, so does the same work for the HFM? 

Developer
Posts: 16,676
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Is there any way to make a HorizontalFieldManager clickable?

the class manager has the method navigationclick. but first a field within the manager needs to have the focus - if there are no fields this is not possible,
you can add a nullfield to handle this, or, if there are already fields, deny them any clickhandling (no consume_click or overwritten navigationclick) and handle the click in the manager.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 57
Registered: ‎03-24-2009
My Device: Not Specified

Re: Is there any way to make a HorizontalFieldManager clickable?

So basically, as long as I have even some LabelFields in there which are set to FOCUSABLE, but don't implement any kind of click consuming, the HFM will get the resulting click and be able to handle it?
Developer
Developer
Posts: 167
Registered: ‎11-12-2008
My Device: Not Specified

Re: Is there any way to make a HorizontalFieldManager clickable?

Yep, just override navigationClick.  I do the same thing in my application.
Developer
Posts: 57
Registered: ‎03-24-2009
My Device: Not Specified

Re: Is there any way to make a HorizontalFieldManager clickable?

Sweet, thanks guys!  Kudos to both of you!
Developer
Posts: 34
Registered: ‎11-20-2009
My Device: Not Specified

Re: Is there any way to make a HorizontalFieldManager clickable?

Do you think you can provide sample code for this .. ? i have a similar situation .. but am not very confortable with overiding ...

 

thanks in advance.

 

 

Contributor
Posts: 11
Registered: ‎06-07-2011
My Device: Bold 9780
My Carrier: Rogers

Re: Is there any way to make a HorizontalFieldManager clickable?

public class MyManager extends HorizontalFieldManager {

  public MyManager() {
    super(...);
    LabelField lblTitle = new LabelField("Click me", LabelField.FOCUSABLE);
    add(lblTitle);  
  }

  protected boolean navigationClick(int status, int time) {
     //This will be called when clicked
     return true;
  }
}

 

I do know that this post is 2 years old now, but though I might as well post it for those people who need it now.