Who knows why?

A window is an object. A control (e.g. button) also is an object.

To a window I can add properties and methods. If I wanted to do the same with a control, it is only possible only by subclassing the control.

But why does Xojo handle this in different ways - I thought that objects are objects?

Hank

Your Window1, Window2, Window… is a subclass of Window.

Also, I believe that Window “classes” are actually represented internally as Modules rather than Classes which explains some of their quirks.

According to this my button1, button2, button … should be a subclass of button …

But they’re not.

[quote=33749:@Hank Sinclair]According to this my button1, button2, button … should be a subclass of button …

But they’re not.[/quote]
No, that’s not what it means.

Window1 is a subclass of Window. It has properties such as PushButton1 which is an instance of PushButton. Literally, the controls are properties on the Window.

“Only the Shadow Knows…”

[quote=33749:@Hank Sinclair]According to this my button1, button2, button … should be a subclass of button …
But they’re not.[/quote]
I think the misunderstanding is that when you create a Window in the IDE it is expected that you will want to do something different with it in as much as it is not going to be an empty Window, you will want to add controls such as pushbuttons, text, labels, etc. (as Thom explains, the controls are new properties that do not exist in the superclass of your Window). So the assumption is that you need a subclass and that Is what you get.

When you add your controls to your (subclassed) Window the assumption is that they are instances of a (base) class, i.e. they are going to be objects of PushButton for example. If you need a subclass of PushButton etc. to do something different from a base PushButton then you will have to create that yourself outside of the Window and then use it in your Window.

HTH

Ok, seems logical from that point of view.

But I’d prefer solutions that don’t assume too much. Thank you for your explanations.