mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 22:40:30 +02:00
+ Cut/Copy/Paste added to TEditorInputLine
This commit is contained in:
parent
405bc99c16
commit
09b12ce0ad
@ -6809,11 +6809,12 @@ end;
|
||||
|
||||
procedure TEditorInputLine.HandleEvent(var Event : TEvent);
|
||||
var
|
||||
s : string;
|
||||
s,s2 : string;
|
||||
i : longint;
|
||||
begin
|
||||
If (Event.What=evKeyDown) and
|
||||
(Event.KeyCode=kbRight) and
|
||||
If (Event.What=evKeyDown) then
|
||||
begin
|
||||
if (Event.KeyCode=kbRight) and
|
||||
(CurPos = Length(Data^)) and
|
||||
Assigned(FindReplaceEditor) then
|
||||
Begin
|
||||
@ -6831,6 +6832,64 @@ begin
|
||||
Inherited HandleEvent(Event);
|
||||
End;
|
||||
end;
|
||||
ClearEvent(Event);
|
||||
End
|
||||
else if (Event.KeyCode=kbShiftIns) and
|
||||
Assigned(Clipboard) and (Clipboard^.ValidBlock) then
|
||||
{ paste from clipboard }
|
||||
begin
|
||||
i:=Clipboard^.SelStart.Y;
|
||||
s:=Clipboard^.GetDisplayText(i);
|
||||
i:=Clipboard^.SelStart.X;
|
||||
if i>0 then
|
||||
s:=copy(s,i+1,high(s));
|
||||
if (Clipboard^.SelStart.Y=Clipboard^.SelEnd.Y) then
|
||||
begin
|
||||
i:=Clipboard^.SelEnd.X-i;
|
||||
s:=copy(s,1,i);
|
||||
end;
|
||||
for i:=1 to length(s) do
|
||||
begin
|
||||
s2:=Data^+s[i];
|
||||
If not assigned(validator) or
|
||||
Validator^.IsValidInput(s2,False) then
|
||||
Begin
|
||||
Event.What:=evKeyDown;
|
||||
Event.CharCode:=s[i];
|
||||
Event.Scancode:=0;
|
||||
Inherited HandleEvent(Event);
|
||||
End;
|
||||
end;
|
||||
ClearEvent(Event);
|
||||
end
|
||||
else if (Event.KeyCode=kbCtrlIns) and
|
||||
Assigned(Clipboard) then
|
||||
{ Copy to clipboard }
|
||||
begin
|
||||
s:=GetStr(Data);
|
||||
s:=copy(s,selstart+1,selend-selstart);
|
||||
Clipboard^.SelStart:=Clipboard^.CurPos;
|
||||
Clipboard^.InsertText(s);
|
||||
Clipboard^.SelEnd:=Clipboard^.CurPos;
|
||||
ClearEvent(Event);
|
||||
end
|
||||
else if (Event.KeyCode=kbShiftDel) and
|
||||
Assigned(Clipboard) then
|
||||
{ Cut to clipboard }
|
||||
begin
|
||||
s:=GetStr(Data);
|
||||
s:=copy(s,selstart+1,selend-selstart);
|
||||
Clipboard^.SelStart:=Clipboard^.CurPos;
|
||||
Clipboard^.InsertText(s);
|
||||
Clipboard^.SelEnd:=Clipboard^.CurPos;
|
||||
s2:=GetStr(Data);
|
||||
{ now remove the selected part }
|
||||
Event.keyCode:=kbDel;
|
||||
inherited HandleEvent(Event);
|
||||
ClearEvent(Event);
|
||||
end
|
||||
else
|
||||
Inherited HandleEvent(Event);
|
||||
End
|
||||
else
|
||||
Inherited HandleEvent(Event);
|
||||
@ -6914,7 +6973,7 @@ var R,R1,R2: TRect;
|
||||
D: PDialog;
|
||||
Control : PView;
|
||||
IL1: PEditorInputLine;
|
||||
IL2: PInputLine;
|
||||
IL2: PEditorInputLine;
|
||||
CB1: PCheckBoxes;
|
||||
RB1,RB2,RB3: PRadioButtons;
|
||||
begin
|
||||
@ -7001,7 +7060,7 @@ function CreateGotoLineDialog(Info: pointer): PDialog;
|
||||
var D: PDialog;
|
||||
R,R1,R2: TRect;
|
||||
Control : PView;
|
||||
IL: PInputLine;
|
||||
IL: PEditorInputLine;
|
||||
begin
|
||||
R.Assign(0,0,40,7);
|
||||
New(D, Init(R, dialog_gotoline));
|
||||
@ -7191,7 +7250,10 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.38 2002-12-17 13:48:28 pierre
|
||||
Revision 1.39 2002-12-18 01:18:10 pierre
|
||||
+ Cut/Copy/Paste added to TEditorInputLine
|
||||
|
||||
Revision 1.38 2002/12/17 13:48:28 pierre
|
||||
* fix web bug 2012
|
||||
|
||||
Revision 1.37 2002/12/16 15:13:58 pierre
|
||||
|
Loading…
Reference in New Issue
Block a user