Autor Beitrag
MiB-Agent
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Fr 23.05.03 15:26 
Hallo!
wie kann man eine zweite unit so in ein programm einbauen, dass man von dort aus in einer procedure object-eigenschaften ändern kann, also z.b. steht in unit2 dass label1.caption:='xxxc' sein soll, aber unit2 wird erst in unit1 durch einen klick auf irgendeinen button aufgerufen... ich komm mit dem quelltext nich zurecht... :cry:
Luncustaf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324

Win 2k
D7 Ent.
BeitragVerfasst: Fr 23.05.03 15:43 
hmm ich verstehe nicht ganz was du machen willst entweder du setzt das caption des labels im objectinspektor schon auf xxxc oder du machst es in das form.create deiner zweien unit.


gr€€tz

PS: nen bisserl quellcode wäre net schlecht
MiB-Agent Threadstarter
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Fr 23.05.03 19:35 
naja also soweit bin ich schon:
unit1:
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:
32:
unit Unit1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, unit2;

type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    procedure ComboBox1Change(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if combobox1.text='abc' then xx1;
if combobox1.text='def' then xx2;
end;

end.

unit2:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
unit Unit2;

interface
procedure xx1;



implementation
procedure xx1;
begin
label1.caption:='xxxc';
end;
end.

unit3:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
unit Unit3;

interface
procedure xx2;
implementation

procedure xx2;
begin
label1.caption:='xxxd';
end;
end.

dann zeigt er mir den fehler an, dass label1 ein unbekannter bezeichner is (fehler 3)... :(
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Sa 24.05.03 12:09 
Hi,

Du musst natürlich die Unti1 in die Units Unit2 und Unit3 einbinden. Das geht mit der Uses Anweisung:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
unit Unit2; 

uses
  Unit1;

interface 

procedure xx1; 

implementation 

procedure xx1; 
begin 
  Form1.label1.caption:='xxxc'
end;

end.


Gruß
Tino
MiB-Agent Threadstarter
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Sa 24.05.03 18:19 
schönen dank, aber das funktioniert auch nich so recht. :?
denn dann kommt der fehler:"überkreuzender bezug zweier units (unit1)".
maximus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 896

Win XP, Suse 8.1
Delphi 4/7/8 alles prof
BeitragVerfasst: Mo 26.05.03 12:10 
^Hi...

dann setze das 'uses' der zweiten und oder dritten unit hinter 'Implementation' :wink:

_________________
mfg.
mâximôv
MiB-Agent Threadstarter
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Mi 28.05.03 17:12 
danke!
jetzt gehts. :D