Autor Beitrag
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Fr 04.04.03 19:19 
ich habe gerade ein Programm zur Hälfte fertig geschrieben und wollte einfach nen Testlauf machen, aber irgentwo im Quelltext steht etwas wie

Dings.Eigenschaft:= BlaBla;

Delphi meint aber, dass es

Form1.Dings.Eigenschaft:= BlaBla;

heissen muss. da ich dieses Problem schon mehrmals hatte, befürchte ich, dass Delphi sagt ''Kann Form1 nich finden'', wenn das Programm fertig ist und ich es laufen lasssen will. dh. ich kann noch mal anfangen
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Fr 04.04.03 19:36 
Du kannst Eigenschaften einer Klasse ohne das Objekt direkt anzusprechen nicht außerhalb der Klasse ansprechen.
Also wenn es heißt:
ausblenden Quelltext
1:
2:
3:
4:
procedure TForm123.bla;
begin
  close;
end;

Klappt das, aber außerhalb von TForm123 musst du
ausblenden Quelltext
1:
2:
3:
4:
procedure bla;
begin
  Form1.Close;
end;

schreiben.
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Fr 04.04.03 19:41 
ich hab noch nie mehr als eine Tform benutzt
hat das problem was damit zu tun, das ich sie umbennant habe (form1.caption)?
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Fr 04.04.03 19:50 
Du musst außerhalb der Klasse TFormIrgendwas etwas gemacht haben, damit du explizit davor FormIrgendwas setzen musst.
Vielleicht eine eigene Procedure?
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Fr 04.04.03 19:53 
ausblenden volle Höhe 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:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Data: TStringList;

implementation

{$R *.dfm}

procedure ClearAll;
begin
DirInput.Clear;
Fileinput.Clear;
Text.Clear;
Button1Caption.Clear;
Button1Target.Clear;
Button2Caption.Clear;
Button2Target.Clear;
Button3Caption.Clear;
Button3Target.Clear;
Data.Clear;
end;

{The Calling}

procedure TForm1.FormCreate(Sender: TObject);
begin
 Data:= TStringList.Create;
 Data.Free;
end;

procedure TForm1.ClearButtonClick(Sender: TObject);
begin
 ClearAll;
end;






procedure TForm1.Button1Click(Sender: TObject);
begin
 If Data[0]= 0 then
  begin
  Button1.Caption:= 'On';
  Data[0]:= 1;
  end

 else
   begin
  Button1.Caption:= 'Off';
  Data[0]:= 0;
  end;

end;

end.



Moderiert von user profile icontommie-lie: Code-Tags hinzugefügt
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Fr 04.04.03 19:59 
Ich sag doch, du machst was außerhalb der Formularklasse:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure ClearAll;
begin
DirInput.Clear;
Fileinput.Clear;
Text.Clear;
Button1Caption.Clear;
Button1Target.Clear;
Button2Caption.Clear;
Button2Target.Clear;
Button3Caption.Clear;
Button3Target.Clear;
Data.Clear;
end;
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Fr 04.04.03 20:07 
wie soll es richtig sein?
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Fr 04.04.03 20:47 
Vor jeden Clear-Befehl noch Form1. setzen.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 04.04.03 22:08 
Oder mit dem Schlüsselwort with arbeiten oder gleich aus der Prozedur eine Methode von TForm machen.