Autor Beitrag
xel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Mo 17.01.05 10:50 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
//Also ich will sowas:
Function test(var_table): String;
begin
  Form1.var_table.Locate(ComboBox1.Text,ComboBox2.Text,optionen);
end;


//starten meiner funktion
test(Table2);


Jaja vieleicht ist das garnicht möglich wie ich das oben geschrieben habe, aber irgendwie so
muss es ja gehen!

thx
Xel


Moderiert von user profile iconChristian S.: Topic aus Dateizugriff verschoben am Mo 17.01.2005 um 10:51
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 17.01.05 10:56 
xel hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
//Also ich will sowas:
Function test(var_table): String;
begin
  Form1.var_table.Locate(ComboBox1.Text,ComboBox2.Text,optionen);
end;


//starten meiner funktion
test(Table2);


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
//Also ich will sowas:
Function test(var_table:TTable): String;
begin
  var_table.Locate(ComboBox1.Text,ComboBox2.Text,optionen);
end;

//starten meiner funktion
test(Table2);


Das ist alles :D

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
xel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Mo 17.01.05 11:11 
Und wie ist das wenn mein Objekt in Form1 liegt und meine funktion in
Form2?



so ungefär
s_tabelle: TForm1.TTable; ????


thx
xel
HolgerB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 91

Win XP
D6 Pers
BeitragVerfasst: Mo 17.01.05 11:18 
Andersherum.

Beim Aufruf musst du angeben, wo deine Komponente liegt. Sofern du es noch nicht hast, musst du Form2 auch noch unter Uses eintragen, sonnst kannst du nicht auf die Komponenten aus einem anderen Formular zugreifen.

Funktionsaufruf:

ausblenden Delphi-Quelltext
1:
a := test(form2.TTable);					
xel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Mo 17.01.05 11:34 
Titel: geht net!?
also ich würde das sonnst direkt als Variablen in einem Form einfügen aber es geht so nicht


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var
  Optionen: TLocateOptions;  
  s_tabelle: Form1.TTable; //<--- hier macht er fehler - [Fehler] Unit8.pas(33): Undefinierter Bezeichner: 'Form1'


implementation

uses Unit1; //<-- Unit1 ist drin, wie du siehst!?


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
HolgerB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 91

Win XP
D6 Pers
BeitragVerfasst: Mo 17.01.05 12:17 
OK,

bei der TTabelle habe ich mich vertan. TTabelle ist ja ein Typ, keine Variable.

Deine Variablendeklaration müsste so aussehen:

ausblenden Delphi-Quelltext
1:
2:
3:
var  
  Optionen: TLocateOptions;    
  s_tabelle: TTable;


Die Funktion in Unit1
ausblenden Delphi-Quelltext
1:
functin test(value :TTable): String;					



Der Funktionsaufruf in Unit1:

ausblenden Delphi-Quelltext
1:
a := test(s_tabelle);					


Der Funktionsaufruf aus Unit2:
ausblenden Delphi-Quelltext
1:
a := test(unit1.s_tabelle);					



So, ich hoffe ich habe keine Fehler drin...