Possible issue with DesktopCanvas?

Hi,

Maybe an issue, hoping someone can shed some light…

Using:

Var thisCanvas As Canvas
thisCanvas = New Canvas1
thisCanvas.Left = xPos
thisCanvas.Top = yPos

works OK, I can clone and the copies display where I want them

However,

Var thisCanvas As DesktopCanvas
thisCanvas = New Canvas1
thisCanvas.Left = xPos
thisCanvas.Top = yPos

… and nothing appears.

Anyone else come across this?

Cheers,
Dave.

Shouldnt NEED to do this (pointless renaming of controls aside), but:

try

thisCanvas = DesktopCanvas(New Canvas1)

casting it to the new naming style

If that doesnt help, check if the new canvas1 object has the same parent as the original

1 Like

Hi Jeff, didn’t work for me. There’s definitely some issue with DesktopCanvas. I converted the subclass back to Canvas and that worked as expected. Didn’t want to waste too much time on finding a fix for this really, but did want to bring it to folks’ attention. Cheers and have a great day. Dave.

What is canvas1? I don’t see it defined here.

If canvas1 is a subclass of canvas, you better make it a subclass of DesktopCanvas instead.

2 Likes

I’m not at my computer at the moment, breakpoint after the code above and check the properties to ensure they are all set correctly.

I’m wondering if you would be better off using a control stet rather than just cloning a control. Maybe you should read these topics: https://blog.xojo.com/tag/control-set/

https://blog.xojo.com/2022/01/21/simplified-adding-user-interface-controls-at-runtime/

2 Likes