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
New Contributor
xdeveloper
Posts: 9
Registered: ‎06-01-2012
My Device: 9780
My Carrier: PLAY
Accepted Solution

ListField: menu appears after navigation click

Hello Community Members,

 

I have an issue with the menu that appears for the screen with ListField after the navigation click event is raised.

 

Here is what I'm doing to reproduce this issue:

- navigation click on the selected entry of the ListField control,

- a new screen appears,

- on this new screen the menu appears that is defined for the screen on which the ListField control is put.

 

The navigation click is handled in the following way:

 

protected boolean navigationClick(int status, int time)
{
  Field field = this.getFieldWithFocus();

  if (field instanceof ListField)
  {

    MyAnotherScreen another = new MyAnotherScreen();

    UiApplication.getUiApplication().pushScreen(another);

    return true;
  }

 

  return super.navigationClick(status, time);
}

 

protected boolean navigationUnclick(int status, int time)
{
  return false;
}

 

The ListField is declared in the following way:

 

lstData = new ListField(0, Field.FIELD_HCENTER);
lstData.setMargin(2, 2, 2, 2);


Callback is defined in the most standard way  - there is nothing special in it. 

 

I searched for a something, which allows to consume the click for ObjectListField as the ButtonField.CONSUME_CLICK does it for the ButtonField controls, but... with no success so far. That's why I have decided to write a post here.

 

Thanks in advance for any help!

Please use plain text.
Developer
tklanilkumar
Posts: 206
Registered: ‎02-22-2011
My Device: BB TORCH & 9800
My Carrier: idea

Re: ListField: menu appears after navigation click

in the above code what ever the ListField you are using for that pass the style and check like below

ListField lst = new ListField(" ",ButtonField.CONSUME_CLICK);

*****************************************************************************
* Give kudos when you like it
* Mark it as a solution if it fixes your issue
Please use plain text.
New Contributor
xdeveloper
Posts: 9
Registered: ‎06-01-2012
My Device: 9780
My Carrier: PLAY

Re: ListField: menu appears after navigation click

@tklanilkumar

 

I have tried to create the instances of ListField objects with ButtonField.CONSUME_CLICK style, but the context menu still appears on my 9780 device when item is clicked on the ListField control.

 

What's more interesting, this context menu is not displayed on the 9800 simulator - at least I'm unable to see it on the simulator.

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: ListField: menu appears after navigation click

Try returning true from navigationUnclick - this will consume the event.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
New Contributor
xdeveloper
Posts: 9
Registered: ‎06-01-2012
My Device: 9780
My Carrier: PLAY

Re: ListField: menu appears after navigation click

@arkadyz

 

I have already tried this but this solution does not work either. :-(

Please use plain text.
New Contributor
xdeveloper
Posts: 9
Registered: ‎06-01-2012
My Device: 9780
My Carrier: PLAY

Re: ListField: menu appears after navigation click

I solved the problem.

 

It was caused by the fact that the Screen, on which the ListField control was not closed. After adding the below line, it works fine now:

 

  if (field instanceof ListField)
  {

         MyAnotherScreen another = new MyAnotherScreen();

         UiApplication.getUiApplication().pushScreen(another);
         this.close();
         return true;
  }

Please use plain text.
Developer
pradeep_ch
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: ListField: menu appears after navigation click

Then why dont you close this thread.

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

Re: ListField: menu appears after navigation click

When pradeep says close, he means mark the Thread as Solved.  This is a good idea because then people don't waste time looking at it. If you don't know how to mark it as solved, look at the Help Link you will find near the top of the Screen. 

Please use plain text.
New Contributor
xdeveloper
Posts: 9
Registered: ‎06-01-2012
My Device: 9780
My Carrier: PLAY

Re: ListField: menu appears after navigation click

Apologies, this is/was my first thread so I forgot to set my response as solution... ;-)

Please use plain text.