Changeset 534 for DpiControls/Demo


Ignore:
Timestamp:
May 26, 2019, 8:29:38 PM (5 years ago)
Author:
chronos
Message:
  • Added: Update DpiForm position according real form position.
Location:
DpiControls/Demo
Files:
4 edited
2 moved

Legend:

Unmodified
Added
Removed
  • DpiControls/Demo/DpiComponentsDemo.lpi

    r533 r534  
    4848      </Unit1>
    4949      <Unit2>
    50         <Filename Value="UDpiForm.pas"/>
     50        <Filename Value="UDpiFormMain.pas"/>
    5151        <IsPartOfProject Value="True"/>
    52         <ComponentName Value="DpiForm1"/>
     52        <ComponentName Value="DpiFormMain"/>
    5353        <HasResources Value="True"/>
    5454      </Unit2>
  • DpiControls/Demo/DpiComponentsDemo.lpr

    r533 r534  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UFormMain, UDpiForm
     10  Forms, UFormMain, UDpiFormMain
    1111  { you can add units after this };
    1212
  • DpiControls/Demo/UDpiFormMain.lfm

    r533 r534  
    1 object DpiForm1: TDpiForm1
     1object DpiFormMain: TDpiFormMain
    22  Top = 504
    33  Left = 865
    44  Width = 0
    55  Height = 0
    6   Visible = False
    7   OnShow = DpiForm1Show
     6  Visible = True
     7  OnCreate = DpiFormMainCreate
    88  object DpiButton1: TDpiButton
    9     Top = 154
    10     Left = 20
     9    Top = 128
     10    Left = 8
    1111    Width = 150
    1212    Height = 40
     
    1414    Caption = 'Test'
    1515    OnClick = DpiButton1Click
    16     left = 88
    17     top = 88
    1816  end
    1917end
  • DpiControls/Demo/UDpiFormMain.pas

    r533 r534  
    1 unit UDpiForm;
     1unit UDpiFormMain;
    22
    33{$mode objfpc}{$H+}
     
    1010type
    1111
    12   { TDpiForm1 }
     12  { TDpiFormMain }
    1313
    14   TDpiForm1 = class(TDpiForm)
     14  TDpiFormMain = class(TDpiForm)
    1515    DpiButton1: TDpiButton;
    1616    procedure DpiButton1Click(Sender: TObject);
    17     procedure DpiForm1Show(Sender: TObject);
     17    procedure DpiFormMainCreate(Sender: TObject);
    1818  private
    1919
     
    2323
    2424var
    25   DpiForm1: TDpiForm1;
     25  DpiFormMain: TDpiFormMain;
    2626
    2727implementation
     
    2929{$R *.lfm}
    3030
    31 { TDpiForm1 }
     31{ TDpiFormMain }
    3232
    33 procedure TDpiForm1.DpiForm1Show(Sender: TObject);
     33procedure TDpiFormMain.DpiFormMainCreate(Sender: TObject);
    3434var
    3535  DpiButton: TDpiButton;
    3636  DpiImage: TDpiImage;
    3737begin
    38   DpiButton := TDpiButton.Create(DpiForm1);
    39   DpiButton.Parent := DpiForm1;
     38  DpiButton := TDpiButton.Create(DpiFormMain);
     39  DpiButton.Parent := Self;
    4040  DpiButton.SetBounds(10, 10, 100, 30);
    4141  DpiButton.Caption := 'Click me';
     
    4343  DpiButton1.Parent := Self;
    4444
    45   DpiImage := TDpiImage.Create(DpiForm1);
    46   DpiImage.Parent := DpiForm1;
     45  DpiImage := TDpiImage.Create(DpiFormMain);
     46  DpiImage.Parent := Self;
    4747  DpiImage.SetBounds(150, 10, 100, 100);
    4848  DpiImage.Visible := True;
     
    5151end;
    5252
    53 procedure TDpiForm1.DpiButton1Click(Sender: TObject);
     53procedure TDpiFormMain.DpiButton1Click(Sender: TObject);
    5454begin
    5555  ShowMessage('Hello');
  • DpiControls/Demo/UFormMain.lfm

    r533 r534  
    11object FormMain: TFormMain
    2   Left = 57
    3   Height = 126
    4   Top = 44
     2  Left = 127
     3  Height = 168
     4  Top = 66
    55  Width = 472
    66  Caption = 'DpiControls demo'
    7   ClientHeight = 126
     7  ClientHeight = 168
    88  ClientWidth = 472
    99  DesignTimePPI = 144
     
    2929    ParentColor = False
    3030  end
     31  object ButtonNewDpiForm: TButton
     32    Left = 19
     33    Height = 38
     34    Top = 117
     35    Width = 193
     36    Caption = 'New DpiForm'
     37    OnClick = ButtonNewDpiFormClick
     38    TabOrder = 1
     39  end
    3140end
  • DpiControls/Demo/UFormMain.pas

    r533 r534  
    77uses
    88  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls,
    9   ExtCtrls, UDpiForm, UDpiControls;
     9  ExtCtrls, UDpiControls, UDpiFormMain;
    1010
    1111type
     
    1414
    1515  TFormMain = class(TForm)
     16    ButtonNewDpiForm: TButton;
    1617    Label1: TLabel;
    1718    TrackBar1: TTrackBar;
     19    procedure ButtonNewDpiFormClick(Sender: TObject);
    1820    procedure FormShow(Sender: TObject);
    1921    procedure TrackBar1Change(Sender: TObject);
     
    3739  DpiScreen.Dpi := 96 * 2;
    3840  TrackBar1.Position := DpiScreen.Dpi;
     41  ButtonNewDpiFormClick(nil);
     42end;
    3943
    40   DpiForm1 := TDpiForm1.Create(nil);
    41   DpiForm1.Caption := DpiForm1.Name;
    42   DpiForm1.SetBounds(100, 100, 400, 200);
    43   DpiForm1.Show;
    44 
    45   DpiScreen.Forms.Add(DpiForm1);
     44procedure TFormMain.ButtonNewDpiFormClick(Sender: TObject);
     45var
     46  DpiForm: TDpiForm;
     47begin
     48  DpiForm := TDpiFormMain.Create(nil);
     49  DpiForm.Caption := DpiForm.Name;
     50  DpiForm.SetBounds(100, 100, 400, 200);
     51  DpiForm.Show;
     52  DpiScreen.Forms.Add(DpiForm);
    4653end;
    4754
Note: See TracChangeset for help on using the changeset viewer.