[Lazarus] WinControl.CanFocus
Martin Frb
lazarus at mfriebe.de
Mon Jun 8 18:47:49 CEST 2015
On 08/06/2015 14:42, Juha Manninen wrote:
> Regarding issue:
> http://bugs.freepascal.org/view.php?id=21708
>
> I would like to fix the bug as proposed by Zoran Vučenović and Ondrej Pokorny.
> Opinions?
>
> The current behavior is compatible with Delphi. However it conflicts
> with even Embarcadero's own documentation which means it clearly is a
> bug in Delphi.
> We should not replicate Delphi's bugs IMO.
>
> The changed behavior would affect existing code, at least in theory.
> In practice the CanFocus method is useless, no code can use it for its
> intended purpose. Thus the implication would be very small.
>
There is a valid use case
if HiddenForm.EditFoo.CanFocus then
HiddenForm.ActiveControl := HiddenForm.EditFoo;
HiddenForm.Show;
This currently works, because of the visibility of the form is not checked.
(same applies for a form with Enabled := False)
If code prefers setting ActiveControl over calling SetFocus, then the
current behaviour makes sense.
More information about the Lazarus
mailing list