?
Solved

How can I trigger the procedure of a component ?

Posted on 2008-10-22
2
Medium Priority
?
158 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
[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:
SteveBay earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

771 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