mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 04:53:01 +01:00
148 lines
3.1 KiB
ObjectPascal
148 lines
3.1 KiB
ObjectPascal
{
|
|
Author: Mattias Gaertner
|
|
|
|
Abstract:
|
|
Defines TScaleComponentsDialog.
|
|
}
|
|
unit ScaleCompsDlg;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, LCLLinux, Forms, Controls, Buttons, StdCtrls, ExtCtrls, LResources;
|
|
|
|
type
|
|
TScaleComponentsDialog = class(TForm)
|
|
Bevel: TBevel;
|
|
ScaleLabel: TLabel;
|
|
PercentEdit: TEdit;
|
|
PercentLabel: TLabel;
|
|
OkButton: TButton;
|
|
CancelButton: TButton;
|
|
procedure OkButtonClick(Sender: TObject);
|
|
procedure CancelButtonClick(Sender: TObject);
|
|
public
|
|
constructor Create(AOwner: TComponent); override;
|
|
end;
|
|
|
|
var ScaleComponentsDialog: TScaleComponentsDialog;
|
|
|
|
function ShowScaleComponentsDialog: TModalResult;
|
|
|
|
implementation
|
|
|
|
function ShowScaleComponentsDialog: TModalResult;
|
|
begin
|
|
writeln('[ShowScaleComponentsDialog] A');
|
|
if ScaleComponentsDialog=nil then
|
|
ScaleComponentsDialog:=TScaleComponentsDialog.Create(Application);
|
|
writeln('[ShowScaleComponentsDialog] B');
|
|
with ScaleComponentsDialog do begin
|
|
SetBounds((Screen.Width-270) div 2,(Screen.Height-110) div 2,260,100);
|
|
PercentEdit.Text:='100';
|
|
Result:=ShowModal;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TScaleComponentsDialog }
|
|
|
|
constructor TScaleComponentsDialog.Create(AOwner: TComponent);
|
|
begin
|
|
inherited Create(AOwner);
|
|
if LazarusResources.Find(Classname)=nil then begin
|
|
SetBounds((Screen.Width-270) div 2,(Screen.Height-110) div 2,260,100);
|
|
Caption:='Scale';
|
|
|
|
Bevel:=TBevel.Create(Self);
|
|
with Bevel do begin
|
|
Name:='Bevel';
|
|
Parent:=Self;
|
|
Left:=5;
|
|
Top:=5;
|
|
Width:=250;
|
|
Height:=50;
|
|
Visible:=true;
|
|
end;
|
|
|
|
ScaleLabel:=TLabel.Create(Self);
|
|
with ScaleLabel do begin
|
|
Name:='ScaleLabel';
|
|
Parent:=Self;
|
|
Left:=12;
|
|
Top:=15;
|
|
Width:=90;
|
|
Height:=25;
|
|
Caption:='Scaling factor:';
|
|
Visible:=true;
|
|
end;
|
|
|
|
PercentEdit:=TEdit.Create(Self);
|
|
with PercentEdit do begin
|
|
Name:='PercentEdit';
|
|
Parent:=Self;
|
|
Left:=140;
|
|
Top:=20;
|
|
Width:=60;
|
|
Text:='100';
|
|
Visible:=true;
|
|
end;
|
|
|
|
PercentLabel:=TLabel.Create(Self);
|
|
with PercentLabel do begin
|
|
Name:='PercentLabel';
|
|
Parent:=Self;
|
|
Left:=PercentEdit.Left+PercentEdit.Width+5;
|
|
Top:=ScaleLabel.Top;
|
|
Width:=15;
|
|
Height:=25;
|
|
Caption:='%';
|
|
Visible:=true;
|
|
end;
|
|
|
|
OkButton:=TButton.Create(Self);
|
|
with OkButton do begin
|
|
Name:='OkButton';
|
|
Parent:=Self;
|
|
Left:=85;
|
|
Top:=Bevel.Top+Bevel.Height+10;
|
|
Width:=75;
|
|
Height:=25;
|
|
Caption:='Ok';
|
|
OnClick:=@OkButtonClick;
|
|
Visible:=true;
|
|
end;
|
|
|
|
CancelButton:=TButton.Create(Self);
|
|
with CancelButton do begin
|
|
Name:='CancelButton';
|
|
Parent:=Self;
|
|
Left:=175;
|
|
Top:=OkButton.Top;
|
|
Width:=75;
|
|
Height:=25;
|
|
Caption:='Cancel';
|
|
OnClick:=@CancelButtonClick;
|
|
Visible:=true;
|
|
end;
|
|
end;
|
|
writeln('[TScaleComponentsDialog.Create] END');
|
|
end;
|
|
|
|
procedure TScaleComponentsDialog.OkButtonClick(Sender: TObject);
|
|
begin
|
|
ModalResult:=mrOk;
|
|
end;
|
|
|
|
procedure TScaleComponentsDialog.CancelButtonClick(Sender: TObject);
|
|
begin
|
|
ModalResult:=mrCancel;
|
|
end;
|
|
|
|
initialization
|
|
ScaleComponentsDialog:=nil;
|
|
|
|
end.
|