Sign in Join

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

Mailing lists / lazarus / 2015-04

Design time and runtime positions differ

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi,

I have a form that is not 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.

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 -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -------------- next part -------------- A non-text attachment was scrubbed... Name: 001_design.png Type: image/png Size: 1842 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150401/2a6d633b/attachment.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: 002_runtime.png Type: image/png Size: 1594 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150401/2a6d633b/attachment-0001.png> -------------- next part -------------- A non-text attachment was scrubbed... Name: 003_resized.png Type: image/png Size: 1630 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150401/2a6d633b/attachment-0002.png>

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote
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).

I tried calling self.Realign; and self.Update; in the form's OnShow event handler, but that did nothing to solve the problem.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: I have a form that is not design time I position 4 Panels at the bottom of the form to…
Show quoted text 9 lines
Hi, I have a form that is not 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

Show quoted text 68 lines
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 -

Reply by email

Graeme Geldenhuys
to Mattias Gaertner
Mattias Gaertner wrote
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.

Thanks Mattias - much appreciated.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email