?
Solved

Identifying which event was used?

Posted on 1999-09-11
7
Medium Priority
?
138 Views
Last Modified: 2012-05-05
I am using Delphi 1, with a TListBox component.  I have a procedure that is called when a OnClick or a OnDoubleClick event occurs.

My question is, within this procedure, is it possible to determine WHICH EVENT called the procedure?  I.e., did the OnClick or did the OnDoubleClick call the procedure?
0
Comment
Question by:Softtech
[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
  • 3
  • 3
7 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 200 total points
ID: 2039557
Not directly, no. If you have fairly common code for the two events use two event handlers which call another procedure which performs the work, like this:

procedure doit(sender : tobject; WasDblClick : Boolean);
begin
  if WasDblClick then ...

....
end;

procedure form1.listbox1click(Sender : TObject);
begin
  Doit(Sender, false);
end;

procedure form1.listbox1dblclick(Sender : TObject);
begin
  Doit(Sender, true);
end;

You need to be aware that a double click will produce a single click event as well.

Cheers,

Raymond.
0
 
LVL 15

Expert Comment

by:simonet
ID: 2039559
You don't. You have to create separate Event handlers for each one. From each event you can then call the routine you're written so you can reuse the code you've written in both procedures.

Yours,

Alex
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2039564
Snap!

Cheers,
Raymond.

PS: How's the weather in sunny Brazil?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 15

Expert Comment

by:simonet
ID: 2039565
Pretty fast, Ray.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2039566
You're no snail yourself Alex!
0
 
LVL 15

Expert Comment

by:simonet
ID: 2039573
>How's the weather in sunny Brazil?

The sunny weather here is very cloudy, Ray! ;-) Not good enough for a bar-b-q outside, but I hope tomorrow is better. Perhaps I might even have a bar-b-q after the F1 GP tomorrow, if Barrichelo doesn't let us down once more.

Take care, Ray

Alex

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6867982
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

718 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