Search code examples
delphiscaleframefiremonkey

Firemonkey TFrame Align = Scale Bug?


I have a doubt. I have created a Frame in firemonkey and added 2 buttons, then inside MainForm I added this Frame.

Frame.Align = Scale

In the MainForm the Object Frame.Align = Client

When I compile and resize the Form, the Frame does not scale.

Is this a normal question or a bug?

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 481
  ClientWidth = 627
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  inline Frame21: TFrame2
    Align = Scale
    Position.Y = -3.000000000000000000
    Size.Width = 887.000000000000000000
    Size.Height = 653.000000000000000000
    Size.PlatformDefault = False
  end
end

object Frame2: TFrame2
  Align = Scale
  Size.Width = 526.000000000000000000
  Size.Height = 395.000000000000000000
  Size.PlatformDefault = False
  object Button1: TButton
    Position.X = 80.000000000000000000
    Position.Y = 40.000000000000000000
    TabOrder = 0
    Text = 'Button1'
  end
  object Button2: TButton
    Position.X = 144.000000000000000000
    Position.Y = 144.000000000000000000
    TabOrder = 1
    Text = 'Button2'
  end
  object Button3: TButton
    Position.X = 240.000000000000000000
    Position.Y = 256.000000000000000000
    TabOrder = 2
    Text = 'Button3'
  end
end

Solution

  • No, there is no bug with Align = Scale in a frame. You seem to have only the frame itself aligned with Scale.

    If you want the components on the frame also to scale, you need to assign their Align property as well.

    Here's my form

    object Form22: TForm22
      Left = 0
      Top = 0
      Caption = 'Form22'
      ClientHeight = 200
      ClientWidth = 350
      FormFactor.Width = 320
      FormFactor.Height = 480
      FormFactor.Devices = [Desktop]
      DesignerMasterStyle = 0
      inline Frame221: TFrame22
        Align = Scale
        Position.X = 16.000000000000000000
        Position.Y = 14.000000000000000000
        Size.Width = 320.000000000000000000
        Size.Height = 171.000000000000000000
        Size.PlatformDefault = False
        TabOrder = 1
        inherited Label1: TLabel
          Position.X = 16.000000000000000000
          Position.Y = 24.000000000000000000
        end
        inherited Button1: TButton
          Position.Y = 48.857139587402340000
          Size.Height = 19.193893432617190000
          Size.PlatformDefault = False
        end
        inherited Button2: TButton
          Position.Y = 48.857139587402340000
          Size.Height = 19.193893432617190000
          Size.PlatformDefault = False
        end
        inherited Rectangle1: TRectangle
          Position.Y = 76.775512695312500000
          Size.Height = 77.647918701171880000
        end
      end
    end
    

    And the frame

    object Frame22: TFrame22
      Align = Scale
      Size.Width = 320.000000000000000000
      Size.Height = 196.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 0
      object Label1: TLabel
        Position.X = 32.000000000000000000
        Position.Y = 32.000000000000000000
        Text = 'Frame here!'
      end
      object Button1: TButton
        Align = Scale
        Position.X = 16.000000000000000000
        Position.Y = 56.000000000000000000
        TabOrder = 1
        Text = 'Button1'
      end
      object Button2: TButton
        Align = Scale
        Position.X = 216.000000000000000000
        Position.Y = 56.000000000000000000
        TabOrder = 2
        Text = 'Button2'
      end
      object Rectangle1: TRectangle
        Align = Scale
        Position.X = 16.000000000000000000
        Position.Y = 88.000000000000000000
        Size.Width = 281.000000000000000000
        Size.Height = 89.000000000000000000
        Size.PlatformDefault = False
      end
    end
    

    Note that all components (except the TLabel) have their Align property set to Scale.