Solved

Close form on a doubleclick

Posted on 1997-12-03
1
147 Views
Last Modified: 2010-04-04
When I click the OK button, the form is closed, returning a mrOK. I want to do the same when a TListBox element is double-clicked. I thought to do that the following way:

When the OK button is pressed, the procedure OKBtnClick is called. When an element in the listbox is double clicked, the following procedure is called:

   procedure x.OnBoxDblClick (Sender: TObject);
   begin
      OKBtnClick(Sender)
   end;

However when I do this, the form is not closed. What am I doing wrong?
0
Comment
Question by:ble
1 Comment
 
LVL 5

Accepted Solution

by:
julio011597 earned 100 total points
ID: 1352794
That's because your OK button has a ModalResult property which is not related to its handler.

To do the same with your ListBox change its handler to something like this:

--//--
procedure x.OnBoxDblClick(Sender: TObject);
begin
  OKBtnClick(Sender); // or any other code
  ModalResult := True;
end;
--//--

Look for ModalResult Property into the Delphi Help File.

Regards.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

19 Experts available now in Live!

Get 1:1 Help Now