PDA

View Full Version : Tap Coordinates Relative to Item on Panel



bcmillustrator
30 Apr 2011, 7:05 PM
Hi Everyone,

I've created a page with a toolbar and a panel. The panel is listening for a tap event. I need to find the coordinates of the tap point relative to the panel item. I can get the coordinates of the tap relative to the entire page (via pageX and pageY). I'd like to get the coordinates relative to my panel. So for instance, if the top of my panel happens to be at y=80 and a tap occurs on the panel at y=120, I'd like to be able to get the relative coordinate of y=40.

Does the framework provide for a relative location? Or do I need to calculate this value myself. If so, does the framework provide the screen location of items?

Thanks,

Brian

bcmillustrator
1 May 2011, 3:57 AM
Hi Gang,

I figured out how fix my problem. I used the following line of code:

Ext.get('ext-comp-1004').getBox()From that I can get the top and find the relative location. I don't however understand this line of code. I can guess the getBox function will get the box of the componenet. I can also guess the Ext.get("ext-comp-1004") will get this component. I don't, however, know where ext-comp-1004 came from. What is the significance of that name?

Thanks,

Brian