RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TApplication.Restore Method

Restores a minimized application to its normal size.

Pascal
procedure Restore;
C++
__fastcall Restore();

Use Restore to restore the application to its previous size before it was minimized. When the user restores the application to normal size, Restore is automatically called.

Note: Don't confuse the Restore method, which restores the entire application, with restoring a form or window to its original size. To minimize, maximize, and restore a window or form, change the value of its WindowState property.
 

C++ Examples: 

 

/*
This example uses a timer on a form. When the application
runs and the user minimizes the application, the timer
starts and the application returns to its normal size when
an OnTimer event occurs.  The timer then shuts down until
the next time the form is minimized.  Be sure to declare the
AppStartTimer method as a public method of TForm1.  Place a
TTimer object in the form and enter Timer1Timer in the OnTimer
event.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  Application->OnMinimize = AppStartTimer;
  Timer1->Interval = 1000;
}

void __fastcall TForm1::AppStartTimer(TObject *Sender)
{
  Timer1->Enabled = true;
}

//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  Application->Restore();
  Timer1->Enabled = false;
}

 

Delphi Examples: 

{
This example uses a timer on a form. When the application
runs and the user minimizes the application, the timer
starts and the application returns to its normal size when
an OnTimer event occurs.  The timer then shuts down until
the next time the form is minimized.  Be sure to declare the
AppStartTimer method as a public method of TForm1.  Place a
TTimer object in the form and enter Timer1Timer in the OnTimer
event.
}
procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnMinimize := AppStartTimer;
end;

procedure TForm1.AppStartTimer(Sender: TObject);
begin
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Application.Restore;
  Timer1.Enabled := False;
end; 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!