int ViewSetTouch(int vw, int tc);

 

Assign the Touch that is associated with a View.

 

Return Value

 

Return value is not used.

 

Parameters

 

vw

View handle returned from ViewAdd().

 

tc

Touch handle returned from TouchAdd().

 

Remarks

 

The ViewSetTouch() function assigns a Touch to be associated with a view area.

 

Availability

 

Available in DragonFireSDK 1.0 and later.

 

Example

 

Description: This example will set up a view and a Touch area and assign the touch area to the View.

 

#include "DragonFireSDK.h"

 

int OnTouchArea(int id, int event, int x, int y);

 

void AppMain()

{

  int ViewHandle;

  int TouchHandle;

 

  ViewHandle = ViewAdd("Ball.png", 0, 0);

  TouchHandle = TouchAdd(0, 0, 100, 100, OnTouchArea, 0);

  ViewSetTouch(ViewHandle, TouchHandle);  

}

 

int OnTouchArea(int id, int event, int x, int y)     //event: 1=down, 2=move, 3=up

{

  if (event == 3)

  {   // touch up (touched and released)

      //...do something

     printf("You touched the touch area\n");

    return 0;

  }

}

 

void AppExit()

{

 

}

 

void OnTimer()

{

 

}