Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi OnRestore, OnMinimize (https://www.delphipraxis.net/114210-onrestore-onminimize.html)

taktaky 21. Mai 2008 13:53


OnRestore, OnMinimize
 
Hallo

Ich wollte ein refresh für meinen Panel mit dieser Funktion machen :

Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnRestore := ShowDummy(trsPanel1);// error Untyped Pointer or Parameter !
Application.OnMinimize := ShowDummy(trsPanel1);
end;
Delphi-Quellcode:
procedure ShowDummy(C: TControl);
var
  PF: TCustomForm;

  procedure SC_(WC: TWinControl);
  var I: Integer;
  begin
    WC.Invalidate;
    for I := 0 to WC.ControlCount - 1 do
    begin
      if WC.Controls[I] is TWinControl then
        SC_(WC.Controls[I] as TWinControl)
      else
        WC.Controls[I].Invalidate;
    end;
  end;

begin
  if not (csDesigning in C.ComponentState) then
  begin
    if C is TForm then
      PF := (C as TForm)
    else
      PF := GetParentForm(C);
    if PF <> nil then
      SC_(PF);
  end;
end;

Adrian112 21. Mai 2008 13:54

Re: OnRestore, OnMinimize
 
Ja, ahm und?

sirius 21. Mai 2008 13:56

Re: OnRestore, OnMinimize
 
Methode <--> Procedure ?

Phoenix 21. Mai 2008 13:57

Re: OnRestore, OnMinimize
 
Du kannst bei einer Event-Zuweisung keine Parameter übergeben.

Lese Dir erstmal an, wie man Events benutzt, bevor Du hier wieder gegen irgendeine Wand rennst.

stahli 21. Mai 2008 14:52

Re: OnRestore, OnMinimize
 
Benutze eine TApplicationEvents-Komponente.
Dort weist Du die entsprechenden Ereignisbehandlungen zu.
Darin kannst Du die Prozedur aufrufen.

stahli

Ein Tipp: Geh auf die Rückfragen der Helferleins hier sorgfältiger ein und versuche Probleme erst mal in Ruhe selbst zu lösen... Dann helfen hier alle gern.

taktaky 21. Mai 2008 15:23

Re: OnRestore, OnMinimize
 
Ich konnte endlich die Funktion aufrufen aber die Funktion hat mir nicht geholfen
Ich dachte der TrsPanel wird damit aktualisiert (Refresh)
Ich versuche den Komponent-Hersteller zu kontaktieren vielleicht, da die Leute wahrscheinlich keine Erfahrung mit dieser Komponent (Trs-Panel.dpk) haben

Delphi-Quellcode:

  public
    { Public declarations }
  protected
  procedure ShowDummy(Sender: TObject);
  end;
//...
procedure ShowDummy(C: TControl);
var
  PF: TCustomForm;

  procedure SC_(WC: TWinControl);
  var I: Integer;
  begin
    WC.Invalidate;
    for I := 0 to WC.ControlCount - 1 do
    begin
      if WC.Controls[I] is TWinControl then
        SC_(WC.Controls[I] as TWinControl)
      else
        WC.Controls[I].Invalidate;
    end;
  end;

begin
  if not (csDesigning in C.ComponentState) then
  begin
    if C is TForm then
      PF := (C as TForm)
    else
      PF := GetParentForm(C);
    if PF <> nil then
      SC_(PF);
  end;
end;

procedure TForm1.ShowDummy(Sender: TObject);
begin
 ShowDummy(TrsPanel1);
end;

procedure TForm1.FormCreate(Sender: TObject);

begin
  Application.OnRestore := ShowDummy;
  Application.OnMinimize := ShowDummy;
end;
//...
end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:37 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz