Solved

How can I trigger the procedure of a component ?

Posted on 2008-10-22
2
152 Views
Last Modified: 2013-11-23
I need to do this:

I have a showmessage in the Image1Click, when I click on the component it returns me the name of my Image1.

The problem is that I need to trigger this onclick of the image component from another place, but it doesn't return the image1 name anymore, I need to simulate or trigger this as if I had click on the component.

did you get it?




unit Unit1;
 

interface
 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls, Buttons, ExtCtrls;
 

type

  TForm1 = class(TForm)

    Image1: TImage;

    BitBtn1: TBitBtn;

    procedure Image1Click(Sender: TObject);

    procedure BitBtn1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;
 

var

  Form1: TForm1;
 

implementation
 

{$R *.dfm}
 

procedure TForm1.Image1Click(Sender: TObject);

begin

//  showmessage('ok');

  ShowMessage((sender as TImage).Name )

end;
 

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

  Image1.OnClick(self)

end;
 

end.

Open in new window

0
Comment
Question by:hidrau
2 Comments
 
LVL 14

Accepted Solution

by:
SteveBay earned 500 total points
Comment Utility

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

  Image1Click(Image1);

end;

Open in new window

0
 
LVL 1

Author Closing Comment

by:hidrau
Comment Utility
thanks
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

10 Experts available now in Live!

Get 1:1 Help Now