Solved

Responding to events in another form

Posted on 2004-10-13
2
151 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

Independent Software Vendors: 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!

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…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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