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
kedarkarthik
Posts: 34
Registered: ‎11-20-2009
My Device: Not Specified
Accepted Solution

How do I add a button to CUstom List Field?

I have a CustomListField .. i need to add a button column on each row of the list ...c an somebody hel[p me with sample code .. or the idea ...

 

 

thank you.

 

 

Please use plain text.
Developer
peter_strange
Posts: 19,602
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I add a button to CUstom List Field?

A ListField provides a selectable Row.  You can't subdivide the row up into pieces, at least I can't see a way that would not involve masses of complicated coding.  So if you want a separately focusable button, you are going to have use something other than a ListField.   Sorry.

Please use plain text.
Developer
kedarkarthik
Posts: 34
Registered: ‎11-20-2009
My Device: Not Specified

Re: How do I add a button to CUstom List Field?

oh ok .. good to know .. i gave it up

 

Now trying to create the <label> <Label> <Button> template in a customHorizontalFieldManager ... I do have 1 problem with it

 

2 cases .. i have FOCUSABLE on first <label> and <Button> .. (Actually wanted entire row .. i tried implementing your idea from some other POST)

 

i can get the row click working ... its thourgh First Label click .. but when Button is clicked I want a different action to be performed ... i have overridden these methods in Mybutton extends Field class

 

I want to toggle value on the button .. i store botht Toggle values in MyButton object ... andthe button is set to FOCUSABLE ... but cant get the click working on the button ..

 

Cna you please help .... thanks a ton

 

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

 

  protected void fieldChangeNotify(int context)
  {
              try
            {
                      this.getChangeListener().fieldChanged(this, context);
          }
              catch (Exception e)
            {}
     }

 

 

Please use plain text.
Developer
peter_strange
Posts: 19,602
Registered: ‎07-14-2008
My Device: Not Specified

Re: How do I add a button to CUstom List Field?

Have you debugged these statements to see if they are being executed?  They look OK to me, so I suspect a problem with the listener.

 

You might also want to specify CONSUME_CLICK.  See this Thread

http://supportforums.blackberry.com/t5/Java-Development/ButtonField-CONSUME-CLICK-what-is-it-for/m-p...

Please use plain text.
Developer
kedarkarthik
Posts: 34
Registered: ‎11-20-2009
My Device: Not Specified

Re: How do I add a button to CUstom List Field?

in case it helps //. what worked for me is ...

 

first of first 2 labels in the row ->FOCUSABLE

row-> NON-FOCUSABLE

button FOCUSABLE

 

Now i can perform different actions when label is clicked or button is clicked.

 

Thanks Peter

Please use plain text.
New Contributor
TessyJose
Posts: 8
Registered: ‎11-17-2011
My Device: developer
My Carrier: developer

Re: How do I add a button to CUstom List Field?

Hi .. i managed to make a custom list with each row having a image, a lable field and a button field ( ObjectChoiceField) . the problem i am facing is that i am not able to click that button field . any idea how to bring the focus on that ? currently the whole row is in focus
Please use plain text.
Regular Visitor
Ayat010
Posts: 1
Registered: ‎02-28-2013
My Device: black berry 9090-developer
My Carrier: vodafone

Re: How do I add a button to CUstom List Field?

If the button is defined with ButtonField.CONSUME_CLICK , will consume the click.
Please use plain text.