Mousedrag

I have an array of rectangles (days of month) next to each other. I want the user to be able to drag with the mouse down over the array and select (fillcolor) the boxes that are touched.

Unfortunately, I can’t make that happen. I’ve put ‘Return True’ in the mouse down event but mousedrag fires only for the first rectangle the cursor is on, not the next (rectangles ara a control set). Anybody?

You might have to handle this at the parent level (window?). Another solution would be to draw all of your rectangles in a single canvas.

@Alexander van der Linden — The easiest way would certainly be to add an empty Canvas on top of all the rectangles and handle all the mouse events from it.

An easier way would be a SINGLE canvas, and do the drawing directly on it… Overlaying controls is a recipe for disaster

or…
No canvas at all.
This all works fine straight onto a window.

The words and letters are .drawstring
The boxes are .fillrect
You know which boxes are being passed over based on
( Y co-ordinate minus top of first row) / (Row height including the space)
and
( X co-ordinate minus left of leftmost square) / ( width of square plus space)

AFAIK under Windows with the latest versions of Xojo, the canvas is no longer transparent.

Better place it simply under the rectangles.