Canvas1.Graphics help please

  1. last week

    Lennox J

    Feb 8 Jamaica. West Indies
    Edited last week

    Hello,

    I am using help from https://forum.xojo.com/51035-graphics

    I am trying to upgrade my project which works well in Xojo 2018 Release 2, I am now building it in Xojo 2018 Release 4 and am having some issues...

    In Xojo 2018 Release 2 Canvas1.MouseDown I have the following code
    app.gMousedownXD = X
    app.gMousedownyD = Y

    In Canvas1.MouseUp, I have
    app.gMousedownXU = X
    app.gMousedownYU = Y

    Canvas1.Graphics.ForeColor = &cFF0000
    Canvas1.Graphics.DrawOval ( app.gMousedownXD-3, app.gMousedownYD-3, app.gMousedownXU-app.gMousedownXD+6, app.gMousedownYU-app.gMousedownYD+6 )
    Canvas1.Graphics.DrawOval ( app.gMousedownXD, app.gMousedownYD, app.gMousedownXU-app.gMousedownXD, app.gMousedownYU-app.gMousedownYD )

    and that works well... the marquee is displayed.

    ***********************

    in Xojo 2018 Release 4 Canvas1.MouseDown I have the following code
    app.gMousedownXD = X
    app.gMousedownyD = Y

    In Canvas1.MouseUp, I have
    app.gMousedownXU = X
    app.gMousedownYU = Y

    MouseUp = true // MouseUp is a property
    Invalidate()

    In Canvas1.Paint I have
    if MouseUp = true Then
    g.ForeColor = &cFF0000
    g.DrawOval ( app.gMousedownXD-3, app.gMousedownYD-3, app.gMousedownXU-app.gMousedownXD+6, app.gMousedownYU-app.gMousedownYD+6 )
    g.DrawOval ( app.gMousedownXD, app.gMousedownYD, app.gMousedownXU-app.gMousedownXD, app.gMousedownYU-app.gMousedownYD )

    MouseUp = false

    else
    // Paint it in normal state
    end if

    When I do a Canvas1.MouseDown followed by a Canvas1.MouseUp at a different co-ordinate
    I do not see any marquee but in Xojo 2018 Release 2 the marquee is displayed.

    Any suggestions?

    Thanks.

    Lennox

  2. Julian S

    Feb 8 Pre-Release Testers, Xojo Pro UK

    Make sure you don't have any controls on top of your canvas that are set to transparent as this will cause an additional paint of Canvas which will render at the MouseUp = False state.

  3. Lennox J

    Feb 8 Jamaica. West Indies

    Hi Julian,

    I removed all controls from the window and it's a canvas only in a window now... No marquee displayed.

    Thanks.

    Lennox

  4. jim m

    Feb 8 Pre-Release Testers Phoenix, Arizona piDog.com

    Did you return true from MouseDown?

  5. Lennox J

    Feb 8 Jamaica. West Indies

    Thanks Julian,

    Working now.

    Thanks again.

    But If I wand a second marquee how do I do that?

    Thanks.

    Lennox

  6. Lennox J

    Feb 8 Jamaica. West Indies

    @jim m Did you return true from MouseDown?

    Yes I did Jim, and Julian's advice worked, but now I want a second and more marquees.

    Any advice?

    Thanks.

    Lennox

or Sign Up to reply!