Subclass events and properties

I have an issue of logic I did not understand here and need some assistance.

A subclass is supposed to inherit the characteristics of the parent, right ?

  • I create a class with Super Rectangle “MyRectangle”
  • To that class I add an integer property “MyProperty”
  • To that class I add an event “MyEvent”

Then I drag a subclass onto a window, it makes “MyRectangle1”

I thought I was able to use MyRectangle1.MyProperty or MyRectangle1.MyEvent but I get “This item does not exist”.

Some brains, please…

Are you sure the scope of the property and event is public? If it is private or protected you won’t be able to access it.

Yes, the scope of the properties and events is Public.

I got it. Sometimes, it takes asking the question to find the answer. I was trying to use the properties and events from a timer, and forgot to mention the window, as in Window.MyRectangle1.MyProperty. I found back my children (and some of my marbles) :wink:

Within the window you address a control by:

Self.MyRectangle1.MyProperty

or

MyRectangle1.MyProperty

From outside of the window you need to prepend the control name with the window instance variable name:

Window1.MyRectangle1.MyProperty

Prepending the control name with Window doesn’t make much sense to me. Window is a property on the Control class and returns the parent of the control, usually the window.

Was Window1. Just forgot the 1.