TBApiScaleCoordinates API Call

 

Description

Given a _PointerData structure with co-ordinate data, modifies the co-ordinates to fit in the rectangle specified in TBApiSetScaleDimensions. Typically used to map pointer co-ordinates to a window size.

Parameters

Scale handle, data and storage for X and Y co-ords.

Returns

0 = fail, 1 = OK.

Notes

None.

 

Visual C++ Declaration/example

 

BOOL TBAPI TBApiScaleCoordinates(long* handle, _PointerData* data, unsigned short* x,unsigned short* y);

 

//

// At window creation

//

long scaleHandle = -1;

TBApiSetScaleDimensions(&scaleHandle,l,t,r,b); // where l,t,r,b represent the window initial co-ordinates

//

// Whenever window is moved or resized

//

TBApiSetScaleDimensions(&scaleHandle,l,t,r,b); // where l,t,r,b represent the new window co-ordinates

//

// In data callback

// 

unsigned short x,y;

TBApiScaleCoordinates(scaleHandle,data,&x,&y); // x,y now hold the co-ordinate values from data mapped to the target area

 

Visual Basic Declaration/example

 

Public Declare Function TBApiScaleCoordinates Lib "TBapi" Alias "_DLL_TBApiScaleCoordinates@16" (ByVal handle As Long, ByVal data As Long, ByVal x As Long, ByVal y As Long) As Long

 

' At window creation

Dim scaleHandle As Long

scaleHandle = -1

Dim addrScaleHandle As Long

addrScaleHandle = VarPtr(scaleHandle)

 

TBApiSetScaleDimensions addrScaleHandle, l, t, r, b ' where l,t,r,b represent the window initial co-ordinates

 

' Whenever window is moved or resized

TBApiSetScaleDimensions addrScaleHandle, l, t, r, b ' where l,t,r,b represent the new window co-ordinates

 

' In data callback

Dim x, y As Long

Dim addrx, addry, addrdata As Long

addrx = VarPtr(x)

addry = VarPtr(y)

TBApiScaleCoordinates addrScaleHandle, data, addrx, addry ' x,y now hold the co-ordinate values from data mapped to the target area