The way that CurveyControls implement the Enabled property does not work well with the objected oriented nature of VCL. CurveyControls implement their own methods, such as GetEnabledEx and SetEnabledEx, rather than overriding the methods of GetEnabled and SetEnabled.
The result is that code such as TWinControl.CanFocus doesn't work with CurveyControls. This method declares
Control: TWinControl;
When Control.Enabled is called, TWinControl knows nothing about the CurveyControl's GetEnabledEx, and thus TControl.Enabled is called. The actual CurveyControl is enabled even when the underlying FCombo/FEdit/etc is disabled. TControl.Enabled returns True, so CurveyControl.CanFocus returns true. But CurveyControl.SetFocus throws an exception because the underlying control is disabled.
Changing CurveyControl components to properly override GetEnabled/SetEnabled solves this and took me 30 seconds to do. Rename GetEnabledEx to GetEnabled and add override modifier. Rename SetEnabledEx to SetEnabled and add override modifier. Additionally, remove const on the Value parameter, to get the method to match TControl.SetEnabled. (I agree const is ideal, but VCL consistency is more important to me.)
Now when TWinControl.CanFocus calls Control.Enabled, CurveyControl.GetEnabled is called, which returns the Enabled state of the underlying control. Now CanFocus correctly returns False when I've disabled a CurveyControl.
I've checked 1.1.0.0 of CurveyControl and it still has this behavior. I have a modified version of 1.0.1.0 that solves the issue with CanFocus. Let me know if you want it.
This 'solution' will cause other problems.
We've applied a different solution to make CanFocus work as expected and this will be included in the next update.
Would you please let me know what problems my solution will cause?
Thanks
I do remember problems reported by some customers in very specific circumstances with this solution we initially came with ourselves but I cannot remember the exact details at this time.