[Lazarus] Design time and runtime positions differ

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Apr 1 15:32:16 CEST 2015


On Wed, 01 Apr 2015 13:11:08 +0100
Graeme Geldenhuys <mailinglists at geldenhuys.co.uk> wrote:

> Hi,
> 
> I have a form that is not resizeable at runtime. During design time I
> position 4 Panels at the bottom of the form to fake a statusbar (to
> replace the broken StatusBar of LCL).
> 
> Yet when I run the program the panels are in a slightly higher position
> than what they were at design time. Resizing the form even by just 1px
> magically makes the panel position correctly.

Fixed.

Well, not 100% fixed. At the initialization the gtk2 interface returns
the wrong ClientRect for TPanel and later sends a WMSize message with
the correct values. The LCL thought it had already the correct
values.
I fixed the later.
The wrong gtk2 values causes unneeded resizes. That still needs to be
fixed.

Mattias


> 
> The problem is, in my actual application, the main form is not resizeable.
> 
> 1.  So how can I tell LCL to correctly position my panels at runtime,
>     as if I resized the form (but without actually resizing the form).
> 
> 2.  Why did LCL decide to move the panels in the first place?
> 
> 
> See the attached screenshots to show what I mean.
> 
> Here is the LFM code for the "fake statusbar"
> 
> ===============================================
>   object FakeStatusBar: TPanel
>     Left = 0
>     Height = 25
>     Top = 296
>     Width = 639
>     Align = alBottom
>     BevelOuter = bvNone
>     ClientHeight = 25
>     ClientWidth = 639
>     TabOrder = 0
>     object Panel1: TPanel
>       Left = 2
>       Height = 25
>       Top = 0
>       Width = 169
>       Anchors = [akLeft, akBottom]
>       BevelOuter = bvLowered
>       Caption = 'Panel1'
>       TabOrder = 0
>     end
>     object Panel2: TPanel
>       AnchorSideLeft.Control = Panel1
>       AnchorSideLeft.Side = asrBottom
>       AnchorSideRight.Control = Panel3
>       Left = 173
>       Height = 25
>       Top = 0
>       Width = 292
>       Anchors = [akLeft, akRight, akBottom]
>       BorderSpacing.Around = 2
>       BevelOuter = bvLowered
>       Caption = 'Panel2'
>       TabOrder = 1
>     end
>     object Panel3: TPanel
>       Left = 467
>       Height = 25
>       Top = 0
>       Width = 170
>       Anchors = [akRight, akBottom]
>       BevelOuter = bvLowered
>       Caption = 'Panel3'
>       TabOrder = 2
>     end
>   end
> ===============================================
> 
> 
> I'm using Lazarus 1.3 r45395 FPC 2.6.4 x86_64-linux-gtk 2.
> 
> 
> Regards,
>   - Graeme -
> 




More information about the Lazarus mailing list