Autor Beitrag
Zlatan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Do 03.02.11 12:40 
Auf meiner Form2 soll ein Button Form1 schließen (also das ganze Programm)

Ich dachte das macht man mit Form1.Close;
aber aus einem mir nicht erklärlichen grund geht das nicht

Kennt jemand eine Lösung? :shock:


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Do 03.02.2011 um 15:35
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 03.02.11 12:42 
Hast du die Unit in der Form1 drin ist zu den Uses bei Form2 hinzugefügt? Wenn Form2 Form1 nicht kennt, kann es Form1 auch nicht schließen. ;)

Wenn das nicht der Fehler ist: Was genau funktioniert nicht? Immerhin gehst du ja auch nicht ohne Auto zum Mechaniker, sagst ihm einfach nur "Geht nicht" und erwartest das er den Schaden behebt. ;)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 03.02.11 12:42 
Wenn das das Hauptformular ist, schließt du auch die Anwendung, sonst nicht. Die kannst du mit Application.Terminate schließen, allerdings werden die OnClose Ereignisse usw. dann nicht ausgeführt.

Oder du machst ein sauberes Konzept, bei dem das Hauptfenster auch wirklich das Hauptfenster ist und dann ggf. sich selbst schließt.
Zlatan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175



BeitragVerfasst: Do 03.02.11 12:46 
auf Form4 ist nur ein Button der Alles schließen soll
Er schießt aber nur Form4

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:
33:
34:
unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls;

type
  TForm4 = class(TForm)
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm4.BitBtn1Click(Sender: TObject);
begin
Form1.Close;
end;

end.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 03.02.11 14:44 
Dann ist die Instanz in Form1 nicht das Hauptformular.

Oder meinst du, dass das Programm im Hintergrund weiterläuft ohne Formular? Dann bleibt es vielleicht einfach hängen, weil bei der Freigabe etwas schief geht.