Zitat von Graeme Geldenhuys <graemeg.li...@gmail.com>: > Hi, > > Something weird I just noticed. I have not tested this under Delphi 7, > but I have tested it with Lazarus GTK1 and GTK2 widget set. See > attached image to help explain > > If I do Panel1.Enabled = False, all components are disabled > (visually). This is what I expected. But if I now query > Edit1.Enabled, it returns True. Also if I query CheckBox2.Enabled it > also returns True. Is this a bug? > > For some reason I expected all child components to be Enabled = False, > because that's what they are. Once Panel1 is disabled, I cannot set > focus or interact with any child components. They are even painted in > disabled state. How do I pragmatically detect if a component is > "really" enabled or disabled? Seems that the logical way of quering > the component's Enabled property gives false information.
Most LCL properties are relative. Left is relative to Parent, Visible hides all childs too, etc. As Michael said: Use CanFocus, which uses IsControlVisible and parent enabled. Use IsControlVisible to check whether a control is visible on the form. It checks parents and things like multi pages. It does not check whether the control is clipped. There are almost always exceptions to the rules. It depends on what you want to achieve. Where is a good place to document this? Mattias _______________________________________________ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus