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



Posted on 1999-10-08
Medium Priority
Last Modified: 2010-04-06
Hi all,

I'am basically writing a component which has the instance of another component as it private member. The component which is getting instantiated has an Event.. say OnFire()... My first objective is to have the Onfire event
in the new component and whatever data which is getting arrived on onFire event(private member compone.) it should be redirected to the new components method. so I cooly did this  TNewData = procedure(sender:TObject;data : Pchar);
    FonData : TOndata;

    property RevisedFire : TNewData read FOnData write FOnData;

   In the create I say

     RevisedFire := Instantiatedcomponent.OnFire;

The problem I face is that, the event is not getting fired in my
current component. The problem I found is the following statement in
my olf component(i.e., Onfire())

     if assigned(OnFire) then Onfire(self, data);

since the Onfire event is not mapped, if I'am not wrong(method pointer is nil this event is not getting fired)

  How to Assign the Onfire event from my method so that when the event
gets triggered in Instantiated compoenent, the data should get redirected to my new components event?

do we have any active faq about comp. design?...any sites please

Please Help me out...

Thanks in advance


Question by:rjagan
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
LVL 12

Accepted Solution

rwilson032697 earned 400 total points
ID: 2109323
This line:

RevisedFire := Instantiatedcomponent.OnFire;

Should read:

Instantiatedcomponent.OnFire := NewOnFireMethod;

Where NewOnFireMethod is a method of your new component. In this method you can do this:

procedure TMyComponent.NewOnFireMethod(Sender : Tobject);

  if assigned(RevisedFire) then RevisedFire(Sender);

Here is a page with a whole bunch of FAQs you may be interested in:


LVL 13

Expert Comment

ID: 2109331
I think this is what you need:

Instantiatedcomponent.OnFire := RevisedFire;

Author Comment

ID: 2109349
Hi Raymond,
    Thanks a lot for the immediate reply. I will try this
stuff and update you asap. So using this solution, its certainly not necessary to map the Instantiatedcomponent.Onfire method ...but just point that
method to my new method..Is that right..

So this code If Assigned(OnFire) in instantiated comp. will
work cool..

Thanks again...


Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 12

Expert Comment

ID: 2109365
Your instantiaed component should still do this:

     if assigned(OnFire) then Onfire(self, data);

because it needs to check it's event is valid. You need to do the similar check in the new component because that too might not be set (ie: this

  if assigned(RevisedFire) then RevisedFire(Sender);




Author Comment

ID: 2109407
Hi Raymond,
     That worked really cool...Thanks a lot :-).The site
is also good. But you see...I'am expecting a complete
faq in digest form to read about comp. design and things related to that offline..

I would also like to thank Epsylon also

Once more...thanks for the help..


Expert Comment

ID: 6854062
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

For experts interesting in helping the cleanup effort in their respective TAs, this link please:
Thank you,
Moderator @ Experts Exchange

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
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