Subclass oval

Hello,

I created a class ‘CustomOval’ and set its super to oval.
On a pushbutton’s action event (on window1) I set:

dim t as oval = new CustomOval
t.Width=50
t.Height=50
t.top=50
t.Left=50
t.fillcolor=rgb(50,100,50)

why is this not shown on window1?

Unfortunately you cannot add controls at runtime unless you’ve already setup a ControlSet for them or you use a ContainerControl. I would go with the latter. Create a new ContainerControl object in the navigator (left-hand pane of the IDE), add an oval to it, and create whatever methods and properties you wish to expose. Now, in your window, you can do something like this:

var newOval as new MyOvalContainer
newOval.EmbedWithin( Self, 50, 50, 50, 50 )
2 Likes

oh, that was fast, thank you!

1 Like

Happy to help!