Off Screen Canvas Transparency Issues

  1. last week
    Edited last week

    I have a small canvas that I move off screen on window.open and I move it to a location on the window for a function and then move it back off screen when that function is complete. I want the canvas to be semi-transparent but it loses it's transparency to show the controls underneath when it's position originates off the window. I have tried everything from refreshing the canvas manually with a button click (just to test that) and windows declares to change the window/control order. The only way I can achieve a transparent canvas is to place the canvas on the window using the IDE with it set to not visible and then show/hide the canvas in place instead. Any advice on what is causing this?

    @Geoff H I had tried refreshing the main window before, I just tried to invalidate the main window after moving the canvas in place but it's still not transparent. There is a canvas on the main window and this little canvas moves in and out on top of that one. I have tried a lot of combinations of those things.

    If I understand things correctly you want to re-parent the smaller canvas on the bigger one (you do not need to use declares to achieve this):
    SmallCanvas.Parent = BigCanvas
    SmallCanvas.Left = BigCanvas.Left + x
    SmallCanvas.Top = BigCanvas.Top + y

  2. Thomas T

    Jun 30 Testers, Xojo Pro Europe (Germany, Munich)
    Edited last week

    Behavior may be different on Windows vs. macOS, so please move the question to the appropriate sub forum, or at least state which OS you're using. A few weeks ago Xojo posted a video from their last conference where William explains how the transparency has changed lately on Windows - maybe that's affecting you.

    Also: http://www.angryflower.com/itsits.gif ;)

  3. @ThomasTempelmann Behavior may be different on Windows vs. macOS, so please move the question to the appropriate sub forum, or at least state which OS you're using.

    Also: http://www.angryflower.com/itsits.gif ;)

    Fair point. I'm on Windows but I would prefer to keep the question where it is.

  4. Markus R

    Jun 30 Testers, Xojo Pro Europe / Germany / Lower Saxon...

    have you tried self.invalidate for the whole window after moving your canvas?

  5. @Markus R have you tried self.invalidate for the whole window after moving your canvas?

    I had tried refreshing the main window before, I just tried to invalidate the main window after moving the canvas in place but it's still not transparent. There is a canvas on the main window and this little canvas moves in and out on top of that one. I have tried a lot of combinations of those things.

  6. Markus R

    Jun 30 Testers, Xojo Pro Europe / Germany / Lower Saxon...

    i can test tomorrow

  7. Markus R

    Jul 1 Testers, Xojo Pro Europe / Germany / Lower Saxon...
    Edited last week

    seems this transparent canvas need the canvas background as parent. in the ide it would show a red border.
    its ok if the transparent canvas is inside (and clipped) of the background canvas?

    as transparent paint i use this

    Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
      g.Transparency = 50
      g.DrawingColor = Color.Red
      g.FillRectangle 0,0,g.Width,g.Height
      
    End Sub

    the in and our moving just use .Left = xxx at button click

  8. Edited last week

    @Markus R seems this transparent canvas need the canvas background as parent. in the ide it would show a red border.
    its ok if the transparent canvas is inside (and clipped) of the background canvas?

    as transparent paint i use this

    Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
      g.Transparency = 50
      g.DrawingColor = Color.Red
      g.FillRectangle 0,0,g.Width,g.Height
      
    End Sub

    the in and our moving just use .Left = xxx at button click

    I tried changing the parent of the control using declares I assumed that was the issue but it didn't work. I have the canvas off screen at run time and just to make sure it's not visible on window.open I am assigning the the starting position of the small canvas using

    Canvas1.Left = Screen(0).Width*2

    As far as I know the only way to assign the parent using the IDE is to drag the small canvas on to the larger one that is contained within the window. This does indeed work and I have transparency. What I wanted to do was start the smaller canvas positioned off screen and then assign the parent when I move it on top of the other canvas. This doesn't work even when I use a windows declare to assign the parent and invalidate the window.

  9. Markus R

    Jul 1 Testers, Xojo Pro Europe / Germany / Lower Saxon...
    Edited last week

    @Geoff H

    off screen means not visible, so Canvas1.Left = -Canvas1.Width would hide it and Canvas1.Left = xxx show it

    stop using api with declares just drop this smaller one in the middle of the canvas background

    or do you will moving the small canvas from outer canvas background on to any place in the window?

    i not get your problem.

  10. @Markus R off screen means not visible, so Canvas1.Left = -Canvas1.Width would hide it and Canvas1.Left = xxx show it

    stop using api with declares just drop this smaller one in the middle of the canvas background

    or do you will moving the small canvas from outer canvas background on to any place in the window?

    I appreciate your help but I don't think you understand what I am trying to accomplish. I know how to position controls and I realize, as I stated in my last post, that I know it will work if I use the IDE to assign the parent to the smaller canvas. Thanks again.

  11. Markus R

    Jul 1 Testers, Xojo Pro Europe / Germany / Lower Saxon...
    Edited last week

    yes i not get your problem.
    i guess you will move this transparent canvas free in the whole window?

  12. William Y

    Jul 1 Xojo Inc Answer

    @Geoff H I had tried refreshing the main window before, I just tried to invalidate the main window after moving the canvas in place but it's still not transparent. There is a canvas on the main window and this little canvas moves in and out on top of that one. I have tried a lot of combinations of those things.

    If I understand things correctly you want to re-parent the smaller canvas on the bigger one (you do not need to use declares to achieve this):
    SmallCanvas.Parent = BigCanvas
    SmallCanvas.Left = BigCanvas.Left + x
    SmallCanvas.Top = BigCanvas.Top + y

  13. @William Y If I understand things correctly you want to re-parent the smaller canvas on the bigger one (you do not need to use declares to achieve this):
    SmallCanvas.Parent = BigCanvas
    SmallCanvas.Left = BigCanvas.Left + x
    SmallCanvas.Top = BigCanvas.Top + y

    Strange setting the parent with declares didn't work but setting the parent this way does. Maybe I wasn't getting the correct handle back for the control? Anyway, setting the control parent this way does the trick. Thanks.

or Sign Up to reply!