procinput, added btn to close the input

This commit is contained in:
Basile Burg 2016-03-10 16:53:11 +01:00
parent 102a10f2e0
commit 495da4da2e
5 changed files with 115 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

BIN
icons/other/pencil_go.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

View File

@ -1909,6 +1909,70 @@ LazarusResources.Add('splitter','PNG',[
+#178'Km'#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#0#0'IEND'
+#174'B`'#130
]);
LazarusResources.Add('pencil_delete','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#2#151'IDATx'#218#132
+#146'MHTQ'#20#199#255#239'c'#166#194' '#10'4'#23#234#20'5j'#153#186#240#161
+'8'#22'Q-ZDa)'#209#166#133#144#163'} d'#155#10#23#209#166'MI'#14#153#229#128
+#155'rQ4DX'#18')2f'#13'4'#244#176'4'#164#15')'#24#191'j'#198#209'!g'#26'}'#31
+#247't'#159#17#154'e^8'#239'r'#223'{'#191#251'?'#231#252#143#16#237#172#196
+'pp'#12#146','#2#2#254'X'#2#24#236'4'#135#135#171'O'#128#216#12#142#193'E'#26
+#211'@'#146' h'#177')@'#20'!b'#133'E<'#24'c`&'#163'u'#133'NPV'#186#165'C'#191
+#197#196#149'`'#147#1#154'At'#230#228'i'#220'z'#211#134'd8'#142#209#184#9'Q'
+#16'IX)'#3'frX'#7']<'#158#13'Os'#27#14#236'?'#136'.'#214#11'}F'#135#17#13'C'
+#155#252#182#252#5#204'$'#24#28'.>'#156#129#148#161#11#168'r'#217#209#249#236
+'9'#242'r'#11#209#189#182#15#197'7k'#21'A'#148#255'}'#193'/'#152#168#244'H:'
+#16#153#6#166#147#216'<'#220#128#242'-'#17#244#6#130#240'\'#190#162#244#159
+#189#167#138#246#20#200#255#133#195'Q'#14#199#128'x'#2#144'm'#232#127#217#137
+#235#141'A'#229'i^'#154':'#218'S'#7#198#27')/n'#24#253#5's'#245#248'w@2'#209
+':'#180#13'5'#141'~'#229'IA'#166'jX'#150'['#13#20#132#133#18#24'['#14'6p{'
+#200#137#248#131#15#30#223#142#204#215'I"'#154'3'#137#184';-'#150#151#178'%m'
+#165#205';N'#174#165#176'h'#160#245#157#19'?|'#239'=e'#185#142#186#146#189
+#174#249'R`'#24'x'#213#23#168#253':'#198'] >$'#134'n'#144#171'<'#149#195#147
+#11#176#160#195';'#224'D'#205'5'#191#226'X#'#213#149#20#229#0#209#9#208#248
+'g'#190#143#163#164'0'#7#166'a'#212#202#196#229'w'#158#170#4'>v'#241#15#252
+#130'Db^'#217#130#221'M~'#165'#o'#147#170#145#14#236'9'#4#236#171'X'#152#246
+#30#31#232'Q7d^'#16'Ok#4'#199'Q'#216'G'#174'r'#229'9x'#223#230#192#237#233'U'
+#238'4'#236'V'#241'8'#196#187'+'#129#221'o'#1'ko'#226#165#242')'#148'$'#136
+'6;'#4#190'K'#185#249#165#151'&b'#2#178#211'd'#8#130#13'^?'#193'}'#227#133'r'
+#247#252'.uC'#199#8#200'&"b'#176#252'Dbv{'#198#250'U'#224'G0b'#8'|'#10'c4'
+#169#251#228'/a'#13#19#227'Al'#141#217'0;+'#195#221#28'P'#218#207#149#169'd'
+#229'*'#242#7#183#170'z0T'#239'-p`rP'#171#152#247#155#191#158#210'M_'#245'@'
+#168#222#250#173'h'#201','#169#203'Lw'#22#143#212'E'#231#8#143#208'O'#1#6#0
+#147#2'T'#143'Tr,'#27#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('pencil_go','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#2#138'IDATx'#218#132
+#147'KHTQ'#28#198#127#247'1'#142'9'#132#189' '#9#177#160#215#162'('#195'AP'
+#220#180#16#133#12')M4'#138#162#18'4'#131#182#229#162#141'!-'#2')'#208'\'#164
+'H'#132#187#177#135#145'`5f'#246#16'Q0'#132'P'#19#31'e'#133#227'k'#204#145
+#244#206#189#247'tf'#166'1'#147#196#3#135'{8'#156#223#255#255#157#239'|W'#153
+'~'#158#207'P'#215'74]'#5#133#127#134#130'M'#140'X'#226'Q'#236'%'#132'=O!'
+#233#194#176#13#132#166'('#134#127#6'T'#21#149'u'#134#144#211#182'ml'#203#22
+#241#135#247'"'#146#18'B}D'#180#153#186#30'l'#217'`'#152'B\)-'#163#182#183
+#158'_'#190#0#227#1#11'UQ'#133#178#158#2#219#146'p'#16'Q~v'#31'w'#171#235'9'
+#150'u'#156#23'v;'#193#249' '#230#180#15'cjb'#237#2#182'%0%'#156'z"'#17#215
+#167#235'\Hw'#210#210#218#193#193#253#201#188'r'#189'%'#181#166#196#173')'
+#250#255#11'D`!'#210'N&'#192#164#31'f'#23#217'5x'#131#130'$?'#31#222'|'#228
+'NE'#165'{'#160#196#211#19'g'#197#163#175#213'9'#12#251#164#211#179#178#192
+#207'E'#14#249''''#201#217'\N'#187#134''''#179#138#158'2-O'#190#209#10#19#197
+'jxr'#246#15#28#144'N'#10'b'#229#233'3i'#215#200'L&'#143' '#141'N'#19'\'#210
+#163'e'#5#182'-'#176#150'e'#207'P'#241#185#27#207'\ '#220'A'#147#213'U3'#20
+#140'8'#178#146'O'#163'j'#141'E'#157'C(1:Ez'#168'u'#168#179't\'#164#175#144
+#237#241#7'h*'#189#199'B'#176'E'#202'Se'#144#228#211#169'['#232#155'h$;'#229
+'<'#170#163#161#176's'#0#135'.dH'#204#160')2N'#237#144#240#148#132#231#194
+#178'5'#25#20#191#209'O'#247#232#211#191#254#136'f'#20#7#244#249#26#200'q_'
+#228'}'#127']'#158'*+'#139#140#203#249#18'\'#128'iY`~.'#20#31#28#154'\'#210
+#135'3'#158#240#140#217#8#142#13#242#206#177#145#239#179#190':'#204#0'^],'
+#133#156#216#142#177#179#128#152#175#183'%l'#240#176#247#0#234#182#177''''
+#149#15#188#185#138'4O'#200'k'#154#210#131's'#5#145#245#232'8'#180'w'#208#218
+'v'#147'R'#189#185#127'+'#9#198#24#217'G6Ab:'#247#31#15'Q\'#243#210'-+I9TD'
+#229'g'#221#162#219#225#130#193'A'#9#191#14#195'%'#185'U'#140#232'#>'#131#31
+#223#187#216#227'w'#176#184#168'S\'#253#206#221't'#245'hO'#237#238'6'#156#22
+'c'#161'W'#136'*'#24#254'"a/'#222'('#28#249'c!eU'#150'z'#214'Hw'#244#156#12#8
+#195#209#205#223#2#12#0'E'#236'9'#225'2Tm'#150#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('application','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#1#175'IDATx'#218#156

View File

@ -2,25 +2,25 @@ inherited CEProcInputWidget: TCEProcInputWidget
Left = 863
Height = 63
Top = 397
Width = 613
Width = 620
Caption = 'Process input'
ClientHeight = 63
ClientWidth = 613
ClientWidth = 620
inherited Back: TPanel
Height = 63
Width = 613
Width = 620
ClientHeight = 63
ClientWidth = 613
ClientWidth = 620
inherited Content: TPanel
Height = 63
Width = 613
Width = 620
ClientHeight = 63
ClientWidth = 613
ClientWidth = 620
object txtExeName: TStaticText[0]
Left = 4
Height = 22
Top = 4
Width = 605
Width = 612
Align = alTop
BorderSpacing.Around = 4
BorderStyle = sbsSunken
@ -32,36 +32,49 @@ inherited CEProcInputWidget: TCEProcInputWidget
Left = 4
Height = 30
Top = 30
Width = 605
Width = 612
Align = alTop
BorderSpacing.Around = 4
BevelOuter = bvNone
ClientHeight = 30
ClientWidth = 605
ClientWidth = 612
Enabled = False
TabOrder = 1
object btnSend: TButton
Left = 530
Height = 30
Top = 0
Width = 75
Align = alRight
BorderSpacing.Left = 4
Caption = 'Send'
OnClick = btnSendClick
TabOrder = 0
end
object txtInp: TEdit
Left = 0
Height = 26
Top = 2
Width = 526
Width = 556
Align = alClient
BorderSpacing.Top = 2
BorderSpacing.Bottom = 2
OnKeyDown = txtInpKeyDown
TabOrder = 0
end
object btnClose: TBitBtn
Left = 584
Height = 30
Hint = 'close the process input stream'
Top = 0
Width = 28
Align = alRight
Layout = blGlyphBottom
OnClick = btnCloseClick
Spacing = 0
TabOrder = 1
end
object btnSend: TBitBtn
Left = 556
Height = 30
Hint = 'send the text to hte process'
Top = 0
Width = 28
Align = alRight
Layout = blGlyphBottom
OnClick = btnSendClick
Spacing = 0
TabOrder = 2
end
end
end
end

View File

@ -6,18 +6,20 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Menus, StdCtrls, ce_widget, process, ce_common, ce_interfaces, ce_observer,
ce_mru;
Menus, StdCtrls, Buttons, ce_widget, process, ce_common, ce_interfaces,
ce_observer, ce_mru, ce_sharedres;
type
{ TCEProcInputWidget }
TCEProcInputWidget = class(TCEWidget, ICEProcInputHandler)
btnSend: TButton;
btnClose: TBitBtn;
btnSend: TBitBtn;
Panel1: TPanel;
txtInp: TEdit;
txtExeName: TStaticText;
procedure btnCloseClick(Sender: TObject);
procedure btnSendClick(Sender: TObject);
procedure txtInpKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
private
@ -58,6 +60,8 @@ begin
fMru.LoadFromFile(fname);
if fMru.Count = 0 then
fMru.Insert(0, '(your input here)');
AssignPng(btnClose, 'pencil_delete');
AssignPng(btnSend, 'pencil_go');
end;
destructor TCEProcInputWidget.destroy;
@ -113,6 +117,9 @@ procedure TCEProcInputWidget.sendInput;
var
inp: string;
begin
if fProc.Input.isNil or (fProc.Input.Handle = INVALID_HANDLE_VALUE) then
exit;
fMru.Insert(0,txtInp.Text);
fMruPos := 0;
if txtInp.Text <> '' then
@ -129,6 +136,13 @@ begin
sendInput;
end;
procedure TCEProcInputWidget.btnCloseClick(Sender: TObject);
begin
if fProc.isNotNil and fProc.Input.isNotNil and
(fProc.Input.Handle <> INVALID_HANDLE_VALUE) then
fProc.CloseInput;
end;
procedure TCEProcInputWidget.txtInpKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin