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

ListField Focus element

Hey guys,

 

I was just wondering if this is normal for a ListField. When I add the listfield to my screen, by default it always highlights the first element in the list (index 0). It makes it blue (which is the default selected color), however the problem is in my app the actual focus is not even in the list field. I don't want my listfield to highlight the first element in the list until there is actual focus on the list... is there a way to stop this behavior from happening? or perhaps a way to setSelectedIndex to none? 

 

Any help would be greatly appreciated

 

Thanks

Developer
Posts: 466
Registered: ‎03-04-2009
My Device: 8520
My Carrier: some

Re: ListField Focus element

I presume you should set the focus manually to any other field.

Got resolved! Press kudo icon!
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: ListField Focus element

[ Edited ]

Hi,

 

You can add nullfield before listfield , it should solve your porblem.

 

for eg

 

 add(new NullField(Field.FOCUSABLE));
      drawList();

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Developer
Posts: 132
Registered: ‎11-20-2009
My Device: Not Specified

Re: ListField Focus element

Rajat - I tried adding a NullField and it still does the same thing. I just did the following to the mainscreen:

 

        add(new NullField(Field.FOCUSABLE));
        add(new PropertyListField(resultsVector, this));

 

Same result... it always highlights the first element in the list, not to mention when the ListField loses focus it keeps the first element highlighted as well.

 

I would like to manually move the focus but how do you manually move the focus to none of the fields in the list?

Highlighted
Developer
Posts: 132
Registered: ‎11-20-2009
My Device: Not Specified

Re: ListField Focus element

I managed to get it to stop doing it... I simply used

 

if(pGraphics.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS))

 

instead of getSelectedIndex == index.

 

Thanks for the help guys

New Developer
Posts: 77
Registered: ‎09-02-2010
My Device: torch
My Carrier: blackberry developer

Re: ListField Focus element

thanks guys....