# Runtime issues

## Problems getting setHandwritingDisplayArea/writeImageArea to work

The most important task is to define correctly the co-ordinates of the rectangle which is passed as a parameter to the above methods.

In particular it should be noted that the rectangle co-ordinates are numbered from zero upwards, so the top-left corner has co-ordinate values of 0,0.

Mistakes can be made by calculating the right-hand side co-ordinates of the rectangle by using the tablet width and height values.

For example, the property *ICapability.screenWidth* would yield a result of 800 on a 530 or 540 pad, but using this to specify the right-hand co-ordinates of the rectangle will fail.

This is because the x co-ordinate of the right-most pixel on the 530 or 540 is 799, not 800.

Similarly the lower-right y co-ordinate of the 530 or 540 is not 480 but 479.

Therefore beware of statements such as:

```
rect.LowerRightXPixel = rect.upperLeftXPixel + capability.screenWidth
```

This should be:

```
rect.LowerRightXPixel = rect.upperLeftXPixel + capability.screenWidth - 1
```

Please note that passing an invalid rectangle to **setHandwritingDisplayArea()** will not yield an error - the command will simply fail and the display area will not be changed from its current value.

**writeImageArea()** on the other hand will raise an exception if invalid co-ordinate values are passed to it.

**N.B.** Recent investigations have found that using **setHandwritingDisplayArea()** with C# and an STU-430 will generate an error if invalid pixel positions are used.

This does not happen however with an STU-530 or with JavaScript.

Please also note that **setHandwritingDisplayArea()** and **writeImageArea()** are not available on older pads such as the 300, 500 and 520.