Peter Kiers
asked on
SELF and SENDER problem
Dear Experts,
I have a procedure called: Connect1Click(Sender: TObject);
That procedure is called often in the procedure below:
procedure Tscreenf.New1Click(Sender: TObject);
begin
if IsModified then
begin
case MessageDlg('Do you want to save the current file?', mtConfirmation,
[mbYes, mbNo, mbCancel], 0) of
mrYes:
begin
Save1Click(Sender);
if SocOpen then Warning1
else begin
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(sender); <--------------------
end;
end;
mrNo:
begin
if SocOpen then Warning1
else begin
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(sender); <--------------------
end;
end;
mrCancel: ;
end;
end
else
if socOpen then Warning1
else begin
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(sender); <--------------------
end;
end;
But when I want to call for procedure Connect1Click(Sender: TObject);
in the procedure below:
begin
if (Application.MessageBox(PC har('You must disconnect host ' +
ConnectHostName + ' before opening another connection.' + #10 + #13 +
'Do you want to disconnect?'),
'Access2All',
MB_YESNO + MB_DEFBUTTON1 + MB_ICONEXCLAMATION) = ID_YES) then
begin
Disconnect;
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(self); <-----------------
end;
end;
i get an error: [Error] Main.pas(375): Undeclared identifier: 'sender'
When I use SELF instead of SENDER it works, what's the diffirence?
greetings,
Peter Kiers
I have a procedure called: Connect1Click(Sender: TObject);
That procedure is called often in the procedure below:
procedure Tscreenf.New1Click(Sender:
begin
if IsModified then
begin
case MessageDlg('Do you want to save the current file?', mtConfirmation,
[mbYes, mbNo, mbCancel], 0) of
mrYes:
begin
Save1Click(Sender);
if SocOpen then Warning1
else begin
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(sender); <--------------------
end;
end;
mrNo:
begin
if SocOpen then Warning1
else begin
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(sender); <--------------------
end;
end;
mrCancel: ;
end;
end
else
if socOpen then Warning1
else begin
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(sender); <--------------------
end;
end;
But when I want to call for procedure Connect1Click(Sender: TObject);
in the procedure below:
begin
if (Application.MessageBox(PC
ConnectHostName + ' before opening another connection.' + #10 + #13 +
'Do you want to disconnect?'),
'Access2All',
MB_YESNO + MB_DEFBUTTON1 + MB_ICONEXCLAMATION) = ID_YES) then
begin
Disconnect;
LoadOptions(CfgFile);
CurrentFile := CfgFile;
Connect1Click(self); <-----------------
end;
end;
i get an error: [Error] Main.pas(375): Undeclared identifier: 'sender'
When I use SELF instead of SENDER it works, what's the diffirence?
greetings,
Peter Kiers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Greetings,
Peter Kiers