Recent

Author Topic: [SOLVED]Gnom: Screen.DisableForms doesn't work  (Read 2655 times)

zoltanleo

  • Hero Member
  • *****
  • Posts: 515
[SOLVED]Gnom: Screen.DisableForms doesn't work
« on: April 12, 2017, 10:27:17 pm »
Hi, friends

I cause splash-form during some action in additional thread. To disable remaining application windows, I use the following code
Code: Pascal  [Select][+][-]
  1. { Tfrm_main }
  2.  
  3. procedure Tfrm_main.BtnRunClick(Sender: TObject);
  4. var f: Tfrm_splash;
  5.     ListDisabled: TList;
  6. begin
  7. f:= Tfrm_splash.Create(Self);//splash
  8. ListDisabled:= Screen.DisableForms(f);
  9.   try
  10.     FNewThread:= TFgrndThread.Create(True); //remaining parameters are determined in the constructor method
  11.     FNewThread.Start;
  12.     f.FormStyle:= fsNormal;
  13.     f.Show;
  14.     while not FNewThread.FIsFinishedThread do //FIsFinishedThread - property of the termination of thread
  15.     begin
  16.       f.Label1.Caption:= TimeToStr(Now);
  17.       Application.ProcessMessages;
  18.     end;
  19.     f.Close;
  20.   finally
  21.     FreeAndNil(f);
  22.   end;
  23. Screen.EnableForms(ListDisabled);
  24. if frm_main.CanFocus then frm_main.SetFocus;
  25. end;  
   

In MSWindows behavior of a window it, as expected. But in Debian with a working surrounding of gnom splash-form hides under a window to which I passed focus.

this behavior in Debian gnom
http://s019.radikal.ru/i606/1704/82/ff18c51ad188.gif

this behavior in MSWindows
http://s56.radikal.ru/i154/1704/e7/95f73970c656.gif

I tried to change FormStyle properties to fsStayOnTop, but then splash-form remains always.

I can correct somehow a code to receive the same behavior, how in MSWindows?


p.s. I applied archive of the project, you can try to launch it.                                         
« Last Edit: April 15, 2017, 02:27:31 pm by zoltanleo »
Win10 LTSC x64/Deb 12 amd64(gtk2)/Kubuntu(qt5)/Darwin Cocoa x86_64 (Sequoia):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 3.0.11; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

zoltanleo

  • Hero Member
  • *****
  • Posts: 515
Re: Gnom: Screen.DisableForms doesn't work
« Reply #1 on: April 15, 2017, 02:27:00 pm »
I asked for the help on other forums. Here what I managed to clarify.

If to add property
Code: Pascal  [Select][+][-]
  1.   f.PopupParent: = Self;
that SplashForm in case of loss of focus won't "hide" under Parent.

The second and more correct way of solving the problem - is use of the ShowModal method. At the same time animation of SplashForm shall be realized through the TTimer component, but it is necessary to launch a flow in ParentForm.

http://s019.radikal.ru/i611/1704/ab/5d3225921433.gif

I hope, someone will be able to use this decision for the tasks
Win10 LTSC x64/Deb 12 amd64(gtk2)/Kubuntu(qt5)/Darwin Cocoa x86_64 (Sequoia):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 3.0.11; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

 

TinyPortal © 2005-2018