• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

Identifying which event was used?

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
Softtech
Asked:
Softtech
  • 3
  • 3
1 Solution
 
rwilson032697Commented:
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
 
simonetCommented:
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
 
rwilson032697Commented:
Snap!

Cheers,
Raymond.

PS: How's the weather in sunny Brazil?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
simonetCommented:
Pretty fast, Ray.
0
 
rwilson032697Commented:
You're no snail yourself Alex!
0
 
simonetCommented:
>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
 
MoondancerCommented:
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

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now