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