HideForTime (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This code uses a button, a timer, and a maskedit on a form. When you click the button, the form disappears for the period of time specified in the Interval property of the timer control, then the form reappears.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Timer1->Interval = StrToInt(MaskEdit1->Text);
  Timer1->Enabled = true;
  Hide();
}

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

Uses