Recent

Author Topic: [SOLVED] minimize one form, and other form disapper  (Read 9685 times)

mercury

  • Full Member
  • ***
  • Posts: 154
[SOLVED] minimize one form, and other form disapper
« on: September 30, 2015, 03:42:23 pm »
I have 2 forms in project. Form1 and Form2.
Both show when program start. (Visible = True)
When I minimize Form1. Form2 will disappear. And can't find it back anywhere.

Then I set Form2.ShowInTaskBar to stAlways.
When I minimize Form1. Form2 will disappear from TaskBar until open Form1 again.

So, I want Form2 shows like Form1, and never effected by Form1.
How can I do this?
Thank you.
« Last Edit: October 01, 2015, 04:59:30 am by mercury »

Handoko

  • Hero Member
  • *****
  • Posts: 5458
  • My goal: build my own game engine using Lazarus
Re: minimize one form, and other form disapper
« Reply #1 on: September 30, 2015, 04:04:46 pm »
Can you please share the code?

balazsszekely

  • Guest
Re: minimize one form, and other form disapper
« Reply #2 on: September 30, 2015, 04:14:51 pm »
1. Remove form2 from auto-create forms(project options)
2. Create form2 dynamically
3. Override the CreateParams procedure
Code: [Select]
//...
 TForm2 = class(TForm)
  protected
    procedure CreateParams(var params: TCreateParams);override;
    //...
  end;

//...

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(params);
  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
  Params.WndParent := GetDesktopWindow;
end;                         

mercury

  • Full Member
  • ***
  • Posts: 154
Re: minimize one form, and other form disapper
« Reply #3 on: September 30, 2015, 04:18:32 pm »

mercury

  • Full Member
  • ***
  • Posts: 154
Re: minimize one form, and other form disapper
« Reply #4 on: September 30, 2015, 04:33:36 pm »
1. Remove form2 from auto-create forms(project options)
2. Create form2 dynamically
3. Override the CreateParams procedure
Code: [Select]
//...
 TForm2 = class(TForm)
  protected
    procedure CreateParams(var params: TCreateParams);override;
    //...
  end;

//...

procedure TForm2.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(params);
  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
  Params.WndParent := GetDesktopWindow;
end;                         

Thank you very much.
But when I restore Form1, it shows behind Form2.
Is this any bug of LCL? This doesn’t happen in Linux.
I want 2 forms behavior completely dispart. Except adhesion in the taskbar when drag them. Like most program does.

derek.john.evans

  • Guest
Re: minimize one form, and other form disapper
« Reply #5 on: September 30, 2015, 04:43:08 pm »
Here is something I stumbled across.

I'm unsure why it works. Its 5 independent forms in one process. No Windows commands.

mercury

  • Full Member
  • ***
  • Posts: 154
Re: minimize one form, and other form disapper
« Reply #6 on: September 30, 2015, 04:52:01 pm »
Here is something I stumbled across.

I'm unsure why it works. Its 5 independent forms in one process. No Windows commands.

Where is Form1 ?!
Do you mean, don't use Form1. Then other forms will be independent ?

Well, I decided not badger this problem anymore. Anyway it works.
Thank for your solution.
« Last Edit: September 30, 2015, 04:56:40 pm by mercury »

derek.john.evans

  • Guest
Re: minimize one form, and other form disapper
« Reply #7 on: September 30, 2015, 04:58:15 pm »
Yep. For some reason if you set the main FormStyle := fsMDIChild;  , it doesn't show.

Then set the other forms with ShowInTaskBar := stAlways.

I guess you would also set the CloseAction of the other forms in OnClose:
Code: Pascal  [Select][+][-]
  1. procedure TForm3.FormClose(Sender: TObject; var CloseAction: TCloseAction);
  2. begin
  3.   CloseAction := caMinimize;
  4. end;    
  5.  

I'd be interested to see if it works under Linux.
« Last Edit: October 02, 2015, 02:55:03 am by Geepster »

mercury

  • Full Member
  • ***
  • Posts: 154
Re: minimize one form, and other form disapper
« Reply #8 on: September 30, 2015, 05:06:09 pm »
I'd be interested to see if it works under Linux.

Linux doesn’t have this problem. :)

And in Linux the Lazarus IDE shows all the forms in taskbar, I hope Windows do this too.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: [SOLVED] minimize one form, and other form disapper
« Reply #9 on: September 30, 2015, 06:57:41 pm »
I'd be interested to see if it works under Linux.

Linux doesn’t have this problem. :)
Problem? what problem? is it not expected when an application is minimized to be completely minimized and not leave various floating windows around? Are you telling me that if you minimize the IDE menubar on linux the rest of the windows stay unminimized?
As for the original question don't change the default behavior of windows with out a very good reason even then make sure that I can revert to the default behavior, in this case when the main form is minimized the application and all its open windows are minimized and that makes sense to me. How would you minimize the entire application in one click otherwise?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [SOLVED] minimize one form, and other form disapper
« Reply #10 on: October 01, 2015, 05:12:27 am »
As for the original question don't change the default behavior of windows with out a very good reason even then make sure that I can revert to the default behavior, in this case when the main form is minimized the application and all its open windows are minimized and that makes sense to me. How would you minimize the entire application in one click otherwise?

I just want make my program behavior like Firefox or other multi window program.
Each form behavior independent like a standalone program.
And I never want minimize the entire application in one click.

Here is my source. :)

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: [SOLVED] minimize one form, and other form disapper
« Reply #11 on: October 01, 2015, 05:39:38 am »
I just want make my program behavior like Firefox or other multi window program.
Each form behavior independent like a standalone program.
And I never want minimize the entire application in one click.

Tabbed GUI Interface = TDI = Tabbed Document Interface
https://en.wikipedia.org/wiki/Tab_%28GUI%29

Check if one of these solutions may help you:
http://wiki.freepascal.org/TTDINotebook
https://github.com/stavarengo/delphi-tdi

mercury

  • Full Member
  • ***
  • Posts: 154
Re: [SOLVED] minimize one form, and other form disapper
« Reply #12 on: October 01, 2015, 05:51:31 am »
Tabbed GUI Interface = TDI = Tabbed Document Interface
https://en.wikipedia.org/wiki/Tab_%28GUI%29

Check if one of these solutions may help you:
http://wiki.freepascal.org/TTDINotebook
https://github.com/stavarengo/delphi-tdi

I didn't mean multi-tab.
This problem has been already solved. See my source “333.zip”.

 

TinyPortal © 2005-2018