Recent

Author Topic: [solved] Datamodule not in project  (Read 202 times)

WimS

  • Newbie
  • Posts: 3
[solved] Datamodule not in project
« on: July 14, 2020, 07:43:35 pm »
Fresh install Windows 10 64bit, Lazarus v2.0.10r63526

File new Application.
File new form (unit2 below)
file new datamodule (unit3 below)
then save.
Result:

program project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms, Unit1, Unit2, Unit3
  { you can add units after this };

{$R *.res}

begin
  RequireDerivedFormResource:=True;
  Application.Scaled:=True;
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.

Problem: the datamodule form is not created. (Application.CreateForm)
Tested on 2 PC's result the same, what I doing wrong? (I did it manual and then everything is OK)

best regards
WimS
« Last Edit: July 14, 2020, 10:29:34 pm by WimS »

TRon

  • Sr. Member
  • ****
  • Posts: 423
Re: Datamodule not in project
« Reply #1 on: July 14, 2020, 08:08:53 pm »
@WimS
Lazarus IDE -> Menu -> Project -> Project Options. Treeview in Dialog: Project options -> Forms.

There you can see a list of Auto-created forms and Available forms. Is your datamodule listed there ?

I have no idea if there is a setting/option especially for datamodules that could turn on/off auto-creation.

howardpc

  • Hero Member
  • *****
  • Posts: 3487
Re: Datamodule not in project
« Reply #2 on: July 14, 2020, 08:13:23 pm »
Alternatively, you can manually add a
Code: Pascal  [Select][+][-]
  1. Application.CreateForm(TDataModule1, DataModule1);
line to your project's .lpr

WimS

  • Newbie
  • Posts: 3
Re: Datamodule not in project
« Reply #3 on: July 14, 2020, 08:17:26 pm »
The Datamodule was at available forms and I moved it to auto-creation.
Thank you very much, now it is working.

TRon

  • Sr. Member
  • ****
  • Posts: 423
Re: Datamodule not in project
« Reply #4 on: July 14, 2020, 08:37:04 pm »
@WimS:
Ok, Thank you for reporting back.

Happy coding !

PS: could you do us a favour and edit your first post and insert [solved] before your original topic-subject ? That way people know your issue was solved without the need to read the thread. It is common courtesy to do it, although not mandatory.

 

TinyPortal © 2005-2018