Mousedrag

  1. 3 months ago

    Alexander v

    Feb 19 Europe (Houten, The Netherland...
    Edited 3 months ago

    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?

    -image-

  2. Kevin G

    Feb 19 Pre-Release Testers, Xojo Pro Gatesheed, England

    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.

  3. @Alexander vnbsp;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.

  4. Dave S

    Feb 20 San Diego, California USA

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

  5. Jeff T

    Feb 20 Pre-Release Testers Midlands of England, Europe

    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)

  6. Michel B

    Feb 20 Pre-Release Testers RubberViews.com

    @Stéphane ;Mons @Alexander vnbsp;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.

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

    Better place it simply under the rectangles.

or Sign Up to reply!