mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 02:30:15 +02:00
MG: keydown events added
git-svn-id: trunk@271 -
This commit is contained in:
parent
ddb43ba20d
commit
d61cf75ddc
@ -39,8 +39,8 @@ type
|
||||
published
|
||||
TextToFindLabel:TLabel;
|
||||
ReplaceWithLabel:TLabel;
|
||||
TextToFindComboBox:TComboBox;
|
||||
ReplaceTextComboBox:TComboBox;
|
||||
TextToFindEdit:TEdit;
|
||||
ReplaceTextEdit:TEdit;
|
||||
OptionsGroupBox:TGroupBox;
|
||||
CaseSensitiveCheckBox:TCheckBox;
|
||||
WholeWordsOnlyCheckBox:TCheckBox;
|
||||
@ -52,7 +52,7 @@ type
|
||||
OkButton:TButton;
|
||||
ReplaceAllButton:TButton;
|
||||
CancelButton:TButton;
|
||||
procedure TextToFindComboBoxKeyDown(Sender: TObject; var Key:Word;
|
||||
procedure TextToFindeditKeyDown(Sender: TObject; var Key:Word;
|
||||
Shift:TShiftState);
|
||||
procedure OkButtonClick(Sender:TObject);
|
||||
procedure ReplaceAllButtonClick(Sender:TObject);
|
||||
@ -104,29 +104,29 @@ begin
|
||||
Show;
|
||||
end;
|
||||
|
||||
TextToFindComboBox:=TComboBox.Create(Self);
|
||||
with TextToFindComboBox do begin
|
||||
Name:='TextToFindComboBox';
|
||||
TextToFindEdit:=TEdit.Create(Self);
|
||||
with TextToFindEdit do begin
|
||||
Name:='TextToFindEdit';
|
||||
Parent:=Self;
|
||||
Left:=90;
|
||||
Top:=4;
|
||||
Width:=220;
|
||||
Height:=21;
|
||||
Text:='';
|
||||
OnKeyDown:=@TextToFindComboBoxKeyDown;
|
||||
OnKeyDown:=@TextToFindEditKeyDown;
|
||||
Show;
|
||||
end;
|
||||
|
||||
ReplaceTextComboBox:=TComboBox.Create(Self);
|
||||
with ReplaceTextComboBox do begin
|
||||
Name:='ReplaceTextComboBox';
|
||||
ReplaceTextedit:=Tedit.Create(Self);
|
||||
with ReplaceTextedit do begin
|
||||
Name:='ReplaceTextedit';
|
||||
Parent:=Self;
|
||||
Left:=90;
|
||||
Top:=28;
|
||||
Width:=220;
|
||||
Height:=21;
|
||||
Text:='';
|
||||
OnKeyDown:=@TextToFindComboBoxKeyDown;
|
||||
OnKeyDown:=@TextToFindeditKeyDown;
|
||||
Show;
|
||||
end;
|
||||
|
||||
@ -292,14 +292,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
fReplaceAllClickedLast:=false;
|
||||
TextToFindComboBox.SetFocus;
|
||||
TextToFindedit.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TLazFindReplaceDialog.TextToFindComboBoxKeyDown(
|
||||
procedure TLazFindReplaceDialog.TextToFindeditKeyDown(
|
||||
Sender: TObject; var Key:Word; Shift:TShiftState);
|
||||
begin
|
||||
// if (Key=VK_RETURN) then OkButtonClick(Sender);
|
||||
// if (Key=VK_ESCAPE) then CancelButtonClick(Sender);
|
||||
if (Key=VK_RETURN) then OkButtonClick(Sender);
|
||||
if (Key=VK_ESCAPE) then CancelButtonClick(Sender);
|
||||
end;
|
||||
|
||||
procedure TLazFindReplaceDialog.OkButtonClick(Sender:TObject);
|
||||
@ -334,7 +334,7 @@ begin
|
||||
then DirectionRadioGroup.ItemIndex:=0
|
||||
else DirectionRadioGroup.ItemIndex:=1;
|
||||
ReplaceAllButton.Enabled:=ssoReplace in NewOptions;
|
||||
ReplaceTextComboBox.Enabled:=ReplaceAllButton.Enabled;
|
||||
ReplaceTextedit.Enabled:=ReplaceAllButton.Enabled;
|
||||
ReplaceWithLabel.Enabled:=ReplaceAllButton.Enabled;
|
||||
PromptOnReplaceCheckBox.Enabled:=ReplaceAllButton.Enabled;
|
||||
if ssoReplace in NewOptions then begin
|
||||
@ -361,22 +361,22 @@ end;
|
||||
|
||||
function TLazFindReplaceDialog.GetFindText:AnsiString;
|
||||
begin
|
||||
Result:=TextToFindComboBox.Text;
|
||||
Result:=TextToFindedit.Text;
|
||||
end;
|
||||
|
||||
procedure TLazFindReplaceDialog.SetFindText(NewFindText:AnsiString);
|
||||
begin
|
||||
TextToFindComboBox.Text:=NewFindText;
|
||||
TextToFindedit.Text:=NewFindText;
|
||||
end;
|
||||
|
||||
function TLazFindReplaceDialog.GetReplaceText:AnsiString;
|
||||
begin
|
||||
Result:=ReplaceTextComboBox.Text;
|
||||
Result:=ReplaceTextedit.Text;
|
||||
end;
|
||||
|
||||
procedure TLazFindReplaceDialog.SetReplaceText(NewReplaceText:AnsiString);
|
||||
begin
|
||||
ReplaceTextComboBox.Text:=NewReplaceText;
|
||||
ReplaceTextedit.Text:=NewReplaceText;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -338,7 +338,8 @@ type
|
||||
Edit1 : TEdit;
|
||||
btnOK : TBitbtn;
|
||||
btnCancel : TBitBtn;
|
||||
Procedure GotoDialogActivate(sender : TObject);
|
||||
procedure Edit1KeyDown(Sender: TObject; var Key:Word;
|
||||
Shift:TShiftState);
|
||||
private
|
||||
public
|
||||
constructor Create(AOwner : TComponent); override;
|
||||
@ -403,10 +404,14 @@ end;
|
||||
Function TSourceEditor.GotoLine(Value : Integer) : Integer;
|
||||
Var
|
||||
P : TPoint;
|
||||
TopLine: integer;
|
||||
Begin
|
||||
P.X := 0;
|
||||
P.Y := Value;
|
||||
TopLine := P.Y - (FEditor.LinesInWindow div 2);
|
||||
if TopLine < 1 then TopLine:=1;
|
||||
FEditor.CaretXY := P;
|
||||
FEditor.TopLine := TopLine;
|
||||
Result:=FEditor.CaretY;
|
||||
end;
|
||||
|
||||
@ -777,7 +782,7 @@ Writeln('[ProcessUserCommand] --------------');
|
||||
if (GotoDialog.ShowModal = mrOK) then
|
||||
Begin
|
||||
try
|
||||
GotoLine(Strtoint(GotoDialog.Edit1.Text));
|
||||
GotoLine(StrToInt(GotoDialog.Edit1.Text));
|
||||
except
|
||||
GotoLine(0);
|
||||
end;
|
||||
@ -2617,8 +2622,9 @@ begin
|
||||
Top := 30;
|
||||
Width := self.width-40;
|
||||
Left := 5;
|
||||
Visible := True;
|
||||
Caption := '';
|
||||
OnKeyDown:=@Edit1KeyDown;
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
btnOK := TBitbtn.Create(self);
|
||||
@ -2641,15 +2647,16 @@ begin
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
OnActivate := @GotoDialogActivate;
|
||||
Edit1.SetFocus;
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TfrmGoto.GotoDialogActivate(sender : TObject);
|
||||
Begin
|
||||
Edit1.Text := '';
|
||||
Edit1.SetFocus;
|
||||
End;
|
||||
procedure TfrmGoto.Edit1KeyDown(Sender: TObject; var Key:Word;
|
||||
Shift:TShiftState);
|
||||
begin
|
||||
if (Key=VK_RETURN) then ModalResult:=mrOk;
|
||||
if (Key=VK_ESCAPE) then ModalResult:=mrCancel;
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
|
Loading…
Reference in New Issue
Block a user