Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Close form on a doubleclick

Posted on 1997-12-03
1
Medium Priority
?
159 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

715 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