Help Contents / GUI programming / Window H-N / WindowInheritAttributes

WindowInheritAttributes window

This function is (or should be, in case of custom controls)  called during window creation  to intelligently set up the window visual attributes,  that is the font and the foreground and background colors. 

By "intelligently'' the following is meant:  by default, all windows use their own default attributes.  However if some of the parents attributes are explicitly  (that is, using SetFont and not SetOwnFont) changed  and if the corresponding attribute  hadn't been explicitly set for this window itself,  then this window takes the same value as used by the parent.  In addition, if the window overrides ShouldInheritColors to return false,  the colors will not be changed no matter what and only the font might. 

This rather complicated logic is necessary  in order to accommodate the different usage scenarios.  The most common one is when all default attributes are used  and in this case, nothing should be inherited  as in modern GUIs different controls  use different fonts (and colors) than their siblings  so they can't inherit the same value from the parent.  However it was also deemed desirable to allow  to simply change the attributes of all children at once  by just changing the font or color of their common parent,  hence in this case we do inherit the parents attributes. 


previous: WindowHide	next: WindowInitDialog
