Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-03

Strange behaviour of TCustomEditButton ancesters

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frans

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.

mvg Frans van Leeuwen M 06-51695390 -------------- next part -------------- A non-text attachment was scrubbed... Name: First time.png Type: image/png Size: 7547 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160312/0d318a67/attachment.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: Second time.png Type: image/png Size: 8206 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160312/0d318a67/attachment-0001.png>

Reply by email

Martin Frb
to Frans
Frans wrote 10 lines
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 width).
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.

Reply by email

Frans
to Martin Frb

I do understand what you mean, but I do not think that is th case. I send my test program, it's very simple.

mvg
Frans van Leeuwen
M 06-51695390

Op 12-03-2016 om 20:59 schreef Martin Frb:

Show quoted text 25 lines
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 width). 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. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FileNameEdit.zip
Type: application/x-zip-compressed
Size: 2354 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160312/c7a75d43/attachment-0001.bin>

Reply by email

Martin Frb
to Frans
Frans wrote
I do understand what you mean, but I do not think that is th case. I send my test program, it's very simple.

Did a quick test.
When first time hit TForm1.TabSheet2Show
FileNameEdit1.FEDIT.FBOUNDSREALIZED : record RECT { LEFT = 0, TOP = 0, RIGHT = 80, BOTTOM = 23 }
TabSheet2.FAUTOSIZINGLOCKCOUNT : 1

The Tab has the correct Size (and it has a handle too), the edit does not yet have the final size.

The 2nd time
FileNameEdit1.FEDIT.FBOUNDSREALIZED : record RECT { LEFT = 0, TOP = 0, RIGHT = 406, BOTTOM = 21 }

This is because sizes (such as in result of anchors, align, ...) are only applied when it makes sense (not sure, parent visible, handle created, ....). In fact they probably need a handle, for the proper clientrect. And the tab-page only gets a handle when first shown.

I dont know at which time AUTOSIZINGLOCKCOUNT is set (this avoids doing the resize multiple times). Maybe it should be cleared by the time of the event. But it is not.

Show quoted text 12 lines
Op 12-03-2016 om 20:59 schreef Martin Frb: > > 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 width). > 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.

Reply by email