Autor Beitrag
Cybo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Do 09.06.05 01:04 
Ich habe ein kleines Programm, dass ein zweites Fenster mit einer Uhr öffnet, nun möchte ich, dass man FORM1 minimieren kann, aber Form2 nicht mit minimiert wird, wie kann ich das verhindern, stayontop bringt es leider nicht.

Mit showmodal, kann man form1 nicht minimieren..

bin ratlos...


Moderiert von user profile iconraziel: Topic aus Sonstiges verschoben am Do 09.06.2005 um 07:13

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.
Cybo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Do 09.06.05 12:21 
ein setzen von form2.showmodal mit gleichzeitigem ausblenden von Form1 geht auch nicht :/

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.
Mottor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Do 09.06.05 12:46 
In Form2 :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm2.FormShow(Sender: TObject);
begin
  Form1.Hide;
end;

procedure TForm2.FormHide(Sender: TObject);
begin
  Form1.Show;
end;

In Form1 put TApplicationEvents on the form.
Wir verhindern Minimize.
Ereignis OnMinimize:
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:
...
  TForm1 = class(TForm)
    ApplicationEvents1: TApplicationEvents;
    procedure ApplicationEvents1Message(var Msg: tagMSG;
      var Handled: Boolean);
    procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;
...
implementation
...
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
begin
 if (Msg.message = WM_SYSCOMMAND) and                // Minimize from taskbar
    (Msg.wParam and $FFF0 = SC_MINIMIZE) then begin
      Form2.ShowModal;
      Handled := True;
    end;
end;

procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
begin
  with Message do                                   // Minimize from form
    if (CmdType and $FFF0 = SC_MINIMIZE) and (Application.MainForm = Self) then
      Form2.ShowModal
    else
      Inherited;
end;
Cybo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Do 09.06.05 12:48 
das teste ich doch direkt mal...

Edit: Jo, danke, etwas angepasst an meinen Quelltext funktioniert das super!

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.