You can test whether the drag position is within a given rectangle like this:
if min (pos > 1,2),(pos < 10,20)
alert["You clicked in the rectangle!"]
end
pos is an two-item list representing the X and Y coordinates of the pointer when the event happened. If we pretend there are separate x and y variables representing the individual coordinates, then pos > 1,2 is a shorter way to say (x > 1),(y > 2) - that is, you get a new two-element list where each item is 1 if the corresponding coordinate matches. In the same way, pos < 10,20 is like (x < 10),(y < 20). Put them together with “,” and you get a four element list where each item is 1 if the coordinate is inside that edge of the rectangle. min takes that four-element list and returns the minimum value: if any element is 0, it returns zero; it only returns 1 if every element is 1. That is, it only returns 1 if the point is completely within the rectangle.
It’s also possible to check the pattern in the canvas at a point, like so:
if me[pos] = colors.red
alert["You clicked a red pixel"]
end
(where me inside a widget’s script refers to that widget, whatever its actual name is)
Does that help?