Hello,
I want to disable all the controls that are on the specific panel (buttons, edits, etc.) while i read data from server. For that reason i use:
TPanel.Enabled := False
And reenable it after reading is finished. If i click on any disabled button while panel is disabled, its event is fired after the panel is reanabled. Is it normal behavior, or am i doing something wrong? My code looks like that:
procedure TfrmPanel.FormShow(Sender: TObject);
begin
fTCPClient := TIdTCPClient.Create;
fTCPClient.Host := IP;
fTCPClient.Port := Port;
try
fTCPClient.Connect;
except on E: Exception do
//Handle exception
end;
end;
procedure TfrmPanel.btnWriteASCII_ShrtClick(Sender: TObject);
var
myStr: string;
i: Integer;
begin
pnl3.Enabled := False;
myStr := '';
try
if fTCPClient.Connected then
begin
fTCPClient.IOHandler.WriteLn('set OutputType=ASCII_SHORT');
if fTCPClient.IOHandler.InputBufferIsEmpty then
begin
for i := 0 to 1 do
myStr := myStr + fTCPClient.IOHandler.WaitFor(Char($0A), True, False, IndyTextEncoding_ASCII, 5000);
end;
end;
finally
begin
mmo1.Lines.Add(myStr);
pnl3.Enabled := True;
end;
end;
end;