Scale dialog: use SpinEdt. Issue #28111, patch from Alexey Torgashin.

git-svn-id: trunk@49062 -
This commit is contained in:
juha 2015-05-17 11:41:35 +00:00
parent 71acdc189d
commit 240949a096
2 changed files with 55 additions and 47 deletions

View File

@ -1,65 +1,75 @@
object ScaleComponentsDialog: TScaleComponentsDialog
Left = 642
Height = 87
Top = 378
Width = 256
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsToolWindow
Left = 391
Height = 107
Top = 430
Width = 301
ActiveControl = PercentEdit
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'ScaleComponentsDialog'
ClientHeight = 87
ClientWidth = 256
ClientHeight = 107
ClientWidth = 301
Position = poScreenCenter
LCLVersion = '0.9.27'
LCLVersion = '1.5'
object PercentLabel: TLabel
AnchorSideLeft.Control = PercentEdit
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = PercentEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 187
Height = 14
Top = 10
Width = 63
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Left = 186
Height = 15
Top = 35
Width = 68
BorderSpacing.Left = 6
Caption = 'PercentLabel'
ParentColor = False
end
object ScaleLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = PercentEdit
AnchorSideTop.Side = asrCenter
Left = 6
Height = 14
Height = 15
Top = 10
Width = 51
Width = 55
BorderSpacing.Left = 6
Caption = 'ScaleLabel'
ParentColor = False
end
object PercentEdit: TEdit
AnchorSideLeft.Control = ScaleLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner
AnchorSideRight.Control = PercentLabel
Left = 63
Height = 23
Top = 6
Width = 118
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
TabOrder = 0
Text = 'PercentEdit'
end
object ButtonPanel1: TButtonPanel
AnchorSideTop.Control = PercentEdit
AnchorSideTop.Side = asrBottom
Left = 6
Height = 34
Top = 47
Width = 244
Height = 26
Top = 75
Width = 289
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 1
ShowButtons = [pbOK, pbCancel]
ShowBevel = False
end
object PercentEdit: TSpinEdit
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ScaleLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
Left = 112
Height = 23
Top = 31
Width = 68
Anchors = [akTop]
BorderSpacing.Top = 6
Increment = 10
MaxValue = 2000
MinValue = 5
TabOrder = 0
Value = 5
end
end

View File

@ -31,7 +31,7 @@ interface
uses
Classes, SysUtils, LCLIntf, LCLProc, Forms, Controls, Buttons, StdCtrls,
ExtCtrls, LazarusIDEStrConsts, ButtonPanel;
ExtCtrls, LazarusIDEStrConsts, ButtonPanel, Spin;
type
@ -39,8 +39,8 @@ type
TScaleComponentsDialog = class(TForm)
ButtonPanel1: TButtonPanel;
PercentEdit: TSpinEdit;
ScaleLabel: TLabel;
PercentEdit: TEdit;
PercentLabel: TLabel;
public
constructor Create(AOwner: TComponent); override;
@ -53,15 +53,13 @@ implementation
{$R *.lfm}
function ShowScaleComponentsDialog(out ScaleInPercent: integer): TModalResult;
var
ScaleComponentsDialog: TScaleComponentsDialog;
begin
ScaleComponentsDialog:=TScaleComponentsDialog.Create(nil);
with ScaleComponentsDialog do
begin
PercentEdit.Text:='100';
with TScaleComponentsDialog.Create(nil) do
try
PercentEdit.Value:=100;
Result:=ShowModal;
ScaleInPercent:=StrToIntDef(ScaleComponentsDialog.PercentEdit.Text,100);
ScaleInPercent:=PercentEdit.Value;
finally
Free;
end;
end;