Canvas1.Graphics help please

  1. ‹ Older
  2. 8 months ago

    Emile S

    21 Feb 2019 Europe (France, Strasbourg)

    @Lennox J Canvas1.Graphics

    This is exactly where your trouble comes from.

    Adding Window1. as a prefix does change nothing to the matter (workse, read: https://blog.xojo.com/2019/02/14/me-vs-self/ ).

    In your project, using in the MouseUp Event:
    Window1.Canvas1.Graphics. is the source of the evil.

    At last: Window1.Canvas1.Graphics.DrawOval does not exists. I saw that at compile time.

  3. Lennox J

    21 Feb 2019 Jamaica. West Indies

    I sent a post with what I did but I am not seeing it so I will send it again...

    In MouseUP I have...
    app.gMousedownXU = X
    app.gMousedownYU = Y

    MouseUp = true
    Invalidate()

    and in 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)

    else
    end if
    MouseUp = false

    In Xojo 2018 Release 4, I can do single marquees, but when I try multiple marquees, the last one is displayed but the previous one is erased.

    Thanks.

    Lennox

  4. Lennox J

    21 Feb 2019 Jamaica. West Indies
    Edited 8 months ago

    Hi Emile,

    I don't have
    Window1.Canvas1.Graphics

    I have this...
    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 in Xojo 2018 Release 2.

    This is what I have now

    In MouseUP I have...
    app.gMousedownXU = X
    app.gMousedownYU = Y

    MouseUp = true
    Invalidate()

    and in 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)

    else
    end if

    The project that works in Xojo 2018 Release 2 has been uploaded here... https://www.mediafire.com/file/4ngk8i7ha8aq2al/Multiple_Graphic_Marquee_2019_Feb_10%27.xojo_binary_project/file

    Thanks.

    Lennox
    MouseUp = false

  5. Emile S

    21 Feb 2019 Europe (France, Strasbourg)

    Hi Lennox,
    [I was talking about that example]

    the shared project does not compile with Xojo 2018r4.

    for example:

    Sub MouseUp(X As Integer, Y As Integer) Handles MouseUp
      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 )
      
    End Sub

    You have to note the name of the event is MouseUp and you use Canvas1.Graphics in the 3 offended lines (these lines do not compile).

  6. Lennox J

    21 Feb 2019 Jamaica. West Indies

    Yes Emile, I know that, it compiles and works in Xojo 2018r2 but not in Xojo 2018r4.

    I have changed that to

    In MouseUP I have...
    app.gMousedownXU = X
    app.gMousedownYU = Y

    MouseUp = true
    Invalidate()

    and in 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)

    else
    end if

    That compiles in Xojo 2018r4 but I can only get one marquee...
    In Xojo 2018 Release 4, I can do single marquees, but when I try multiple marquees, the last one is displayed but the previous one is erased.

    Thanks.

    Lennox

  7. Emile S

    21 Feb 2019 Europe (France, Strasbourg)
    Edited 8 months ago

    Isn’t it because you paint it in the Paint Event ?
    (it disappears at the first refresh / Refresh happens when you Paint something in the Paint Event).

    What about a Picture property (in App or Window) and Paint there ?
    Doing so make no Paint disappearance(s).
    Doing so will make the errors in Xojo 2018r4 to disappears.

    Edit:
    I trashed Xojo 2108r2 (as soon as r3 appears and do the same as soon as r4 appears).

    I added to your project a Property, changed some bits in Paint, some others in mouseUp and I was able to compile/run the project.
    But no marquee at all.

    Now I have to go home.

  8. Lennox J

    21 Feb 2019 Jamaica. West Indies

    Thanks for the info Emile, trust that someone would assist.

    Thanks again.

    Lennox

  9. Julian S

    21 Feb 2019 Pre-Release Testers, Xojo Pro Answer UK

    Here you go Lennox, not my best work as it was a bit quick, you'll need to put in some error checking etc.

    https://www.dropbox.com/s/2qlyc0ntkur8c5b/TestDropOval.xojo_binary_project?dl=1

  10. Lennox J

    21 Feb 2019 Jamaica. West Indies

    Thanks Julian,

    I can see the multiple marquees now, so I will have to implement that into my original project.

    Thanks again.

    Lennox

  11. Lennox J

    21 Feb 2019 Jamaica. West Indies

    Thanks Julian,

    Got it going the way I want.

    Thanks again.

    Lennox

or Sign Up to reply!