Recent

Author Topic: "Darkening" main window when modal form is shown above it  (Read 8044 times)

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: "Darkening" main window when modal form is shown above it
« Reply #15 on: August 04, 2018, 04:20:02 pm »
Just making sure that I did not miss something crucial.

No problem, thanks for pointing them, these are good improvements.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: "Darkening" main window when modal form is shown above it
« Reply #16 on: August 04, 2018, 07:17:44 pm »
Engkin's code with some modifications works very good on windows:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   f:TForm;
  4. begin
  5.   f:=TForm.Create(self);
  6.   f.ShowInTaskBar:=stNever;
  7.   f.BorderStyle:=bsNone;
  8.   f.BoundsRect := Rect(0,0,ClientWidth, ClientHeight);
  9.   f.AlphaBlend:=True;
  10.   f.AlphaBlendValue:=120;
  11.   f.Color:=clBlack;
  12.   f.Parent:=self;
  13.   f.Show;
  14.  
  15.   MessageDlg('Hello, this is modal dialog.', mtInformation, [mbOK],0);
  16.  
  17.   f.Free;
  18. end;
  19.  

Maybe it works on linux (with enabled compositor) and macos too.
« Last Edit: August 04, 2018, 07:19:53 pm by Soner »

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: "Darkening" main window when modal form is shown above it
« Reply #17 on: August 04, 2018, 07:57:19 pm »
Cool! We have a lot of good options to choose.  :)

dietmar

  • Full Member
  • ***
  • Posts: 170
Re: "Darkening" main window when modal form is shown above it
« Reply #18 on: August 07, 2018, 09:17:21 pm »
Thanks a lot for the many appreciated answers!

Dietmar
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

dietmar

  • Full Member
  • ***
  • Posts: 170
Re: "Darkening" main window when modal form is shown above it
« Reply #19 on: August 09, 2018, 06:21:31 pm »
Hm, the next challenge could be not to just darkening the background, but to "blur" it, so that you e.g. cannot read the background form any more... ;-)
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: "Darkening" main window when modal form is shown above it
« Reply #20 on: August 10, 2018, 10:41:21 pm »
Hm, the next challenge could be not to just darkening the background, but to "blur" it, so that you e.g. cannot read the background form any more... ;-)

With the example I submitted just apply blur with BGRABitmap and that's all.

dietmar

  • Full Member
  • ***
  • Posts: 170
Re: "Darkening" main window when modal form is shown above it
« Reply #21 on: August 12, 2018, 07:28:26 pm »
Thanks a lot! I will give it a try... ;-)
« Last Edit: August 12, 2018, 07:52:54 pm by dietmar »
Lazarus 2.2.0RC1 with FPC 3.2.2 (32 Bit) on Windows10 (64Bit)

 

TinyPortal © 2005-2018