Autor Beitrag
SpeedyFighter1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 53



BeitragVerfasst: Do 17.08.06 15:41 
Huhu,

ich wollt in einem Form (Form1) eine Procedure deklarieren, auf die ich dann mit einem anderen Form (Form2) zugreifen kann.
Nun weiß ich aber nicht wie ich die Procedure in Form2 aufrufen kann.
Wäre nett, wenn mir da jmd. helfen könnte.

Danke schon mal im Vorraus!

mfg SpeedyFighter1
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 17.08.06 15:43 
ausblenden Delphi-Quelltext
1:
form1.procedure(parameter);					

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 17.08.06 15:49 
Die Methode muß aber mindestens die Sichbarkeitsstufe public haben.

_________________
Markus Kinzler.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 17.08.06 15:52 
Du musst deine Procedure noch in "Public" erwähnen. Anschließend schreibst du noch den Namen deiner Form, in der die Prozedur steht, vor den Namen deiner Prozedur.
Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
[...]
 public
    { Public declarations }
    procedure Test;
  end;
[...]
implementation
 procedure TForm1.test;
 begin
 ...

anschließend kannst du die prozedur in einer anderen unit mit "Form1.test;" aufrufen ;)

edit: zu langsam, vllt sollte ich meine beiträge erst hinterher editieren


Zuletzt bearbeitet von Marc. am Do 17.08.06 15:53, insgesamt 2-mal bearbeitet
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Do 17.08.06 15:52 
...und Unit1 muss in den uses von unit2 stehen ;).

Jeder ein Satz, das gefällt mir ^^ :mrgreen: .
FloL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
Delphi 2005
BeitragVerfasst: Fr 25.08.06 20:18 
Hmmm.... bei mir klappts nicht...
Form: Foptionsplaner
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
  public
    { Public-Deklarationen }

procedure stadt;

  end;

var
  foptionplaner: Tfoptionplaner;

implementation

uses planer;

{$R *.dfm}

procedure foptionplaner.stadt;
begin


[Fehler] optionplaner.pas(27): E2065 Ungenügende Forward- oder External-Deklaration: 'Tfoptionplaner.stadt'
und
[Fehler] optionplaner.pas(40): E2004 Bezeichner redefiniert: 'foptionplaner'

Form:Planer
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
uses optionsplaner;


procedure TFplaner.Laden1Click(Sender: TObject);
var ini : TInifile;
begin
foptionplaner.stadt;
end;


[Fataler Fehler] planer.pas(655): F2063 Verwendete Unit 'optionplaner.pas' kann nicht compiliert werden
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Fr 25.08.06 20:24 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
implementation

uses planer;

{$R *.dfm}

procedure Tfoptionplaner.stadt;
begin


:D


MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
FloL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win XP
Delphi 2005
BeitragVerfasst: Fr 25.08.06 20:46 
Ach das kann doch nicht so einfach gewesen sein :cry: