How can I get Delphi to wait for a form to close before continuing to execute code in another form?

My program has to search through a CSV file line by line and if a unique item is found, another form needs to be opened asking the user for more information on this item to store in a file before continuing to search the CSV file. I have browsed around looking for an answer and the only thing that I can find is showmodal which closes the pop-up form after it's finished. I need to keep the form open in case there is another unique item. I have also tried having a repeat, until loop which repeats until the value of a certain variable is changed by the pop-up form, allowing the program to continue when the pop-up form is hidden. This, however, does not seem to work and causes the pop-up form to be blank and unusable. Help please!

Answers


another form needs to be opened asking the user for more information on this item to store in a file before continuing

This is what called "Modal Window"

Hence it is displayed by .ShowModal method.

if ItemFound then begin
  user_info := false;
  user_prompt := CreateMessageDialog(... 'answer me!' );
  try
    user_choice := user_prompt.ShowModal();
    if IsPositiveResult(user_choice) then begin
       user_Var_1 := Trim(user_prompt.Edit1.Text);
       user_Var_2 := user_prompt.ListBox1.ItemIndex;
       ....
       user_info := True;
    end. 
  finally
    user_prompt.Destroy;
  end;
  if user_info then begin
    ...
  end;
end;

Read manuals:


Need Your Help

Localizing strings in a dynamically created CheckBoxList control

asp.net localization checkboxlist

I have a basic dynamically created Checkbox list in an ascx user control in an asp.net 4 project. Right now it is used to add a list of possible roles (for example, admin, officer, customer) to the

PHP pagination class

php mysql class pagination pager

I am looking for a php pagination class, I have used a rather simple one in the past and it is no longer supported.