views:

29

answers:

1

Details: I'm working on a BlackBerry app, and one of the feature is signature capture for that i am using the sample code giving here.

i am facing one small problem.

my application's screen consits

header, 2 labels and SignatureField in vertical manager.

message.getMovePoints(1, xPoints, yPoints, null);

is giving absolute points (relative to screen)

and

_graphics.drawPathOutline(xPoints,yPoints, null, null, false);

is drawing a path realative to field because of that touch and drawing is not in sync.

question: is there any way to get relative points from message.getMovePoints(1, xPoints, yPoints, null); this method. or is there any other way to solve this problem?

+1  A: 

You should be able to put a few functions together that translates the coordinates to the Fields offsets:

int YourClass#translateToFieldX(Field theField, int x);
int YourClass#translateToFieldY(Field theField, int y);

Or you could make a function that takes the entire array and returns a new array of translated points. That's up to you.

The functions that you'll be interested in for the implementation of these functions are:

Field#getLeft() and Field#getContentLeft()
Field#getTop() and Field#getContentTop()

Hope this helps.

Fostah