[Lazarus] Strange behaviour of TCustomEditButton ancesters

Martin Frb lazarus at mfriebe.de
Sat Mar 12 20:59:20 CET 2016

On 12/03/2016 19:38, Frans wrote:
> Hi
> I use TFileNameEdit (but TDirectoryEdit acts the same) on the second 
> tabsheet of a PageControl where it's the first control to receive 
> focus. I set the focus manually in the method form.tabshow for the 
> event OnShow.
> The first time I activate that tab, SetFocus has the effect as shown 
> in FirstTime.png. When I select the tab another time, the effect is 
> normal, as shown in Second time.png.
> Is can't find out why. Is this a bug? I use Lazarus 1.6 and FCP 3.0.0.

I dont have the "how to fix", but it looks like the first time you call 
SetFocus is before the tab got created, (or at least before it gets its 
true size). At that time the tab will have a dummy size (maybe 200 pixel 
The SetFocus may or may not create those handles, but the size is likely 
not yet set. So the content of the edit is "scrolled".

It could also be, that it is created, but the autosize lock is still on, 
deferring the initial resize.

More information about the Lazarus mailing list