Capture and Release of the Pointer
When an object gains focus, it also gains focus of the pointer. Once you gain focus of the
pointer you may wish to continue to receive events based on the pointer even if your
object no longer has focus. The following two functions allow you to accomplish this:
void CapturePointer(void);
void ReleasePointer(void);
These functions can be useful when dragging an object on the screen. You could, for
example, call CapturePointer() on pen down and ReleasePointer() on pen up of a
certain object. In this case, even if the pen leaves this object’s boundaries (and goes into
a different module window, for example) the pointer messages will continue to go to the
object. When the user lifts up the pen, the pointer will be released and the object will no
longer own the pointer. Be extremely careful that when you do capture the pointer that
you are certain to release it. Otherwise user input will be stuck on the object that
captured and didn’t release the pointer.
PEG Data Types
In section we will look at some important data types that are used in PEG and throughout
the ClassPad, but are not based on the PegThing.
Fundamental Data Types
The following simple data types are used by PEG instead of the intrinsic data types
defined by the compiler to avoid conflicts when running on CPUs with differing basic
word length and data manipulation capabilities. The comment next to each data type
describes the storage requirements PEG requires for each type:
typedef char CHAR // 8 bit signed
typedef unsigned char UCHAR // 8 bit unsigned
typedef short SIGNED // 16 bit signed
typedef unsigned short WORD // 16 bit unsigned
typedef int LONG // 32 bit signed
typedef unsigned int DWORD // 32 bit unsigned
PegPoint
PegPoint is a basic pixel address data type. The x,y position is always relative to the top-
left corner of the screen. PegPoint is defined as:
struct PegPoint
{
SIGNED x;
SIGNED y;
};
Note that PegPoint contains SIGNED data values. This means that it is perfectly normal
and acceptable during the operation of PEG for at least some portion of an object to have
18