mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 07:59:28 +02:00
improved autosizing of TStringsPropertyEditorForm, implemented AnchorToCompanion Space
git-svn-id: trunk@7589 -
This commit is contained in:
parent
3c4dee55f9
commit
1ff461a21f
@ -253,7 +253,7 @@ Type
|
|||||||
FCollectedValues: TAliasStrings;
|
FCollectedValues: TAliasStrings;
|
||||||
procedure AddValue(const s: string); virtual;
|
procedure AddValue(const s: string); virtual;
|
||||||
public
|
public
|
||||||
procedure AddButtons(var x, y, BtnWidth: integer); override;
|
procedure AddButtons; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -2074,18 +2074,17 @@ begin
|
|||||||
FCollectedValues.Values[s]:=s;
|
FCollectedValues.Values[s]:=s;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAliasStringsPropEditorDlg.AddButtons(var x, y, BtnWidth: integer);
|
procedure TAliasStringsPropEditorDlg.AddButtons;
|
||||||
begin
|
begin
|
||||||
inherited AddButtons(x, y, BtnWidth);
|
inherited AddButtons;
|
||||||
|
|
||||||
GetDefaultValuesButton := TButton.Create(Self);
|
GetDefaultValuesButton := TButton.Create(Self);
|
||||||
with GetDefaultValuesButton do Begin
|
with GetDefaultValuesButton do Begin
|
||||||
Parent := Self;
|
Parent:=Self;
|
||||||
dec(x,BtnWidth+8);
|
|
||||||
SetBounds(x,y,BtnWidth,Height);
|
|
||||||
Anchors:= [akRight, akBottom];
|
|
||||||
Caption:='Get Defaults';
|
Caption:='Get Defaults';
|
||||||
OnClick:=@GetDefaultValuesButtonClick;
|
OnClick:=@GetDefaultValuesButtonClick;
|
||||||
|
AutoSize:=true;
|
||||||
|
AnchorToCompanion(akRight,5,SortButton);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1367,11 +1367,11 @@ type
|
|||||||
Memo: TMemo;
|
Memo: TMemo;
|
||||||
OKButton, CancelButton: TBitBtn;
|
OKButton, CancelButton: TBitBtn;
|
||||||
SortButton: TButton;
|
SortButton: TButton;
|
||||||
Bevel: TBevel;
|
Panel: TPanel;
|
||||||
StatusLabel: TLabel;
|
StatusLabel: TLabel;
|
||||||
Editor: TPropertyEditor;
|
Editor: TPropertyEditor;
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
procedure AddButtons(var x, y, BtnWidth: integer); virtual;
|
procedure AddButtons; virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@ -4551,12 +4551,6 @@ end;
|
|||||||
{ TStringsPropEditorDlg }
|
{ TStringsPropEditorDlg }
|
||||||
|
|
||||||
constructor TStringsPropEditorDlg.Create(TheOwner : TComponent);
|
constructor TStringsPropEditorDlg.Create(TheOwner : TComponent);
|
||||||
var
|
|
||||||
x: Integer;
|
|
||||||
y: Integer;
|
|
||||||
MaxX: LongInt;
|
|
||||||
MaxY: LongInt;
|
|
||||||
w: Integer;
|
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
Position := poScreenCenter;
|
Position := poScreenCenter;
|
||||||
@ -4564,72 +4558,66 @@ begin
|
|||||||
Height := 250;
|
Height := 250;
|
||||||
Caption := oisStringsEditorDialog;
|
Caption := oisStringsEditorDialog;
|
||||||
|
|
||||||
Bevel:= TBevel.Create(Self);
|
Panel := TPanel.Create(Self);
|
||||||
x:=4;
|
with Panel do begin
|
||||||
y:=4;
|
Parent:=Self;
|
||||||
MaxX:=Self.ClientWidth;
|
BorderSpacing.Around:=4;
|
||||||
MaxY:=Self.ClientHeight;
|
BevelInner:=bvLowered;
|
||||||
with Bevel do begin
|
Align:=alTop;
|
||||||
Parent:= Self;
|
|
||||||
Shape:= bsFrame;
|
|
||||||
SetBounds(x, y, MaxX-2*x, MaxY-y-34);
|
|
||||||
Anchors:= [akLeft, akTop, akRight, akBottom];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
StatusLabel:= TLabel.Create(Self);
|
StatusLabel:= TLabel.Create(Self);
|
||||||
x:=8;
|
|
||||||
y:=8;
|
|
||||||
with StatusLabel do begin
|
with StatusLabel do begin
|
||||||
Parent:= Self;
|
Parent:=Panel;
|
||||||
SetBounds(x,y,MaxX-2*x, Height);
|
Left:=7;
|
||||||
Anchors:= [akLeft, akTop, akRight];
|
Top:=5;
|
||||||
Caption:= ois0Lines0Chars;
|
Caption:= ois0Lines0Chars;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Memo := TMemo.Create(self);
|
Memo := TMemo.Create(self);
|
||||||
y:=StatusLabel.Top+StatusLabel.Height;
|
|
||||||
with Memo do begin
|
with Memo do begin
|
||||||
Parent:= Self;
|
Parent:= Panel;
|
||||||
SetBounds(x,y,MaxX-2*x,MaxY-y-38);
|
Align:=alBottom;
|
||||||
Anchors:= [akLeft, akTop, akRight, akBottom];
|
AnchorToNeighbour(akTop,2,StatusLabel);
|
||||||
Memo.OnChange:= @MemoChanged;
|
Memo.OnChange:= @MemoChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
x:=MaxX;
|
AddButtons;
|
||||||
y:=MaxY-30;
|
|
||||||
w:=80;
|
Panel.AnchorToNeighbour(akBottom,4,OKButton);
|
||||||
AddButtons(x,y,w);
|
|
||||||
|
CancelControl:=CancelButton;
|
||||||
|
DefaultControl:=OKButton;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TStringsPropEditorDlg.AddButtons(var x, y, BtnWidth: integer);
|
procedure TStringsPropEditorDlg.AddButtons;
|
||||||
begin
|
begin
|
||||||
OKButton := TBitBtn.Create(Self);
|
OKButton := TBitBtn.Create(Self);
|
||||||
with OKButton do Begin
|
with OKButton do Begin
|
||||||
Parent := Self;
|
Parent:=Self;
|
||||||
Kind:= bkOK;
|
Kind:=bkOK;
|
||||||
dec(x,BtnWidth+8);
|
AutoSize:=true;
|
||||||
SetBounds(x,y,BtnWidth,Height);
|
Anchors:=[akRight,akBottom];
|
||||||
Anchors:= [akRight, akBottom];
|
AnchorParallel(akRight,4,Parent);
|
||||||
|
AnchorParallel(akBottom,4,Parent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CancelButton := TBitBtn.Create(Self);
|
CancelButton := TBitBtn.Create(Self);
|
||||||
with CancelButton do Begin
|
with CancelButton do Begin
|
||||||
Parent := Self;
|
Parent:=Self;
|
||||||
Kind:= bkCancel;
|
Kind:=bkCancel;
|
||||||
dec(x,BtnWidth+8);
|
AutoSize:=true;
|
||||||
SetBounds(x,y,BtnWidth,Height);
|
AnchorToCompanion(akRight,5,OKButton);
|
||||||
Anchors:= [akRight, akBottom];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Assigned(ShowSortSelectionDialogFunc) then begin
|
if Assigned(ShowSortSelectionDialogFunc) then begin
|
||||||
SortButton := TButton.Create(Self);
|
SortButton := TButton.Create(Self);
|
||||||
with SortButton do Begin
|
with SortButton do Begin
|
||||||
Parent := Self;
|
Parent:=Self;
|
||||||
dec(x,BtnWidth+8);
|
|
||||||
SetBounds(x,y,BtnWidth,Height);
|
|
||||||
Anchors:= [akRight, akBottom];
|
|
||||||
Caption:=oisSort;
|
Caption:=oisSort;
|
||||||
OnClick:=@SortButtonClick;
|
OnClick:=@SortButtonClick;
|
||||||
|
AutoSize:=true;
|
||||||
|
AnchorToCompanion(akRight,5,CancelButton);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -3357,6 +3357,7 @@ procedure TControl.AnchorToCompanion(Side: TAnchorKind; Space: integer;
|
|||||||
AnchorToNeighbour(ResizeSide,0,Sibling);
|
AnchorToNeighbour(ResizeSide,0,Sibling);
|
||||||
AnchorParallel(FixedSide1,0,Sibling);
|
AnchorParallel(FixedSide1,0,Sibling);
|
||||||
AnchorParallel(FixedSide2,0,Sibling);
|
AnchorParallel(FixedSide2,0,Sibling);
|
||||||
|
BorderSpacing.SetSpace(ResizeSide,Space);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user