Solved

Close form on a doubleclick

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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