Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Unit ohne Formular (https://www.delphipraxis.net/72330-unit-ohne-formular.html)

xthing 28. Jun 2006 17:42


Unit ohne Formular
 
Hi Leute,

ich habe eine Unit ohne Formular erstellt. Eine einfache Unit3 eben. In dieser Unit ist eine Klasse TCalc enthalten. Bei der Übersetzung aber, meldet der Compiler >> [Error] File not found: 'Unit3.dfm' <<. Könnt ihr mir sagen, was die Ursache ist?

Danke für Eure Hilfe.
xthing

EDatabaseError 28. Jun 2006 17:45

Re: Unit ohne Formular
 
Du musst im Projectfile die Unit mit Formular löschen und nur über uses (in der unit mit dem Aufruf)einfügen.

xthing 29. Jun 2006 07:07

Re: Unit ohne Formular
 
@EDatabaseError

Hi,

danke , das habe ich gemacht. Funktioniert aber trotzdem nicht. Mein Projektfile sieht so aus:

Delphi-Quellcode:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {DataModule2: TDataModule},
  Unit3,
  Unit4,
  Unit5;

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TDataModule2, DataModule2);
  Application.Run;
end.
Was muss ich nun, wo ändern?

Danke noch mal.
xthing

Matze 29. Jun 2006 07:12

Re: Unit ohne Formular
 
Hi,

es müsste so in der Art ausschauen:

Delphi-Quellcode:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2},
  Unit3 in 'Unit3.pas';

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.
'Unit3.pas' benötigst du im Projekt-Quelltext natürlich auch. Woher soll Delphi sonst wissen, was deine Unit 3 ist? ;)

Doch eigentlich macht Delphi das automatisch.

Angel4585 29. Jun 2006 07:13

Re: Unit ohne Formular
 
Geh doch einfach auf "Datei"->"Neu"->"Unit" und kopier in diese neue Unit dein Quelltext rein ;)

Kann es sein das du einen neue Form erstelt hast un da einfach das TForm rausgelöscht hast?

xthing 30. Jun 2006 09:36

Re: Unit ohne Formular
 
Danke, Ihr habt mir geholfen...

Xthing

Muetze1 30. Jun 2006 09:46

Re: Unit ohne Formular
 
@Matze: hä? Warum sollte man den Dateinamen angeben? Schliesslich ist der Unitname entscheidend und der endet nunmal auf .pas.

Und er verlangt die DFM, wenn ein Compilerdefine zur Einbindung von dieser noch in der Unit ist:
Delphi-Quellcode:
{$R *.dfm}
. Dies kommt vor allem vor, wenn die Form nachträglich aus der Unit rausgelöscht wurde - wie schon vermutet.


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:03 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz