Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Problem with "stay on top" and application task button (https://www.delphipraxis.net/165662-problem-stay-top-application-task-button.html)

WojTec 10. Jan 2012 16:53

Delphi-Version: 2010

Problem with "stay on top" and application task button
 
I have main window and modal window.
Modal window is set to be on top.
I create modal window, hide main and show modal one.
Modal window is not on top.

How:
- make modal window on top
- don't hide application button on task bar when hide main window
?

WojTec 11. Jan 2012 19:52

Re: Problem with "stay on top" and application task button
 
Anyone? Please :(

MGC 11. Jan 2012 20:58

AW: Problem with "stay on top" and application task button
 
Hello,

please don't Hide your MainForm, but set it's WindowState to wsMinimized. Then your TaskBar-Button should still be there and while your Modal-Form isn't closed, the user shouldn't be able to maximize the MainForm by clicking on the Taskbutton.

If your StayOnTop-Window is after minimizing not on the top then you can bring it to front again with Application.RestoreTopMosts.

Good luck. :thumb:

WojTec 12. Jan 2012 09:49

Re: Problem with "stay on top" and application task button
 
Thanks :) I used special class to fix "on top" (TStayOnTopFixer) I found some time ago on the Net and RestoreTopMosts() in form OnCreate and finally modal form is on top :D. But it don't wanted be on top without these 2 tricks. Is this VCL bug or Windows bug or I still doing something wrong?

MGC 13. Jan 2012 21:44

AW: Problem with "stay on top" and application task button
 
It's no bug, neither in Windows nor in Delphi. It's Delphi / VCL specific. If you create an application with Delphi-VCL you can't address your mainform directly. A message you send to the mainform will always be managed by the TApplication-Part.
You can test this behaviour if you create two seperate applications, hide the mainform in app 1 and your Task-Button disappears. Then send a SW_RESTORE or SW_SHOW message from app 2 to app 1 and you can see that your Task-Button will be shown again, but not your MainForm. To set it visible, you have to handle this message-event byself and show your mainform from inner your app 1 (Form1.show).
If you hide your mainform, it seems your application normalizes all the StayOnTops, too and your StayOnTop is not at the expected position (in front of all), so you have to restore it by calling Application.RestoreTopMosts.

I hope my english was well enough to explain the matters.

Greetings,


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:04 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz