This section shows how to define and use tags.
/* Initialize CleO */
/* Start drawing the screen shot */
CleO.StringExt(FONT_MEDIUM, 160, 50, LIGHT_GREEN, MM, 0, 0, "TOUCH OBJECTS");
CleO.Line(105, 125, 225, 125);
CleO.StringExt(FONT_MEDIUM, 160, 200, LIGHT_GREEN, MM, 0, 0,
CleO.StringExt(FONT_MEDIUM, 160, 400, LIGHT_GREEN, MM, 0, 0,
/* Show the screenshot */
int16_t x, y, dur, tag, newval;
CleO.TouchCoordinates(x, y, dur, tag);
if (tag == 1)
lineTouched = true;
else if (tag == 2)
pointTouched = true;
pointTouched = lineTouched = false;
Using the Tag(int tag_no) routine, you can draw the CleO primitives which get assigned a tag.
This tag is used to identify touch on drawing.
The display() function draws a line with tag 1 and point with tag 2.
It checks whether these drawings are touched and if so, it creates an effect of a button press.
The control() routine checks for touch using the TouchCoordinates() command and fills up the tag value based on which drawing was touched.
It checks the tag value and updates the boolean to notify which drawing was affected.
Note: A tag is applicable on all the objects after which it is used. In this case, the object point (160,300) starts with tag 2 and ends with END tag 255.
Here is the output displayed upon executing the code snippet -