Delphi 7: How to close a child form by double clicking on it
Posted on 2009-07-07
I have a form that pops up to invite the user to select from a list of options. The list is displayed as a grid inside a form. I want the user to be able to double click one of the rows to select that item and automatically close the child form that displays the grid.
I can work out how to generate the doubleclick event. In the Delphi 7 IDE I can get it to generate the following code for the child form:
procedure TForm4.NextGrid1DblClick(Sender: TObject);
However I am not sure how to make the child form return control to the parent form.
If I just click an OK button on the child form I can grab the user's selection with this code:
if (Form4.showmodal = mrOK) then
How can I achieve a similar thing by double clicking.
In Visual C++ I could send a windows message with WM_CLOSE but I'm not sure how suitable this is in Delphi.