Solved

How can I trigger the procedure of a component ?

Posted on 2008-10-22
2
153 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
ID: 22778882

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

  Image1Click(Image1);

end;

Open in new window

0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 31508837
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

25 Experts available now in Live!

Get 1:1 Help Now