Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi Non Blocking ShowModal

I was wondering if theres a method to show a TForm without waiting for it (kinda like TForm.Show). But what I would like is to BLOCK all other forms (just like in ShowModal)

Example:

I have Form1 and Form2. Form1 has a button that should open Form2 but Form1 is blocked, yet the click of the button still continues the code that came AFTER Form2 opened.

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2.ShowModal; // ===> Something like that but the Code should continue, yet Form1 and all other forms are blocked (disabled)
  MessageBox (0, 'Code continues', '', 0);
end;

Hope you know what I mean.

like image 813
Ben Avatar asked Jan 14 '23 02:01

Ben


1 Answers

You can call DisableTaskwindows, excepting your Window from beeing disabled and later EnableTaskWindows to enable other forms again.

  Form3.Show;
  FP:=DisableTaskwindows(Form3.Handle);
  //Some Code
  EnableTaskwindows(FP);
like image 91
bummi Avatar answered Jan 23 '23 03:01

bummi