Property (of a window class)
A window class setting that can be revealed and changed freely by the developer who uses that class.
A property has a TYPE, NAME, and INIT_VAL characteristics.
For each property named NAME, the class interface defines the following:
- a private data member (of type TYPE) to store the value, which is set to INIT_VAL when the window object is constructed
- a public revealer TYPE getNAME() or bool isNAME() (if TYPE is bool), which returns the current or latest value of the property, even if the window is closed (see MWindow::isOpen)
- a public mutator void setNAME(TYPE val), which changes the value of the property, updates the window if necessary (repaint, refresh, etc.), and generates a Notice message with "NAMEChanged" notice name (notice ID is determined by MWindow::setNoticeID, and is equal to None by default, so by default the notice is actually not generated at all - see MWindow::genNotice). That being said, if the window is closed, then the property mutator does nothing
The defining quality of the property is that it can only be changed programmatically by the users of the class, which defines the property - never by the class itself (except for the initialization during construction, of course) or by the external system. This gives the user of this class a full control over the property's value. Of course, the preceding condition may not hold for a derived class. For example, MScrollBar does change the CursorImage and DrawOrigin properties, defined in its base class MWindow, but it never changes its own properties, such as AutoHideSliders.
Some properties are inherited from the parent. For such property the initial value is set to getParent().isRTL() during construction of the window. Also, by default, changing this property for a given window changes it recursively to the same value in all descendants of this window, although this behavior can be overridden by overloading MWindow::OnNotice. Inheritability allows setting or changing a property for multiple windows by a single command, but beyond this convenience the concept of inheritability is not essential. The inheritability is not an intrinsic quality of a property, and is determined by the class itself. MWindow defines the following properties as inherited: MWindow::OS, MWindow::RTL, and MWindow::HighQuality.
- The property concept is needed to reduce the learning effort - instead of learning two different functions and their functionality, you only need to understand the property concept (as described here) once. Then, you only need to remember the property's name and type (remembering the init value is optional) to deduce the entire usage and the name of the generated notice without having to learn or to remember anything else
Let us know
Please Contact us to report any errors on this page, or to suggest any improvements.