Need to know the position of the bitmap wrt 0,0 on blackberry screen field

Hello

I have a form that contains a few text fields and a field of bitmap image. I use this bitmap field to capture the signature.

The problem is how whether the y of the bitmap field. I used the getContentTop and getTop methods but they give me the position of the bitmap field wherever I want to know where my bitmap field at that time regarding the point 0,0 of the screen while I scroll vertically.

SO if someone scrolls the screen so that the field of the bitmap image is moving upwards or downwards, and the area of the bitmap is always visible, I still know where my field bitmap regarding the point 0,0 of the screen.

If you see the atttached image, I want to know the position there of the bitmap that will be different in the two scenario illustrated in the image.

Kind regards
Charrier

I created the following code to discover something I did some time ago, in fact I think that I have found this code on the forum somewhere and modified to fit my needs.  Not sure it has never been used in a production application, so no warranty.  But may be useful.

    public static final XYRect getFieldExtent(Field fld) {
        int cy = fld.getContentTop();
        int cx = fld.getContentLeft();
        Manager m = fld.getManager();
        while (m != null) {
            cy += m.getContentTop() - m.getVerticalScroll();
            cx += m.getContentLeft() - m.getHorizontalScroll();
            if (m instanceof Screen)
                break;
            m = m.getManager();
        }
        return new XYRect(cx, cy, fld.getContentWidth(), fld.getContentHeight());
    }

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for