mkaouer / j4me

Automatically exported from code.google.com/p/j4me
1 stars 0 forks source link

getSelected() always returning 0 and acceptNotify() not being called on PointerPressed events #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The getSelected() method is always returning 0 on PointerPressed events,
instead of returning the index of the item that was selected. It also seems
that the acceptNotify() method is not being called too.

The J4ME release being used is 1.0.2 and the PDA's operating system is
Windows Mobile 5. The PDA's JVM is Esmertec.

Original issue reported on code.google.com by nsanc...@gmail.com on 5 Apr 2008 at 7:16

GoogleCodeExporter commented 9 years ago
More details from the support group:

Just some more aditional information:

The transition to the next menu seems to be happening OK. If I wasn't
filling the next menu dynamically, I think there would be no problems.
But in this case the next menu is filled only after the user's
selection and its items depend on the user's selection.

This is the issue with some more details: I have a menu and its items
point to other menus. They were appended using appendMenuOption(String
name, DeviceScreen choice). That DeviceScreen is always the same, and
it will be filled depending on the user's choice. I'm doing this to
avoid instanciating several different Menus, one for each option,
which consumes a lot of memory because I have lots of menus (I have a
version of the application that instanciates a menu for every option
and it works OK on the PDA, but it always crashes on my Nokia N80 - i
believe it's due to memory issues because the new version with less
menus works OK). I overrided the acceptNotify() method and when an
option is selected, I do a getSelected() to know which one it was.
Then I do a deleteAll() on the next menu and append the desired items
to it. The items that I append depend on the index returned previously
by getSelected(). The problem is that getSelected() is returing 0 when
I use the stylus (not when i use the PDA buttons, because when I use
the buttons or when I use a simple mobile phone with no touch screen
it returns the correct index). It also seems to me that the
acceptNotify() method is never called on pointerPressed events.

Original comment by deanbro...@gmail.com on 8 Apr 2008 at 12:29

GoogleCodeExporter commented 9 years ago
Not a bug.  There was some extra coding done that expected behavior that 
doesn't happen.

From the discussion board:

I did some more testing, it seems the only issue was acceptNotify()
not being called and this led me to think that getSelected() wasn't
being called too.
As I noticed that showNotify() was being called and acceptNotify()
wasn't, I overrided showNotify() and placed in it a call to
acceptNotify() (acceptNotify() had already been overriden and it was
doing a getSelected() because as I said previously I needed the
selected index to know how to create the next menu).
It happens that when showNotify() is called, the setSelected isn't
done yet, that's why getSelected was always returning 0. So if you
consider that it is normal not to call acceptNotify() on
pointerPressed events, then I think there are no bugs.

P.S.: I didn't find a button to erase the issue on the issues tab, it
seems to be impossible to me.

Thanks and sorry for taking a wrong conclusion about getSelected(),
N. Sanches

Original comment by deanbro...@gmail.com on 9 Apr 2008 at 7:27