mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 09:05:58 +02:00
Designer, SizeCompsDlg: Autocheck radiobutton when entering a value in HeightEdit / WidthEdit. Issue #23398, patch from Alexander Strokach
git-svn-id: trunk@39405 -
This commit is contained in:
parent
e3fb445130
commit
5c8670cd8a
@ -9,13 +9,13 @@ object SizeComponentsDialog: TSizeComponentsDialog
|
|||||||
ClientWidth = 380
|
ClientWidth = 380
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.27'
|
LCLVersion = '1.1'
|
||||||
object PosLabel: TLabel
|
object PosLabel: TLabel
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
Left = 190
|
Left = 190
|
||||||
Height = 14
|
Height = 1
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -27,7 +27,7 @@ object SizeComponentsDialog: TSizeComponentsDialog
|
|||||||
AnchorSideBottom.Control = HeightRadioGroup
|
AnchorSideBottom.Control = HeightRadioGroup
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 146
|
Height = 141
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 181
|
Width = 181
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
@ -44,18 +44,19 @@ object SizeComponentsDialog: TSizeComponentsDialog
|
|||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 1
|
ChildSizing.ControlsPerLine = 1
|
||||||
ClientHeight = 128
|
ClientHeight = 122
|
||||||
ClientWidth = 177
|
ClientWidth = 173
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object WidthEdit: TEdit
|
object WidthEdit: TEdit
|
||||||
AnchorSideBottom.Control = WidthRadioGroup
|
AnchorSideBottom.Control = WidthRadioGroup
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 86
|
Left = 82
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 99
|
Top = 93
|
||||||
Width = 80
|
Width = 80
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
|
OnChange = WidthEditChange
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'WidthEdit'
|
Text = 'WidthEdit'
|
||||||
end
|
end
|
||||||
@ -67,7 +68,7 @@ object SizeComponentsDialog: TSizeComponentsDialog
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = ButtonPanel1
|
AnchorSideBottom.Control = ButtonPanel1
|
||||||
Left = 193
|
Left = 193
|
||||||
Height = 146
|
Height = 141
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 181
|
Width = 181
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
@ -84,27 +85,36 @@ object SizeComponentsDialog: TSizeComponentsDialog
|
|||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 1
|
ChildSizing.ControlsPerLine = 1
|
||||||
ClientHeight = 128
|
ClientHeight = 122
|
||||||
ClientWidth = 177
|
ClientWidth = 173
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object HeightEdit: TEdit
|
object HeightEdit: TEdit
|
||||||
AnchorSideBottom.Control = HeightRadioGroup
|
AnchorSideBottom.Control = HeightRadioGroup
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 87
|
Left = 83
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 99
|
Top = 93
|
||||||
Width = 80
|
Width = 80
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
|
OnChange = HeightEditChange
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'HeightEdit'
|
Text = 'HeightEdit'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 26
|
Height = 31
|
||||||
Top = 158
|
Top = 153
|
||||||
Width = 368
|
Width = 368
|
||||||
|
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 = 2
|
TabOrder = 2
|
||||||
ShowButtons = [pbOK, pbCancel]
|
ShowButtons = [pbOK, pbCancel]
|
||||||
ShowBevel = False
|
ShowBevel = False
|
||||||
|
@ -43,6 +43,12 @@ type
|
|||||||
WidthEdit: TEdit;
|
WidthEdit: TEdit;
|
||||||
HeightEdit: TEdit;
|
HeightEdit: TEdit;
|
||||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
|
procedure HeightEditChange(Sender: TObject);
|
||||||
|
procedure WidthEditChange(Sender: TObject);
|
||||||
|
private
|
||||||
|
IsAutoChangeWidth, IsAutoChangeHeight: boolean;
|
||||||
|
SaveItemIndexWidth, NumberItemWidth: Integer;
|
||||||
|
SaveItemIndexHeight, NumberItemHeight: Integer;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
end;
|
end;
|
||||||
@ -81,6 +87,36 @@ begin
|
|||||||
CloseAction := caFree;
|
CloseAction := caFree;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSizeComponentsDialog.HeightEditChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if HeightEdit.Text = '' then
|
||||||
|
begin
|
||||||
|
HeightRadioGroup.ItemIndex := SaveItemIndexHeight;
|
||||||
|
IsAutoChangeHeight := false;
|
||||||
|
end
|
||||||
|
else if not IsAutoChangeHeight then
|
||||||
|
begin
|
||||||
|
SaveItemIndexHeight := HeightRadioGroup.ItemIndex;
|
||||||
|
HeightRadioGroup.ItemIndex := NumberItemHeight;
|
||||||
|
IsAutoChangeHeight := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSizeComponentsDialog.WidthEditChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if WidthEdit.Text = '' then
|
||||||
|
begin
|
||||||
|
WidthRadioGroup.ItemIndex := SaveItemIndexWidth;
|
||||||
|
IsAutoChangeWidth := false;
|
||||||
|
end
|
||||||
|
else if not IsAutoChangeWidth then
|
||||||
|
begin
|
||||||
|
SaveItemIndexWidth := WidthRadioGroup.ItemIndex;
|
||||||
|
WidthRadioGroup.ItemIndex := NumberItemWidth;
|
||||||
|
IsAutoChangeWidth := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TSizeComponentsDialog.Create(AOwner: TComponent);
|
constructor TSizeComponentsDialog.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
@ -96,7 +132,7 @@ begin
|
|||||||
Add(lisNoChange);
|
Add(lisNoChange);
|
||||||
Add(lisShrinkToSmal);
|
Add(lisShrinkToSmal);
|
||||||
Add(lisGrowToLarges);
|
Add(lisGrowToLarges);
|
||||||
Add(dlgWidthPos);
|
NumberItemWidth := Add(dlgWidthPos);
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
ItemIndex:=0;
|
ItemIndex:=0;
|
||||||
@ -111,7 +147,7 @@ begin
|
|||||||
Add(lisNoChange);
|
Add(lisNoChange);
|
||||||
Add(lisShrinkToSmal);
|
Add(lisShrinkToSmal);
|
||||||
Add(lisGrowToLarges);
|
Add(lisGrowToLarges);
|
||||||
Add(DlgHeightPos);
|
NumberItemHeight := Add(DlgHeightPos);
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
ItemIndex:=0;
|
ItemIndex:=0;
|
||||||
@ -119,6 +155,11 @@ begin
|
|||||||
|
|
||||||
WidthEdit.Text:='';
|
WidthEdit.Text:='';
|
||||||
HeightEdit.Text:='';
|
HeightEdit.Text:='';
|
||||||
|
|
||||||
|
IsAutoChangeWidth := false;
|
||||||
|
IsAutoChangeHeight := false;
|
||||||
|
SaveItemIndexWidth := WidthRadioGroup.ItemIndex;
|
||||||
|
SaveItemIndexHeight := HeightRadioGroup.ItemIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user