1. xdeveloper's Avatar
    Hello,

    Couple days ago I have discovered a strange bug in my app.

    I have two Screen objects:
    - Screen1, which displays the ListField control,
    - Screen2, which displays the data of an item selected through the ListField control.

    Now, when I select an item on the ListField control (on the Screen1) and then press the trackpad, the Screen2 appears, but also a context menu is displayed that belongs to Screen1 (Screen1 and Screen2 objects have different context menus).

    I have tried everything that is known to me to overcome this issue, but... with no success so far.

    The navigation click is handled in the following way (Screen1):

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

    if (field instanceof ListField)
    {
    // here I'm getting the element data from the ListField object
    // ...
    Screen2 screen2 = new Screen2();
    UiApplication.getUiApplication().pushScreen(screen 2);

    return true;
    }

    return super.navigationClick(status, time);
    }

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


    The ListField control is initialized as follows (also Screen1):

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


    I have no idea what's wrong with this code... I tried to use ButtonField.CONSUME_CLICK style - but this also does not work.

    What's more interesting, this context menu does not appear on the 9800 simulator - at least I was unable to see it on this simulator. But when I'm testing this app on my 9780 device, the context menu appears every time.
    06-04-12 08:28 AM
  2. pkcable's Avatar
    Anyone have an answer for my friend here? I'm just getting start myself so I can't be much help, but hopefully some of our experts can answer your question.
    06-06-12 02:29 PM
  3. xdeveloper's Avatar
    @pkcable

    Thanks, I hope that someone will be able to help me with this issue.
    06-08-12 01:57 PM
  4. xdeveloper's Avatar
    I have finally solved this issue...

    The problem was caused by the Screen1, which was not closed and because of that its context menu was displayed every time, when the Screen2 was displayed.

    After adding the below line, it works fine now:

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

    if (field instanceof ListField)
    {
    // here I'm getting the element data from the ListField object
    // ...
    Screen2 screen2 = new Screen2();
    UiApplication.getUiApplication().pushScreen(screen 2);
    this.close();

    return true;
    }
    06-21-12 05:32 AM
LINK TO POST COPIED TO CLIPBOARD