Autor Beitrag
Sniky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 53



BeitragVerfasst: Mo 28.04.08 18:19 
Hallo Ihr Lieben,

ich weiß gar nicht wie ich das jetzt am besten schreiben soll.

Also ich versuch mal so zu erklären, dass man es auch versteht :)

Ich starte also mein Programm und dabei wird in meiner Main.pas ein HTTPServer gestartet. Soweit auch alles kein Problem nur wollte ich jetzt über mein hauptfenster denn HTTP server wieder stoppen.

In meiner Main.pas würde ich das ja so machen:
HTTPServer.active := false;

nur mach ich das jetzt in mein Hauptfenster also in die Unit1, kommt das:
[Error] Unit1.pas(457): Undeclared identifier: 'HTTPServer'

nur dachte ich, wenn ich: uses Main, md5; mache, ist die Main wie mit eingebunden und ich kann da dann auch meinen Server starten und stoppen... Wie kann ich es denn machen, dass meine Hauptseite jetzt weiß, dass ich denn HTTPServer in der Main.pas stoppen möchte?

Vielen Dank!

Liebe Grüße,
Sniky


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Mo 28.04.2008 um 19:28
Moderiert von user profile iconNarses: Titel geändert.
<TargeT>
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 59

Win XP, Win 98
Delphi 7
BeitragVerfasst: Mo 28.04.08 18:26 
Also in Form2 bindest du die MainUnit ein.

Dann zb: Main.HttpServer.Active:= false;

Also vor HttpServer muss die Unit auf der sich die Komponente befindet.

lg Target
Sniky Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 53



BeitragVerfasst: Mo 28.04.08 19:05 
user profile icon<TargeT> hat folgendes geschrieben:
Also in Form2 bindest du die MainUnit ein.

Dann zb: Main.HttpServer.Active:= false;

Also vor HttpServer muss die Unit auf der sich die Komponente befindet.

lg Target



Hab ich so versucht, kommt aber trotzdem noch:

[Error] Unit1.pas(457): Undeclared identifier: 'HttpServer'
[Error] Unit1.pas(457): Missing operator or semicolon

:(

Liebe Grüße,
Sniky
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19336
Erhaltene Danke: 1751

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 28.04.08 19:15 
Wenn es eine Komponente auf dem anderen Formular ist:
ausblenden Delphi-Quelltext
1:
DeineForm.DeineKomponente					

Wenn es eine globale Variable in der anderen Unit ist, also so wie hier DeineVariable:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TfrmMain = class(TForm)
    btnTest: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;
  DeineVariable: Integer;

implementation

{$R *.dfm}

//...
dann greifst du darauf mit
ausblenden Delphi-Quelltext
1:
DeineUnit.DeineVariable					
zu.
In dem Beispiel liegt in der Unit Main der Button btnTest auf dem Formular frmMain und DeineVariable ist einfach nur global unter var deklariert:
ausblenden Delphi-Quelltext
1:
2:
Main.DeineVariable := 3;
frmMain.btnTest.Caption := 'Funktioniert';
Sniky Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 53



BeitragVerfasst: Mo 28.04.08 19:18 
ok, irgend wie geht es doch... hab noch mal compilieren geklickt und dann ging es doch... keine ahnung warum :)

Danke noch mal!

Liebe Grüße,
Sniky