Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SELF and SENDER problem

Avatar of Peter Kiers
Peter KiersFlag for Netherlands asked on
Delphi
2 Comments1 Solution267 ViewsLast Modified:
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(PChar('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
ASKER CERTIFIED SOLUTION
Avatar of 2266180
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers