tags:

views:

245

answers:

2

Hi,

I am creating application for touch devices for nokia. J2ME provides methods pointerpressed,release and drag on canvas.

I have generated a canvas in full screen mode having commands. On click of "option" command, another command menu opens, which is having commands like Ok, Back, Next.

Now to get the event of sub command menu I have to get that which command is clicked.

My question is how can I get that particular command has been clicked? Application is for N97/Music express (no keyboard support). I just want the way out using touch functionality. keypress event is not at all useful for me.

Thank you in advance. Rajiv

+1  A: 

If you have pointer events, then look at the co-ordinates of the event, and check to see whether it lies within where you're drawing your menu option on the canvas.

funkybro
Thank you for your response.But think like I have 5 different views, having different command on each canvas.In your suggested way I have to take every coordinate manually for each command for every view. Is there any optimum solution?
rajiv
Are you using a Canvas menu system that you've designed yourself? If so, you should make each menu option an object, that knows its own area and position on-screen. Then, when a pointer event is received, inform each menu option in turn of the co-ordinates, and have the option class return true or false depending on whether the co-ordinates are within its on-screen area.
funkybro
yes I am using canvas menu system. I searched out for other feasible option but i dont think J2ME api support anything like that, so finally I am starting to apply coordinate system. Will try to make it dynamic for reusability.
rajiv
Don't be afraid to upvote.
funkybro
A: 

Did you see something on SVG (JSR226) or LWUIT?

Diego