Autor Beitrag
orakel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 92

Win XP

BeitragVerfasst: Sa 21.02.04 20:48 
Hallo,
Gibt es einen Befehl, der alle Fenster schliest oder versteckt, ohne das Programm zu beenden??
Am besten wäre es, wenn man die MainForm als einzige am schluss noch sehen kann..

_________________
Nicht verzagen, orakel fragen!
rokdd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: Sa 21.02.04 22:02 
hallo,
dieser quelltext stammt nur teilweise von mir:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
  I: Integer;
  Temp: TComponent;
begin
  for I := application.ComponentCount - 1 downto 1 do
    begin
    Temp := application.Components[I];
         try
            if (tform(application.FindComponent(temp.getnamepath)).Showing=true) and(not(temp.getnamepath='frm_main'))and(not(length(temp.getnamepath)=0)) then begin
               tform(application.FindComponent(temp.getnamepath)).close;
            end;
         except
         end;
    end;
end;


Bei der if anweisung gibt es den vergleicg getnamepath='frm_main', damals wollte ich diese form nicht schließen und ahbe deswegen dass dort reingeschrieben, für deine zwecke müsstest du das also rausnehmen. hoffe du kommst damit klar!

tokdd
orakel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 92

Win XP

BeitragVerfasst: So 22.02.04 14:17 
Danke,
ich selbst hab aber auch noch was gefunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject);
var  i:Integer;
begin
  for i:=0 to (Application.ComponentCount-1) do
    if (Application.Components[i] is TForm) and (Application.Components[i] <> Application.MainForm) then
      (Application.Components[i] as TForm).Close;

Was meint ihr dazu?

Moderiert von user profile iconPeter Lustig: Zeilenumbrüche hinzugefügt

_________________
Nicht verzagen, orakel fragen!
rokdd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: So 22.02.04 15:16 
hallo,
denke ist das gleiche wie meine variante oder? ausser das du überwachst ob das wirklich eine tform ist.

rokdd
SuperS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 102

Win XP Home, Win XP Prof, Win 98

BeitragVerfasst: So 22.02.04 22:09 
Versuche es mal damit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
Form1.hide;
end;

end.


Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
rokdd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: So 22.02.04 22:47 
orakel hat folgendes geschrieben:
alle Fenster schliest oder versteckt, ohne das Programm zu beenden??


@SuperS: erfüllt dein Code diese Bedingung?

rokdd
orakel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 92

Win XP

BeitragVerfasst: Mo 23.02.04 16:04 
Zitat:
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
Form1.hide;
end;

end.


Ich galub auch, dass mir das weniger weiter hilft...*g*

Danke rokdd!

_________________
Nicht verzagen, orakel fragen!