mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:29:25 +02:00
New version of Find and Replace Dialogues. Forms created in code without
loading a .lfm from stream. Added an frButtonsAtBottom Option. Removed dependency from /lcl/forms/finddlgunit.* and /lcl/forms/replacedlgunit.* git-svn-id: trunk@46783 -
This commit is contained in:
parent
da19531449
commit
7f75c3a2e3
@ -368,7 +368,8 @@ type
|
||||
TFindOption = (frDown, frFindNext, frHideMatchCase, frHideWholeWord,
|
||||
frHideUpDown, frMatchCase, frDisableMatchCase, frDisableUpDown,
|
||||
frDisableWholeWord, frReplace, frReplaceAll, frWholeWord, frShowHelp,
|
||||
frEntireScope, frHideEntireScope, frPromptOnReplace, frHidePromptOnReplace);
|
||||
frEntireScope, frHideEntireScope, frPromptOnReplace, frHidePromptOnReplace,
|
||||
frButtonsAtBottom);
|
||||
TFindOptions = set of TFindOption;
|
||||
|
||||
TFindDialog = class(TCommonDialog)
|
||||
@ -547,8 +548,8 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
{$R dialog_icons.res}
|
||||
{$R forms/finddlgunit.lfm}
|
||||
{$R forms/replacedlgunit.lfm}
|
||||
{ $R forms/finddlgunit.lfm}
|
||||
{ $R forms/replacedlgunit.lfm}
|
||||
|
||||
uses
|
||||
Math, WSDialogs;
|
||||
|
@ -30,7 +30,10 @@ type
|
||||
procedure EditFindChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
FButtonsBottom: Boolean;
|
||||
public
|
||||
constructor CreateNew(aOwner: TComponent; Options: TFindOptions); reintroduce;
|
||||
procedure SetLayout (Options: TFindOptions);
|
||||
end;
|
||||
|
||||
procedure TFindDialogForm.EditFindChange(Sender: TObject);
|
||||
@ -43,6 +46,314 @@ begin
|
||||
EditFindChange(nil);
|
||||
end;
|
||||
|
||||
constructor TFindDialogForm.CreateNew(aOwner: TComponent; Options: TFindOptions
|
||||
);
|
||||
var
|
||||
Layout: boolean; // true = Buttons at bottom
|
||||
begin
|
||||
inherited CreateNew(aOwner);
|
||||
Layout := frButtonsAtBottom in Options;
|
||||
if Layout then begin
|
||||
Left := 417;
|
||||
Height := 166;
|
||||
Top := 333;
|
||||
Width := 415;
|
||||
ClientHeight := 166;
|
||||
ClientWidth := 415;
|
||||
Constraints.MinHeight := 166;
|
||||
Constraints.MaxHeight := 166; // fixed height
|
||||
Constraints.MinWidth := 415;
|
||||
end
|
||||
else begin
|
||||
Left := 417;
|
||||
Height := 136;
|
||||
Top := 333;
|
||||
Width := 480;
|
||||
ClientHeight := 140;
|
||||
ClientWidth := 480;
|
||||
Constraints.MinHeight := 136;
|
||||
Constraints.MinWidth := 480;
|
||||
end;
|
||||
AutoSize := True;
|
||||
BorderIcons := [biSystemMenu, biHelp];
|
||||
Caption := 'Find';
|
||||
//OnCreate := @FormCreate;
|
||||
Position := poMainFormCenter;
|
||||
LCLVersion := '1.3';
|
||||
|
||||
FindLabel := TLabel.Create(Self);
|
||||
with FindLabel do begin
|
||||
Left := 6;
|
||||
Height := 17;
|
||||
Top := 15;
|
||||
Width := 77;
|
||||
BorderSpacing.Right := 2;
|
||||
Caption := 'Text to find';
|
||||
FocusControl := EditFind;
|
||||
ParentColor := False;
|
||||
Parent := Self;
|
||||
end;
|
||||
EditFind := TEdit.Create(Self);
|
||||
with EditFind do begin
|
||||
Left := 85;
|
||||
Height := 27;
|
||||
Top := 10;
|
||||
Width := 303;
|
||||
TabOrder := 0;
|
||||
Text := 'EditFind';
|
||||
Parent := Self;
|
||||
end;
|
||||
DirectionRadioGroup := TRadioGroup.Create(Self);
|
||||
with DirectionRadioGroup do begin
|
||||
Left := 155;
|
||||
Height := 45;
|
||||
Top := 49;
|
||||
Width := 227;
|
||||
AutoFill := True;
|
||||
AutoSize := True;
|
||||
BorderSpacing.Left := 12;
|
||||
//BorderSpacing.Around := 0;
|
||||
Caption := 'Direction';
|
||||
ChildSizing.LeftRightSpacing := 6;
|
||||
ChildSizing.TopBottomSpacing := 6;
|
||||
ChildSizing.EnlargeHorizontal := crsHomogenousChildResize;
|
||||
ChildSizing.EnlargeVertical := crsHomogenousChildResize;
|
||||
ChildSizing.ShrinkHorizontal := crsScaleChilds;
|
||||
ChildSizing.ShrinkVertical := crsScaleChilds;
|
||||
ChildSizing.Layout := cclLeftToRightThenTopToBottom;
|
||||
ChildSizing.ControlsPerLine := 2;
|
||||
ClientHeight := 48;
|
||||
ClientWidth := 217;
|
||||
Columns := 2;
|
||||
Constraints.MaxHeight := 60;
|
||||
Items.Add('Forward');
|
||||
Items.Add('Backward');
|
||||
TabOrder := 1;
|
||||
Parent := Self;
|
||||
end;
|
||||
FlagsPanel := TPanel.Create(Self);
|
||||
With FlagsPanel do begin
|
||||
Left := 6;
|
||||
Height := 82;
|
||||
Top := 43;
|
||||
Width := 143;
|
||||
AutoSize := True;
|
||||
BorderSpacing.Around := 6;
|
||||
BevelOuter := bvNone;
|
||||
ChildSizing.VerticalSpacing := 6;
|
||||
ChildSizing.Layout := cclLeftToRightThenTopToBottom;
|
||||
ChildSizing.ControlsPerLine := 1;
|
||||
ClientHeight := 82;
|
||||
ClientWidth := 143;
|
||||
TabOrder := 2;
|
||||
Parent := Self;
|
||||
end;
|
||||
// Flags Panel Objects
|
||||
WholeWordsOnlyCheckBox := TCheckBox.Create(Self);
|
||||
with WholeWordsOnlyCheckBox do begin
|
||||
Left := 0;
|
||||
Height := 23;
|
||||
Top := 0;
|
||||
Width := 142;
|
||||
Caption := 'Whole words only';
|
||||
TabOrder := 0;
|
||||
Parent := FlagsPanel;
|
||||
end;
|
||||
CaseSensitiveCheckBox := TCheckBox.Create(Self);
|
||||
with CaseSensitiveCheckBox do begin
|
||||
Left := 0;
|
||||
Height := 23;
|
||||
Top := 29;
|
||||
Width := 142;
|
||||
Caption := 'Case sensitive';
|
||||
TabOrder := 1;
|
||||
Parent := FlagsPanel;
|
||||
end;
|
||||
EntireScopeCheckBox := TCheckBox.Create(Self);
|
||||
with EntireScopeCheckBox do begin
|
||||
Left := 0;
|
||||
Height := 23;
|
||||
Top := 58;
|
||||
Width := 142;
|
||||
Caption := 'Search entire file';
|
||||
TabOrder := 2;
|
||||
Parent := FlagsPanel;
|
||||
end;
|
||||
//End of Flags Panel objects
|
||||
BtnPanel := TPanel.Create(Self);
|
||||
with BtnPanel do begin
|
||||
Left := 388;
|
||||
Height := 132;
|
||||
Top := 0;
|
||||
Width := 92;
|
||||
Align := alRight;
|
||||
AutoSize := True;
|
||||
BevelOuter := bvNone;
|
||||
ChildSizing.LeftRightSpacing := 6;
|
||||
ChildSizing.TopBottomSpacing := 6;
|
||||
ChildSizing.VerticalSpacing := 6;
|
||||
ClientHeight := 132;
|
||||
ClientWidth := 92;
|
||||
TabOrder := 3;
|
||||
Parent := Self;
|
||||
end;
|
||||
// BtnPanel Objects
|
||||
FindButton := TButton.Create(Self);
|
||||
with FindButton do begin
|
||||
Left := 6;
|
||||
Height := 26;
|
||||
Top := 6;
|
||||
Width := 80;
|
||||
AutoSize := True;
|
||||
Caption := 'Find more';
|
||||
Constraints.MinWidth := 80;
|
||||
Default := True;
|
||||
TabOrder := 0;
|
||||
Parent := BtnPanel;
|
||||
end;
|
||||
CancelButton := TButton.Create(Self);
|
||||
with CancelButton do begin
|
||||
Left := 6;
|
||||
Height := 26;
|
||||
Top := 64;
|
||||
Width := 80;
|
||||
AutoSize := True;
|
||||
BorderSpacing.Bottom := 10;
|
||||
Cancel := True;
|
||||
Caption := 'Cancel';
|
||||
Constraints.MinWidth := 80;
|
||||
ModalResult := 2;
|
||||
TabOrder := 1;
|
||||
Parent := BtnPanel;
|
||||
end;
|
||||
HelpButton := TButton.Create(Self);
|
||||
with HelpButton do begin
|
||||
Left := 6;
|
||||
Height := 26;
|
||||
Top := 100;
|
||||
Width := 80;
|
||||
AutoSize := True;
|
||||
Caption := 'Help';
|
||||
Constraints.MinWidth := 80;
|
||||
TabOrder := 2;
|
||||
Parent := BtnPanel;
|
||||
end;
|
||||
|
||||
EditFind.OnChange := @EditFindChange;
|
||||
SetLayout(Options);
|
||||
end;
|
||||
|
||||
procedure TFindDialogForm.SetLayout(Options: TFindOptions);
|
||||
begin
|
||||
FButtonsBottom := frButtonsAtBottom in Options;
|
||||
if FButtonsBottom then begin
|
||||
Height := 180;
|
||||
Width := 447;
|
||||
ClientHeight := 180;
|
||||
ClientWidth := 447;
|
||||
AutoSize := False;
|
||||
with BtnPanel do begin
|
||||
Left := 0;
|
||||
Height := 38;
|
||||
Top := 131;
|
||||
Width := 447;
|
||||
ClientHeight := 38;
|
||||
ClientWidth := 447;
|
||||
Align := alBottom;
|
||||
AutoSize := True;
|
||||
end;
|
||||
// Anchors
|
||||
FindLabel.Anchors := [akTop, akLeft];
|
||||
FindLabel.AnchorSideTop.Control := EditFind;
|
||||
FindLabel.AnchorSideTop.Side := asrCenter;
|
||||
|
||||
EditFind.Width := 362;
|
||||
EditFind.Anchors := [akTop, akLeft, akRight];
|
||||
EditFind.AnchorSideLeft.Control := FindLabel;
|
||||
EditFind.AnchorSideLeft.Side := asrBottom;
|
||||
EditFind.AnchorSideRight.Control := TControl(Owner);
|
||||
EditFind.AnchorSideRight.Side := asrBottom;
|
||||
|
||||
|
||||
DirectionRadioGroup.Anchors := [akTop, akLeft];
|
||||
DirectionRadioGroup.AnchorSideLeft.Control := FlagsPanel;
|
||||
DirectionRadioGroup.AnchorSideLeft.Side := asrBottom;
|
||||
DirectionRadioGroup.AnchorSideTop.Control := FlagsPanel;
|
||||
|
||||
FlagsPanel.Anchors := [akTop, akLeft];
|
||||
FlagsPanel.AnchorSideLeft.Control := TControl(Owner);
|
||||
FlagsPanel.AnchorSideTop.Control := EditFind;
|
||||
FlagsPanel.AnchorSideTop.Side := asrBottom;
|
||||
|
||||
FindButton.Anchors := [akRight, akBottom];
|
||||
FindButton.AnchorSideRight.Control := BtnPanel;
|
||||
FindButton.AnchorSideRight.Side := asrBottom;
|
||||
FindButton.AnchorSideBottom.Control := BtnPanel;
|
||||
FindButton.AnchorSideBottom.Side := asrBottom;
|
||||
|
||||
CancelButton.Left := 265;
|
||||
CancelButton.Top := 6;
|
||||
CancelButton.BorderSpacing.Bottom := 0;
|
||||
CancelButton.Anchors := [akRight, akBottom];
|
||||
CancelButton.AnchorSideRight.Control := FindButton;
|
||||
//CancelButton.AnchorSideRight.Side := asrBottom;
|
||||
CancelButton.AnchorSideBottom.Control := BtnPanel;
|
||||
CancelButton.AnchorSideBottom.Side := asrBottom;
|
||||
CancelButton.BorderSpacing.Right := 32;
|
||||
|
||||
HelpButton.Anchors := [akLeft, akBottom];
|
||||
HelpButton.AnchorSideLeft.Control := BtnPanel;
|
||||
HelpButton.AnchorSideBottom.Control := BtnPanel;
|
||||
HelpButton.AnchorSideBottom.Side := asrBottom;
|
||||
end
|
||||
else begin
|
||||
with BtnPanel do begin
|
||||
Height := 132;
|
||||
Top := 0;
|
||||
Width := 92;
|
||||
Align := alRight;
|
||||
end;
|
||||
// Anchors
|
||||
FindLabel.AnchorSideTop.Control := EditFind;
|
||||
FindLabel.AnchorSideTop.Side := asrCenter;
|
||||
|
||||
EditFind.Anchors := [akTop, akLeft, akRight];
|
||||
EditFind.AnchorSideLeft.Control := FindLabel;
|
||||
EditFind.AnchorSideLeft.Side := asrBottom;
|
||||
EditFind.AnchorSideRight.Control := BtnPanel;
|
||||
|
||||
DirectionRadioGroup.Anchors := [akTop, akLeft, akRight, akBottom];
|
||||
DirectionRadioGroup.AnchorSideLeft.Control := FlagsPanel;
|
||||
DirectionRadioGroup.AnchorSideLeft.Side := asrBottom;
|
||||
DirectionRadioGroup.AnchorSideTop.Control := FlagsPanel;
|
||||
DirectionRadioGroup.AnchorSideRight.Control := BtnPanel;
|
||||
DirectionRadioGroup.AnchorSideBottom.Control := FlagsPanel;
|
||||
DirectionRadioGroup.AnchorSideBottom.Side := asrBottom;
|
||||
|
||||
FlagsPanel.AnchorSideLeft.Control := TControl(Owner);
|
||||
FlagsPanel.AnchorSideTop.Control := EditFind;
|
||||
FlagsPanel.AnchorSideTop.Side := asrBottom;
|
||||
|
||||
FindButton.Anchors := [akTop, akRight];
|
||||
FindButton.AnchorSideTop.Control := BtnPanel;
|
||||
FindButton.AnchorSideRight.Control := BtnPanel;
|
||||
FindButton.AnchorSideRight.Side := asrBottom;
|
||||
FindButton.AnchorSideBottom.Control := CancelButton;
|
||||
|
||||
CancelButton.Anchors := [akRight, akBottom];
|
||||
CancelButton.AnchorSideTop.Side := asrBottom;
|
||||
CancelButton.AnchorSideRight.Control := BtnPanel;
|
||||
CancelButton.AnchorSideRight.Side := asrBottom;
|
||||
CancelButton.AnchorSideBottom.Control := HelpButton;
|
||||
|
||||
HelpButton.Anchors := [akLeft, akRight, akBottom];
|
||||
HelpButton.AnchorSideLeft.Control := BtnPanel;
|
||||
HelpButton.AnchorSideRight.Control := BtnPanel;
|
||||
HelpButton.AnchorSideBottom.Control := BtnPanel;
|
||||
HelpButton.AnchorSideBottom.Side := asrBottom;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TFindDialog }
|
||||
|
||||
function TFindDialog.GetReplaceText: string;
|
||||
@ -126,7 +437,7 @@ end;
|
||||
procedure TFindDialog.SetPosition(const AValue: TPoint);
|
||||
begin
|
||||
if (FFormLeft<>AValue.x) or (FFormTop<>AValue.y) then
|
||||
begin;
|
||||
begin
|
||||
FFormLeft:=AValue.x;
|
||||
FFormTop:=AValue.y;
|
||||
UpdatePosition;
|
||||
@ -163,7 +474,7 @@ end;
|
||||
function TFindDialog.CreateForm: TForm;
|
||||
begin
|
||||
// do not use Self as Owner, otherwise as desgntime this will not work
|
||||
Result := TFindDialogForm.Create(nil);
|
||||
Result := TFindDialogForm.CreateNew(nil,Options);
|
||||
with TFindDialogForm(Result) do
|
||||
begin
|
||||
FindButton.Caption := rsFind;
|
||||
|
@ -17,6 +17,8 @@ type
|
||||
{ TReplaceDialogForm }
|
||||
|
||||
TReplaceDialogForm = class(TForm)
|
||||
FlagPanel: TPanel;
|
||||
PanelButtons: TPanel;
|
||||
PromptOnReplaceCheckBox: TCheckBox;
|
||||
EntireScopeCheckBox: TCheckBox;
|
||||
FindMoreButton: TButton;
|
||||
@ -31,11 +33,469 @@ type
|
||||
TextLabel: TLabel;
|
||||
ReplaceLabel: TLabel;
|
||||
DirectionRadioGroup: TRadioGroup;
|
||||
Label1: TLabel;
|
||||
private
|
||||
FButtonsBottom: Boolean;
|
||||
public
|
||||
{ public declarations }
|
||||
constructor CreateNew(aOwner: TComponent; Options: TFindOptions); reintroduce;
|
||||
procedure SetLayout (Options: TFindOptions);
|
||||
end;
|
||||
|
||||
constructor TReplaceDialogForm.CreateNew(aOwner: TComponent;
|
||||
Options: TFindOptions);
|
||||
var
|
||||
Layout: boolean; // true = Buttons at bottom
|
||||
begin
|
||||
inherited CreateNew(aOwner);
|
||||
Layout := frButtonsAtBottom in Options;
|
||||
if Layout then begin
|
||||
Left := 415;
|
||||
Height := 220;
|
||||
Top := 391;
|
||||
Width := 530;
|
||||
ClientHeight := 220;
|
||||
ClientWidth := 530;
|
||||
Constraints.MinHeight := 220;
|
||||
Constraints.MinWidth := 530;
|
||||
end
|
||||
else begin
|
||||
Left := 415;
|
||||
Height := 184;
|
||||
Top := 333;
|
||||
Width := 480;
|
||||
ClientHeight := 140;
|
||||
ClientWidth := 480;
|
||||
Constraints.MinHeight := 184;
|
||||
Constraints.MinWidth := 480;
|
||||
end;
|
||||
ActiveControl := EditFind;
|
||||
AutoSize := True;
|
||||
BorderIcons := [biSystemMenu, biHelp];
|
||||
Caption := 'Replace Text';
|
||||
Position := poMainFormCenter;
|
||||
LCLVersion := '1.3';
|
||||
|
||||
TextLabel := TLabel.Create(Self);
|
||||
with TextLabel do begin
|
||||
Left := 4;
|
||||
Height := 17;
|
||||
Top := 14;
|
||||
Width := 77;
|
||||
BorderSpacing.Left := 4;
|
||||
BorderSpacing.Top := 14;
|
||||
Caption := 'Text to find';
|
||||
FocusControl := EditFind;
|
||||
ParentColor := False;
|
||||
Parent := Self;
|
||||
end;
|
||||
ReplaceLabel := TLabel.Create(Self);
|
||||
with ReplaceLabel do begin
|
||||
Left := 4;
|
||||
Height := 17;
|
||||
Top := 45;
|
||||
Width := 87;
|
||||
BorderSpacing.Top := 14;
|
||||
Caption := 'Replace with';
|
||||
FocusControl := EditReplace;
|
||||
ParentColor := False;
|
||||
Parent := Self;
|
||||
end;
|
||||
EditFind := TEdit.Create(Self);
|
||||
with EditFind do begin
|
||||
Left := 89;
|
||||
Height := 27;
|
||||
Top := 9;
|
||||
Width := 288;
|
||||
BorderSpacing.Left := 8;
|
||||
TabOrder := 0;
|
||||
Text := 'EditFind';
|
||||
Parent := Self;
|
||||
end;
|
||||
EditReplace := TEdit.Create(Self);
|
||||
with EditReplace do begin
|
||||
Left := 99;
|
||||
Height := 27;
|
||||
Top := 40;
|
||||
Width := 278;
|
||||
BorderSpacing.Left := 8;
|
||||
TabOrder := 1;
|
||||
Text := 'EditReplace';
|
||||
Parent := Self;
|
||||
end;
|
||||
DirectionRadioGroup := TRadioGroup.Create(Self);
|
||||
with DirectionRadioGroup do begin
|
||||
Left := 155;
|
||||
Height := 60;
|
||||
Top := 62;
|
||||
Width := 222;
|
||||
AutoFill := True;
|
||||
AutoSize := True;
|
||||
BorderSpacing.Left := 12;
|
||||
//BorderSpacing.Around := 0;
|
||||
Caption := 'Direction';
|
||||
ChildSizing.LeftRightSpacing := 6;
|
||||
ChildSizing.TopBottomSpacing := 6;
|
||||
ChildSizing.EnlargeHorizontal := crsHomogenousChildResize;
|
||||
ChildSizing.EnlargeVertical := crsHomogenousChildResize;
|
||||
ChildSizing.ShrinkHorizontal := crsScaleChilds;
|
||||
ChildSizing.ShrinkVertical := crsScaleChilds;
|
||||
ChildSizing.Layout := cclLeftToRightThenTopToBottom;
|
||||
ChildSizing.ControlsPerLine := 2;
|
||||
ClientHeight := 38;
|
||||
ClientWidth := 212;
|
||||
Columns := 2;
|
||||
Constraints.MaxHeight := 60;
|
||||
Items.Add('Forward');
|
||||
Items.Add('Backward');
|
||||
TabOrder := 2;
|
||||
Parent := Self;
|
||||
end;
|
||||
FlagPanel := TPanel.Create(Self);
|
||||
With FlagPanel do begin
|
||||
Left := 4;
|
||||
Height := 114;
|
||||
Top := 62;
|
||||
Width := 151;
|
||||
AutoSize := True;
|
||||
BorderSpacing.Around := 6;
|
||||
BevelOuter := bvNone;
|
||||
//ChildSizing.VerticalSpacing := 6;
|
||||
//ChildSizing.Layout := cclLeftToRightThenTopToBottom;
|
||||
//ChildSizing.ControlsPerLine := 1;
|
||||
ClientHeight := 114;
|
||||
ClientWidth := 151;
|
||||
Constraints.MinHeight := 114;
|
||||
TabOrder := 3;
|
||||
Parent := Self;
|
||||
end;
|
||||
// Flags Panel Objects
|
||||
WholeWordsOnlyCheckBox := TCheckBox.Create(Self);
|
||||
with WholeWordsOnlyCheckBox do begin
|
||||
Left := 0;
|
||||
Height := 23;
|
||||
Top := 0;
|
||||
Width := 142;
|
||||
Caption := 'Whole words only';
|
||||
TabOrder := 0;
|
||||
Parent := FlagPanel;
|
||||
end;
|
||||
CaseSensitiveCheckBox := TCheckBox.Create(Self);
|
||||
with CaseSensitiveCheckBox do begin
|
||||
Left := 0;
|
||||
Height := 23;
|
||||
Top := 29;
|
||||
Width := 142;
|
||||
Caption := 'Case sensitive';
|
||||
TabOrder := 1;
|
||||
Parent := FlagPanel;
|
||||
end;
|
||||
EntireScopeCheckBox := TCheckBox.Create(Self);
|
||||
with EntireScopeCheckBox do begin
|
||||
Left := 0;
|
||||
Height := 23;
|
||||
Top := 58;
|
||||
Width := 142;
|
||||
Caption := 'Search entire file';
|
||||
TabOrder := 2;
|
||||
Parent := FlagPanel;
|
||||
end;
|
||||
PromptOnReplaceCheckBox := TCheckBox.Create(Self);
|
||||
with PromptOnReplaceCheckBox do begin
|
||||
Left := 0;
|
||||
Height := 23;
|
||||
Top := 89;
|
||||
Width := 151;
|
||||
Caption := 'Prompt on replace';
|
||||
TabOrder := 3;
|
||||
Parent := FlagPanel;
|
||||
end;
|
||||
//End of Flags Panel objects
|
||||
PanelButtons := TPanel.Create(Self);
|
||||
with PanelButtons do begin
|
||||
if Layout then begin
|
||||
Left := 0;
|
||||
Height := 29;
|
||||
Top := 191;
|
||||
Width := 530;
|
||||
Align := alBottom;
|
||||
BevelOuter := bvNone;
|
||||
ClientHeight := 29;
|
||||
ClientWidth := 530;
|
||||
TabOrder := 4;
|
||||
end
|
||||
else begin
|
||||
Left := 388;
|
||||
Height := 132;
|
||||
Top := 0;
|
||||
Width := 92;
|
||||
Align := alRight;
|
||||
BevelOuter := bvNone;
|
||||
ChildSizing.LeftRightSpacing := 6;
|
||||
ChildSizing.TopBottomSpacing := 6;
|
||||
ChildSizing.VerticalSpacing := 6;
|
||||
ClientHeight := 132;
|
||||
ClientWidth := 92;
|
||||
TabOrder := 3;
|
||||
end;
|
||||
Parent := Self;
|
||||
end;
|
||||
// PanelButtons Objects
|
||||
FindMoreButton := TButton.Create(Self);
|
||||
with FindMoreButton do begin
|
||||
Tag := 1;
|
||||
Left := 12;
|
||||
Height := 26;
|
||||
Top := 10;
|
||||
Width := 91;
|
||||
AutoSize := True;
|
||||
Caption := 'Find more';
|
||||
Constraints.MinWidth := 91;
|
||||
Default := True;
|
||||
TabOrder := 0;
|
||||
Parent := PanelButtons;
|
||||
end;
|
||||
ReplaceButton := TButton.Create(Self);
|
||||
with ReplaceButton do begin
|
||||
Tag := 2;
|
||||
Left := 12;
|
||||
Height := 26;
|
||||
Top := 46;
|
||||
Width := 91;
|
||||
AutoSize := True;
|
||||
Caption := 'Replace';
|
||||
Constraints.MinWidth := 91;
|
||||
Default := True;
|
||||
TabOrder := 2;
|
||||
Parent := PanelButtons;
|
||||
end;
|
||||
ReplaceAllButton := TButton.Create(Self);
|
||||
with ReplaceAllButton do begin
|
||||
Tag := 3;
|
||||
Left := 12;
|
||||
Height := 26;
|
||||
Top := 82;
|
||||
Width := 91;
|
||||
AutoSize := True;
|
||||
Caption := 'Replace all';
|
||||
Constraints.MinWidth := 91;
|
||||
Default := True;
|
||||
TabOrder := 2;
|
||||
Parent := PanelButtons;
|
||||
end;
|
||||
CancelButton := TButton.Create(Self);
|
||||
with CancelButton do begin
|
||||
Left := 12;
|
||||
Height := 26;
|
||||
Top := 122;
|
||||
Width := 91;
|
||||
AutoSize := True;
|
||||
Cancel := True;
|
||||
Caption := 'Cancel';
|
||||
Constraints.MinWidth := 91;
|
||||
ModalResult := 2;
|
||||
TabOrder := 1;
|
||||
Parent := PanelButtons;
|
||||
end;
|
||||
HelpButton := TButton.Create(Self);
|
||||
with HelpButton do begin
|
||||
Left := 12;
|
||||
Height := 26;
|
||||
Top := 158;
|
||||
Width := 91;
|
||||
AutoSize := True;
|
||||
Caption := 'Help';
|
||||
Constraints.MinWidth := 91;
|
||||
TabOrder := 3;
|
||||
Parent := PanelButtons;
|
||||
end;
|
||||
|
||||
//EditFind.OnChange := @EditFindChange;
|
||||
SetLayout(Options);
|
||||
end;
|
||||
|
||||
procedure TReplaceDialogForm.SetLayout(Options: TFindOptions);
|
||||
var
|
||||
dlgWidth: Integer;
|
||||
begin
|
||||
FButtonsBottom := frButtonsAtBottom in Options;
|
||||
if FButtonsBottom then begin
|
||||
if frShowHelp in Options then dlgWidth := 630
|
||||
else dlgWidth := 530;
|
||||
Height := 220;
|
||||
Width := dlgWidth;
|
||||
ClientHeight := 220;
|
||||
ClientWidth := dlgWidth;
|
||||
AutoSize := True;
|
||||
with PanelButtons do begin
|
||||
Left := 0;
|
||||
Height := 29;
|
||||
Top := 191;
|
||||
Width := dlgWidth;
|
||||
ClientHeight := 29;
|
||||
ClientWidth := dlgWidth;
|
||||
Align := alBottom;
|
||||
end;
|
||||
// Anchors
|
||||
TextLabel.AnchorSideLeft.Control := TControl(Owner);
|
||||
TextLabel.AnchorSideTop.Control := TControl(Owner);
|
||||
//TextLabel.Anchors := [akTop, akLeft];
|
||||
|
||||
ReplaceLabel.AnchorSideLeft.Control := TextLabel;
|
||||
ReplaceLabel.AnchorSideTop.Control := TextLabel;
|
||||
ReplaceLabel.AnchorSideTop.Side := asrBottom;
|
||||
//ReplaceLabel.Anchors := [akTop, akLeft];
|
||||
|
||||
EditFind.Width := 425;
|
||||
EditFind.AnchorSideLeft.Control := TextLabel;
|
||||
EditFind.AnchorSideLeft.Side := asrBottom;
|
||||
EditFind.AnchorSideTop.Control := TextLabel;
|
||||
EditFind.AnchorSideTop.Side := asrCenter;
|
||||
EditFind.AnchorSideRight.Control := TControl(Owner);
|
||||
EditFind.AnchorSideRight.Side := asrBottom;
|
||||
EditFind.Anchors := [akTop, akLeft, akRight];
|
||||
|
||||
EditReplace.Width := 416;
|
||||
EditReplace.AnchorSideLeft.Control := ReplaceLabel;
|
||||
EditReplace.AnchorSideLeft.Side := asrBottom;
|
||||
EditReplace.AnchorSideTop.Control := ReplaceLabel;
|
||||
EditReplace.AnchorSideTop.Side := asrCenter;
|
||||
EditReplace.AnchorSideRight.Control := TControl(Owner);
|
||||
EditReplace.AnchorSideRight.Side := asrBottom;
|
||||
EditReplace.Anchors := [akTop, akLeft, akRight];
|
||||
|
||||
//DirectionRadioGroup.Anchors := [akTop, akLeft];
|
||||
DirectionRadioGroup.AnchorSideLeft.Control := FlagPanel;
|
||||
DirectionRadioGroup.AnchorSideLeft.Side := asrBottom;
|
||||
DirectionRadioGroup.AnchorSideTop.Control := FlagPanel;
|
||||
|
||||
FlagPanel.AnchorSideLeft.Control := TextLabel;
|
||||
FlagPanel.AnchorSideTop.Control := EditReplace;
|
||||
FlagPanel.AnchorSideTop.Side := asrBottom;
|
||||
FlagPanel.AnchorSideBottom.Side := asrBottom;
|
||||
|
||||
FindMoreButton.Top := 0;
|
||||
FindMoreButton.Left := 439;
|
||||
FindMoreButton.AnchorSideTop.Control := PanelButtons;
|
||||
FindMoreButton.AnchorSideRight.Control := PanelButtons;
|
||||
FindMoreButton.AnchorSideRight.Side := asrBottom;
|
||||
FindMoreButton.Anchors := [akTop, akRight];
|
||||
FindMoreButton.BorderSpacing.Right := 6;
|
||||
|
||||
ReplaceButton.Top := 0;
|
||||
ReplaceButton.Left := 309;
|
||||
ReplaceButton.BorderSpacing.Left := 12;
|
||||
ReplaceButton.AnchorSideLeft.Control := ReplaceAllButton;
|
||||
ReplaceButton.AnchorSideLeft.Side := asrBottom;
|
||||
ReplaceButton.AnchorSideTop.Control := PanelButtons;
|
||||
ReplaceButton.AnchorSideRight.Side := asrBottom;
|
||||
//ReplaceButton.Anchors := [akLeft,akTop];
|
||||
|
||||
ReplaceAllButton.Top := 0;
|
||||
ReplaceAllButton.Left := 206;
|
||||
ReplaceAllButton.BorderSpacing.Left := 12;
|
||||
ReplaceAllButton.AnchorSideLeft.Control := CancelButton;
|
||||
ReplaceAllButton.AnchorSideLeft.Side := asrBottom;
|
||||
ReplaceAllButton.AnchorSideTop.Control := PanelButtons;
|
||||
ReplaceAllButton.AnchorSideRight.Side := asrBottom;
|
||||
//ReplaceAllButton.Anchors := [akLeft,akTop];
|
||||
|
||||
CancelButton.Top := 0;
|
||||
CancelButton.Left := 103;
|
||||
CancelButton.BorderSpacing.Left := 12;
|
||||
CancelButton.AnchorSideLeft.Control := HelpButton;
|
||||
CancelButton.AnchorSideLeft.Side := asrBottom;
|
||||
CancelButton.AnchorSideTop.Control := PanelButtons;
|
||||
CancelButton.AnchorSideRight.Side := asrBottom;
|
||||
//CancelButton.Anchors := [akLeft,akTop];
|
||||
|
||||
HelpButton.AnchorSideLeft.Control := PanelButtons;
|
||||
HelpButton.AnchorSideTop.Control := PanelButtons;
|
||||
HelpButton.AnchorSideRight.Control := PanelButtons;
|
||||
HelpButton.AnchorSideRight.Side := asrBottom;
|
||||
//HelpButton.Anchors := [akLeft,akRight,akTop];
|
||||
end
|
||||
else begin
|
||||
with PanelButtons do begin
|
||||
Height := 184;
|
||||
Top := 0;
|
||||
Width := 103;
|
||||
AutoSize := True;
|
||||
Align := alRight;
|
||||
end;
|
||||
// Anchors
|
||||
TextLabel.AnchorSideTop.Control := TControl(Owner);
|
||||
TextLabel.AnchorSideLeft.Control := TControl(Owner);
|
||||
|
||||
ReplaceLabel.AnchorSideLeft.Control := TextLabel;
|
||||
ReplaceLabel.AnchorSideTop.Control := TextLabel;
|
||||
ReplaceLabel.AnchorSideTop.Side := asrBottom;
|
||||
|
||||
EditFind.Anchors := [akTop, akLeft, akRight];
|
||||
EditFind.AnchorSideLeft.Control := TextLabel;
|
||||
EditFind.AnchorSideLeft.Side := asrBottom;
|
||||
EditFind.AnchorSideTop.Control := TextLabel;
|
||||
EditFind.AnchorSideTop.Side := asrCenter;
|
||||
EditFind.AnchorSideRight.Control := PanelButtons;
|
||||
|
||||
EditReplace.Anchors := [akTop, akLeft, akRight];
|
||||
EditReplace.AnchorSideLeft.Control := ReplaceLabel;
|
||||
EditReplace.AnchorSideLeft.Side := asrBottom;
|
||||
EditReplace.AnchorSideTop.Control := ReplaceLabel;
|
||||
EditReplace.AnchorSideTop.Side := asrCenter;
|
||||
EditReplace.AnchorSideRight.Control := PanelButtons;
|
||||
|
||||
DirectionRadioGroup.Anchors := [akTop, akLeft, akRight, akBottom];
|
||||
DirectionRadioGroup.AnchorSideLeft.Control := FlagPanel;
|
||||
DirectionRadioGroup.AnchorSideLeft.Side := asrBottom;
|
||||
DirectionRadioGroup.AnchorSideTop.Control := FlagPanel;
|
||||
DirectionRadioGroup.AnchorSideRight.Control := PanelButtons;
|
||||
DirectionRadioGroup.AnchorSideBottom.Control := FlagPanel;
|
||||
DirectionRadioGroup.AnchorSideBottom.Side := asrBottom;
|
||||
|
||||
FlagPanel.AnchorSideLeft.Control := TextLabel;
|
||||
FlagPanel.AnchorSideTop.Control := ReplaceLabel;
|
||||
FlagPanel.AnchorSideTop.Side := asrBottom;
|
||||
|
||||
FindMoreButton.BorderSpacing.Top := 10;
|
||||
FindMoreButton.Anchors := [akTop, akRight];
|
||||
FindMoreButton.AnchorSideTop.Control := PanelButtons;
|
||||
FindMoreButton.AnchorSideRight.Control := PanelButtons;
|
||||
FindMoreButton.AnchorSideRight.Side := asrBottom;
|
||||
|
||||
ReplaceButton.BorderSpacing.Top := 10;
|
||||
ReplaceButton.AnchorSideLeft.Side := asrBottom;
|
||||
ReplaceButton.AnchorSideTop.Control := FindMoreButton;
|
||||
ReplaceButton.AnchorSideTop.Side := asrBottom;
|
||||
ReplaceButton.AnchorSideRight.Control := PanelButtons;
|
||||
ReplaceButton.AnchorSideRight.Side := asrBottom;
|
||||
ReplaceButton.Anchors := [akTop, akRight];
|
||||
|
||||
ReplaceAllButton.BorderSpacing.Top := 10;
|
||||
ReplaceAllButton.AnchorSideLeft.Side := asrBottom;
|
||||
ReplaceAllButton.AnchorSideTop.Control := ReplaceButton;
|
||||
ReplaceAllButton.AnchorSideTop.Side := asrBottom;
|
||||
ReplaceAllButton.AnchorSideRight.Control := PanelButtons;
|
||||
ReplaceAllButton.AnchorSideRight.Side := asrBottom;
|
||||
ReplaceAllButton.Anchors := [akTop, akRight];
|
||||
|
||||
CancelButton.BorderSpacing.Bottom := 10;
|
||||
CancelButton.AnchorSideLeft.Side := asrBottom;
|
||||
CancelButton.AnchorSideTop.Side := asrBottom;
|
||||
CancelButton.AnchorSideRight.Control := PanelButtons;
|
||||
CancelButton.AnchorSideRight.Side := asrBottom;
|
||||
CancelButton.AnchorSideBottom.Control := HelpButton;
|
||||
CancelButton.Anchors := [akRight, akBottom];
|
||||
|
||||
HelpButton.AnchorSideLeft.Control := PanelButtons;
|
||||
HelpButton.AnchorSideRight.Control := PanelButtons;
|
||||
HelpButton.AnchorSideRight.Side := asrBottom;
|
||||
HelpButton.AnchorSideBottom.Control := PanelButtons;
|
||||
HelpButton.AnchorSideBottom.Side := asrBottom;
|
||||
HelpButton.Anchors := [akLeft, akRight, akBottom];
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TReplaceDialog }
|
||||
|
||||
procedure TReplaceDialog.ReplaceClick(Sender: TObject);
|
||||
@ -56,8 +516,7 @@ end;
|
||||
|
||||
function TReplaceDialog.CreateForm: TForm;
|
||||
begin
|
||||
// do not use Self as Owner, otherwise as desgntime this will not work
|
||||
Result := TReplaceDialogForm.Create(nil);
|
||||
Result := TReplaceDialogForm.CreateNew(Self,Options);
|
||||
with TReplaceDialogForm(Result) do
|
||||
begin
|
||||
FindMoreButton.Caption := rsFindMore;
|
||||
|
544
lcl/lclbase.lpk
544
lcl/lclbase.lpk
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user