Solved

Responding to events in another form

Posted on 2004-10-13
2
152 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
[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:
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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month4 days, 3 hours left to enroll

630 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