Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

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(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
2266180
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kiers

ASKER

Thanks for the help.

Greetings,

Peter Kiers