Solved

How can I trigger the procedure of a component ?

Posted on 2008-10-22
2
154 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 91
JAudiorecorder record freezing the app 29 67
Delphi: making a BW image transparent 10 37
Delphi: sending SMS on android platform 1 19
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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