Getting canvas instances to appear

I have a rectangle and a button in a window, and the button’s Action event creates instances of my own button class (based on a canvas) which I want to line up as a row in the long, thin rectangle. I can’t pre-create these in the layout in the IDE as their number depends on user actions.

But although these buttons are created, they remain invisible. I find that although I set the parent to the rectangle, in the debugger the buttons’ parent stays stubbornly at Nil. I also see that their Window property is Nil, too. They have a width and a height and are not invisible or transparent.

How do I make these appear? Or do I have to have a specimen of my button in the rectangle in the IDE, and then clone it? I’m trying to avoid Control Sets.

Could you not use one canvas and display multiple buttons in the canvas?

Otherwise have you considered container controls as these can by dynamically created and embedded but are not control sets (or could be).

I think I’ll be trying this next. :wink:

And some rapid prototyping combined with the extremey usefule remote debugging facility shows that this is the way to go.

As this works in Linux too, it also gives me a workaround for <https://xojo.com/issue/58734>.

I ran into exactly this kind of issue recently, with canvas controls that SHOULD have been children of a containercontrol.

The index(0) of the control set was a child of the container. I clone it, display at x,y co-ords…
And see utterly nothing, as you report

So I recently had to refactor my kinda-toolbar thing so that the index(0) control that I cloned, started life as a child of the window itself.
Subsequent clones worked perfectly.
I just had to lose methods and properties of the containercontrol, and promote them to properties and methods of the window.
Which obviously made the whole kinda-toolbar thing much less re-usable, but hey. job done now.