How To: Multiple Forms

Help
carolos
2007-07-30
2013-04-23
  • carolos
    carolos
    2007-07-30

    After making your first form etc.

    1. Create a New Form in Lazarus.
    2. Place a TKOLForm component on the new form.
    3. In Lazarus go to "Project->Project Options..." and select the "Forms" tab.
    4. Make sure only your main form is in the "Auto-create forms:" list.
    5. Use the following code when you want to show the form, and alter as necessary.
      NewForm2(Form2, Pointer( Applet ));
      Form2.Form.ShowModal;
      Form.Show;//Display your main form after other form closes.
      Form2.Form.Free; 

    P.S. Thanks to Yury for answering my questions.

     
    • jura
      jura
      2007-07-30

      Update. The following code is enough to dynamically show other form:

      NewForm2(Form2, Applet);
      Form2.Form.ShowModal;
      Form2.Form.Free;