Re: [Lazarus] How to query Enabled/Disabled component state?
Mattias Gärtner wrote: Where is a good place to document this? Maybe as a note (or link) with the Enabled property, as probably more people expect the behaviour like Graeme did. Micha ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] How to query Enabled/Disabled component state?
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. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ attachment: sample.png___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] How to query Enabled/Disabled component state?
On Tue, 10 Feb 2009, Graeme Geldenhuys wrote: 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. No, it gives the correct information. You should use CanFocus for what you need. Michael. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] How to query Enabled/Disabled component state?
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