Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can I access the events of a component created at run time.

Posted on 2009-07-13
2
Medium Priority
?
222 Views
Last Modified: 2012-05-07
I have created indy idSmtp atb runtime but need to display the status supplied by the onstatus event
0
Comment
Question by:gerhard9121
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
SteveBay earned 2000 total points
ID: 24842570
You will need to subclass it in order to have access to the protected event procedures
It should look something like this:
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
  IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP;
 
type TMySmtp = class(TIdSMTP);
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
     MySMTP : TMySmtp;
    procedure MySMTPStatus(ASender: TObject; const AStatus: TIdStatus; const AStatusText: string);
    { Private declarations }
  public
 
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.FormCreate(Sender: TObject);
begin
     MySMTP := TMySmtp.Create(Self);
     MySMTP.OnStatus := MySMTPStatus;
end;
 
procedure TForm1.MySMTPStatus(ASender: TObject; const AStatus: TIdStatus;  const AStatusText: string);
begin
     // do Status stuff
end;
 
end.

Open in new window

0
 

Author Closing Comment

by:gerhard9121
ID: 31602901
Thanks a lot. Easy as falling of a log - as long as you know how to
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question