add btn to kill current process in the procinput widget

This commit is contained in:
Basile Burg 2016-03-26 04:59:51 +01:00
parent 1e73d618b5
commit 5da8863db3
2 changed files with 24 additions and 3 deletions

View File

@ -44,7 +44,7 @@ inherited CEProcInputWidget: TCEProcInputWidget
Left = 0 Left = 0
Height = 26 Height = 26
Top = 2 Top = 2
Width = 556 Width = 528
Align = alClient Align = alClient
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
@ -52,7 +52,7 @@ inherited CEProcInputWidget: TCEProcInputWidget
TabOrder = 0 TabOrder = 0
end end
object btnClose: TBitBtn object btnClose: TBitBtn
Left = 584 Left = 556
Height = 30 Height = 30
Hint = 'close the process input stream' Hint = 'close the process input stream'
Top = 0 Top = 0
@ -64,7 +64,7 @@ inherited CEProcInputWidget: TCEProcInputWidget
TabOrder = 1 TabOrder = 1
end end
object btnSend: TBitBtn object btnSend: TBitBtn
Left = 556 Left = 528
Height = 30 Height = 30
Hint = 'send the text to hte process' Hint = 'send the text to hte process'
Top = 0 Top = 0
@ -75,6 +75,18 @@ inherited CEProcInputWidget: TCEProcInputWidget
Spacing = 0 Spacing = 0
TabOrder = 2 TabOrder = 2
end end
object btnKill: TBitBtn
Left = 584
Height = 30
Hint = 'kill the process'
Top = 0
Width = 28
Align = alRight
Layout = blGlyphBottom
OnClick = btnKillClick
Spacing = 0
TabOrder = 3
end
end end
end end
end end

View File

@ -15,11 +15,13 @@ type
TCEProcInputWidget = class(TCEWidget, ICEProcInputHandler) TCEProcInputWidget = class(TCEWidget, ICEProcInputHandler)
btnClose: TBitBtn; btnClose: TBitBtn;
btnKill: TBitBtn;
btnSend: TBitBtn; btnSend: TBitBtn;
Panel1: TPanel; Panel1: TPanel;
txtInp: TEdit; txtInp: TEdit;
txtExeName: TStaticText; txtExeName: TStaticText;
procedure btnCloseClick(Sender: TObject); procedure btnCloseClick(Sender: TObject);
procedure btnKillClick(Sender: TObject);
procedure btnSendClick(Sender: TObject); procedure btnSendClick(Sender: TObject);
procedure txtInpKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure txtInpKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
private private
@ -64,6 +66,7 @@ begin
fMru.Insert(0, '(your input here)'); fMru.Insert(0, '(your input here)');
AssignPng(btnClose, 'pencil_delete'); AssignPng(btnClose, 'pencil_delete');
AssignPng(btnSend, 'pencil_go'); AssignPng(btnSend, 'pencil_go');
AssignPng(btnKill, 'cancel');
end; end;
destructor TCEProcInputWidget.destroy; destructor TCEProcInputWidget.destroy;
@ -145,6 +148,12 @@ begin
fProc.CloseInput; fProc.CloseInput;
end; end;
procedure TCEProcInputWidget.btnKillClick(Sender: TObject);
begin
if fProc.isNotNil then
fProc.Terminate(0);
end;
procedure TCEProcInputWidget.txtInpKeyDown(Sender: TObject; var Key: Word; procedure TCEProcInputWidget.txtInpKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState); Shift: TShiftState);
begin begin