Solved

Close form on a doubleclick

Posted on 1997-12-03
1
151 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 108
Simple Delphi Question 9 90
Delphi : could not find program, '...exe' 2 171
Mobile Keyboard covers the display of the TMemo 3 88
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 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