Autor Beitrag
Bomania
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 139

Win XP

BeitragVerfasst: Di 04.03.03 18:24 
Hallo,

ich würde gerne den Status des Programmfensters ermitteln. Ich habe das dann so versucht:

ausblenden Quelltext
1:
2:
3:
4:
procedure Tfrm_Main.FormResize(Sender: TObject);
begin
  if frm_Main.WindowState = wsMinimized then
    ...


Passiert aber nix. Wie kann ich das richtig machen?
Vielen Dank.
Spike
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 69
Erhaltene Danke: 1



BeitragVerfasst: Di 04.03.03 22:42 
FormResize wird beim Minimieren des Forms nicht ausgelöst.
Aber so kommste dran:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnMinimize := FormMinimize;
end;

procedure TForm1.FormMinimize(Sender: TObject);
begin
  // ...
end;
Bomania Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 139

Win XP

BeitragVerfasst: Mi 05.03.03 15:34 
Undefinierter Bezeichner "FormMinimize" :(
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mi 05.03.03 15:38 
Schreib mal:
ausblenden Quelltext
1:
procedure FormMinimize(Sender: TObject);					

in den public-Teil deiner Unit.

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Bomania Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 139

Win XP

BeitragVerfasst: Mi 05.03.03 16:49 
Danke, jetzt geht es. Allerdings hab ich jetzt ein neues Problem: Man kann das Fenster nur einmal minimieren. Wenn man es ein zweites mal minimieren möchte, dann passiert gar nichts.
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mi 05.03.03 18:00 
poste doch mal deinen code, den du in FormMinimize ausführst.
Bomania Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 139

Win XP

BeitragVerfasst: Mi 05.03.03 18:55 
Ich arbeite mit einer Komponente für den Systray (CoolTray)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
// Beim Verkleinern der Form wird nur noch das Systray-Icon angezeigt.
procedure Tfrm_Main.FormMinimize(Sender: TObject);
begin
  frm_main.cooltray.Enabled:=true;
  frm_Main.cooltray.IconVisible:=true;
  frm_Main.Hide;
end;

// Beim Doppelklick auf das Systray-Icon verschwindet dieses,
// und das Fenster erscheint wieder
procedure Tfrm_Main.CoolTrayDblClick(Sender: TObject);
begin
  cooltray.Enabled:=false;
  cooltray.IconVisible:=false;
  frm_Main.show;
end;


Das erste Mal klappt das ganze, doch nach dem ersten Mal minimieren nicht mehr.