Solved

Responding to events in another form

Posted on 2004-10-13
2
149 Views
Last Modified: 2010-04-05
I have 2 forms in my  application.

FORM1 launches FORM2 which has a TButton.

What is the best way to enable code in FORM1 to respond to the click event of the TButton in FORM2?
0
Comment
Question by:ziche
2 Comments
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 50 total points
ID: 12297141
at Form1's code:

type
  TForm1 = class(TForm);
  public
    ...
    procedure Form2ButtonClicked(Sender: TObject);
  end;

...

procedure TForm1.Form2ButtonClicked(Sender: TObject);
begin
  ShowMessage('Button at Form 2 clicked!');
end;

procedure TForm1.CreateForm2;
begin
  with TForm2.Create(Self) do
  begin
    Button1.OnClick := Form2ButtonClicked;
    Show;
  end;
end;
0
 

Author Comment

by:ziche
ID: 12298440
beautiful man!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 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