Autor Beitrag
delphirxs
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Linux, Windows

BeitragVerfasst: Di 24.02.04 10:58 
Hi amigos

Ich habe ein dringendes Problem!
Ich habe ein delphi programm welches sehr viele classen enthält!
Ich habe aber momentan probleme mit dem Zugriff auf mein Treeview in der Tfom1! :cry:

Hat mir jemand ein Beispiel oder eine Idee wie ich auf mein Treeview zugreifen kann bzw. wie ich auf die Tform1 komme?

Danke schon im Voraus

viele grüsse von delphirxs
Brainiac
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 24.02.04 11:25 
Delphi generiert immer eine globale Variable Var Form1:TForm1;
Über die kannst du auf alle Child-Komponenten von Form1 zurückgreifen, allerdings natürlich erst nach Form1.Create
delphirxs Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Linux, Windows

BeitragVerfasst: Di 24.02.04 11:29 
danke für deine schnelle antwort!
hmm, aber Tform1 kann delphi nicht interpretieren!
d.h unklarer indentifier

Ich wollte eigentlich unter Uses die Unit1 hinzufügen, aber danach kann ich nicht mehr kompilieren? :cry:
Brainiac
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 24.02.04 13:29 
Schreib doch mal Code hier hin... denn ich verstehe anscheinend dein Problem noch nicht so ganz.
delphirxs Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Linux, Windows

BeitragVerfasst: Di 24.02.04 13:35 
das wird dir warscheindlich nicht viel bringen!

Ich habe eine normale unit und eine Form!
Von meiner Unit1 greife ich auf diverse Classen zu, welche sich zum Teil selber in sich wieder aufrufen!

der Kopf kann z.B so aussehen:

ausblenden volle Höhe 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:
27:
28:
29:
30:
31:
unit Classsnapshot;

interface

Uses
  classes, Controls, TTestClass, ClassSnapshotObject, SysUtils, dialogs, Classobjectlist;

type
  TSnapshot = class
    Private
      SnapshotLinkObject : TObjectlist;
      SnapshotProzessObject : TObjectlist;
      SnapshotServiceObject : TObjectlist;

      Procedure decodestringlist( Snapshot: Tstrings );

    Public
      constructor Create( Snapshot: Tstrings );
      property getSnapshotLinkObject : Tobjectlist read SnapshotLinkObject write SnapshotLinkObject ;
      property getSnapshotProzessObject : TObjectlist read SnapshotProzessObject write SnapshotProzessObject;
      property getSnapshotServiceObject : TObjectlist read SnapshotServiceObject write SnapshotServiceObject;

  End;

implementation

constructor TSnapshot.Create( Snapshot: Tstrings );
Begin
  inherited Create;
  decodestringlist(Snapshot);
End;


Jetzt möchte ich in einer Procedure in der class auf mein Treeview der Form1 zugreifen!
Aber wenn ich z.b die Unit 1 in Uses einfüge kann ich nicht mehr kompilieren!

danke

viele grüsse Delphirxs

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: Di 24.02.04 20:40 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
implementation 

uses unit1;

constructor TSnapshot.Create( Snapshot: Tstrings ); 
Begin 
  inherited Create; 
  decodestringlist(Snapshot); 

  unit1.form1.treeview1.....

End;


Das sollte so funktionieren. Allerdings muss Form1 schon existieren, bevor Du hier zugreifst...
Brainiac
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 25.02.04 11:02 
Dein Problem ist wahrscheinlich, dass deine Unit 'Classsnapshot' von der 'Unit1' benutzt wird. Wenn du jetzt auch noch 'Unit1' zu der 'Classsnapshot' bei Uses hinzufügst, dann meckert der Compiler wegen einem überkreuzenden Bezug.

Versuch mal, eine neue uses-Klausel unter implementation einzufügen und die 'Unit1' da einzutragen.
Genau wie tomtom62 es gesagt hat eben.
delphirxs Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Linux, Windows

BeitragVerfasst: Mi 25.02.04 11:10 
danke für eure schnellen antworten.

ich hatte soeben probiert unter implementation meine Unit1 mit Uses hinzuzufügen!
aber das funktioniert nicht! Der Compiler bringt mir einen Fatalerror und nicht einmal einen Fehler!

Seid ihr sicher, dass das funktioniert? oder muss ich sonst nocht auf etwas achten?

danke

gruss delphirxs
delphirxs Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Linux, Windows

BeitragVerfasst: Mi 25.02.04 11:17 
oooopppss

soory.. ich hatte einen anderen komischen kompiler fehler!

es funktioniert!

danke mes amigos!

ihr seid super!

viele grüsse aus der ch von delphirxs