How Can I use Form´s Event by Component Code.

Posted on 2006-03-24
Last Modified: 2010-04-05
how Can I use:


I would like to do something on this events using a component.
Question by:rafaelrgl
    LVL 2

    Accepted Solution

    if the form owns the component then:

    procedure xxxx;
    var parent : Tcomponent;
    parent := aowner;
    while not(parent is TForm) and not(parent = parent.owner) do
      parent := parent.owner;
    if parent is tform then with (parent as tform) begin
      close; (closes form)
      show; (shows form)
      if assigned(onshow) then onshow(self); (runs onshow procedure)

    Hope this helps u.

    LVL 20

    Expert Comment

    by:Mark Brady
    or try something like this....

    procedure xxxxx;
    if something then
    form1.onclose(sender);  // then make sure there is something in the form1 onclose event.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now