Einzelnen Beitrag anzeigen

HolgerX

Registriert seit: 10. Apr 2006
Ort: Leverkusen
961 Beiträge
 
Delphi 6 Professional
 
#4

AW: NotifyWindow, dynamisches Fenster in nur einer Prozedur inklusive Events und AA

  Alt 30. Aug 2015, 13:09
Wozu Globale form_Notify ?

Delphi-Quellcode:
Class Procedure NotifyWindow.CloseQuery(Sender: TObject; Var CanClose: Boolean);
 Begin
  Try
   If OK_Pressed = True
   Then CanClose := True
   Else CanClose := False;

   If boolean_Close = True Then CanClose := True;
  Except
   ErrorLog('uNotifyWindow: OnCloseQuery Failed');
   Close_MainForm;
   Exit;
  End;
 End;


Class Procedure NotifyWindow.KeyDown(Sender: TObject; Var Key: Word; Shift: TShiftstate);
 Begin
  Try
   If OK_Pressed = True Then form_Notify.Close;
  Except
   ErrorLog('uNotifyWindow: OnKeyDown Failed');
   Close_MainForm;
   Exit;
  End;
 End;
Was meinst Du wer 'Sender' ist?

Richtig, deine Form!

Also mach z.B. aus
Delphi-Quellcode:
Procedure Close_MainForm;
 Begin
  Try
   boolean_Close := True;
   form_Notify.Close;
  Except
   Exit;
  End;
 End;

Delphi-Quellcode:
Procedure Close_MainForm(AForm : TForm);
 Begin
  Try
   boolean_Close := True;
   AForm.Close;
  Except
   Exit;
  End;
 End;

Class Procedure NotifyWindow.KeyDown(Sender: TObject; Var Key: Word; Shift: TShiftstate);
 Begin
  Try
   If OK_Pressed = True Then TForm(Sender).Close;
  Except
   ErrorLog('uNotifyWindow: OnKeyDown Failed');
   Close_MainForm(TForm(Sender));
   Exit;
  End;
 End;
Und schon hat sich deine Globale Form erledigt..

und packe dann

Delphi-Quellcode:
Var
  form_Notify : TForm;
in deine

Class Procedure Show(WindowTitle: String; WindowText: String);

als lokale Variable....
  Mit Zitat antworten Zitat