Details: I'm working on a BlackBerry app, and one of the features is signature capture. For that I am using the sample code given here.

I am facing one small problem.

My application's screen consists of a header, 2 labels and SignatureField in a VerticalManager.

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 relative to field because of that touch and drawing is not in sync.

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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top