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 Developer
BB_Developement
Posts: 76
Registered: ‎03-22-2013
My Device: 9900,9930,9790,9780,9330

How to get y position of Field.

Hello All,

 

      I have to pass y position to tooltip in my app.  Using Field.getLeft() i got x postion for tooltip.

I tried using Field.getTop() and Field.getContentTop() but it  returns 0 always .So its not works for me .

Please anyone tell me how to find y co-ordinate value for ImageButton .

 

Thanks in Advance.

 

Please use plain text.
Developer
simon_hain
Posts: 16,134
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to get y position of Field.

use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/Field.html#getContentRect() to get a XYRect
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
peter_strange
Posts: 19,603
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to get y position of Field.

[ Edited ]

Remember that position is relative to the Manager.  If you want the absolute position of a Field on the Screen, then you need to recurse up the Managers until you get to the Screen. 

Please use plain text.
New Developer
BB_Developement
Posts: 76
Registered: ‎03-22-2013
My Device: 9900,9930,9790,9780,9330

Re: How to get y position of Field.

Thanks for your solutions.

 

can you please provide any example to get more cleare to me. In my code I have added multiple ImageButtons in one HorizontalFieldManager.

Please use plain text.
Developer
simon_hain
Posts: 16,134
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to get y position of Field.

Peter is right, i checked my own tooltip library, we don't ask the field, we ask the screen:
http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/ui/Screen.html#getFocusRect(ne...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.