开发者

How to get coordinates of field within the visible screen when scroll is used? ( Blackberry, BB, Java )

1)the field placed in manager has fixed position in that manager.

2)when user scrolls the screen the field is moving along the visible screen, (although his position within manager remains fixed).

How to get these visible-screen-coordinates of the field when user scrolls the view and sets开发者_如何学C focus on the field?

P.S. They might be called 'absolute coordinates'

Thanks!


Not sure if it can help you. Have you looked at getFocusRect(XYRect xyrect)? When child field gets foucs, retreive extent of the manager's focus region. API says that

getFocusRect

public void getFocusRect(XYRect rect) Retrieves current extent of the focus. Invoke this method to retrieve the extent of the current focus region. Notice that the coordinates expressed are local to this manager, and take scrolling into account (that is, the coordinates are local to the manager's visible region, not the virtual region).

Overrides: getFocusRect in class Field Parameters: rect - Rect to contain extent of focus.

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/ui/Manager.html#getFocusRect(net.rim.device.api.ui.XYRect)


found solution:

XYRect rc = new XYRect(0,0,1,1); 
_myField.getScreen().getFocusRect(rc);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜