Re: [Lazarus] How to minimize application showing modal form(s)
On 12/04/2014 23:02, Frank Poretzky wrote: Apart from FindComponent, which makes an application with lots of modal windows very complex, I tried various versions of > ... with a corresponding AppOnMinimize() procedure. None of them worked well, especially with the modal sub-sub-form scenario described above. As Zeljko pointed out, you have uncovered a bug. If it is not addressed in trunk, you should raise the issue in the Mantis bugtracker so it gets nailed. Then unsatisfactory workarounds would not be needed. Howard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] How to minimize application showing modal form(s)
Hi Howard, on Sat, 12 Apr 2014 18:13:08 +0100, you wrote: >On 12/04/2014 17:06, Frank Poretzky wrote: >> Is there a way to modify my modal form to get it minimized as well? > >Create your modal form with the main form as its owner, and give it a >unique Name at creation. >In your main form's declaration set up two Application handlers, >OnMinimize and OnRestore (of type TNotifyEvent), and hook them up in >your main form's OnCreate code. >In the OnMinimize and OnRestore handler implementations use >FindComponent (or some other means) to locate your previously named >modal form, and either Hide it or Show it as appropriate. Apart from FindComponent, which makes an application with lots of modal windows very complex, I tried various versions of procedure TFormMain.AppOnRestore( Sender: TObject); var posit : integer; begin for posit := 0 to Screen.FormCount - 1 do begin if Screen.Forms[ posit].WindowState = wsMinimized // if Screen.Forms[ posit].FormState <> [fsFirstShow] then Screen.Forms[ posit].WindowState := wsNormal; // Screen.Forms[ posit].Show; // end; end; with a corresponding AppOnMinimize() procedure. None of them worked well, especially with the modal sub-sub-form scenario described above. Many thanks Frank -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] How to minimize application showing modal form(s)
On 04/12/2014 06:06 PM, Frank Poretzky wrote: Hi! In an SDI application I open a modal form with .ShowModal and from there a dialog window with Dialogs.MessageDlg(). Now, when I call Application.Minimize with a TrayIcon.OnClick() event the main form and the message dialog disappear, whereas my custom modal form in-between remains visible. Is there a way to modify my modal form to get it minimized as well? object FormModal: TFormModal Left = 372 Height = 159 Top = 162 Width = 297 Caption = 'Modal Form' ClientHeight = 159 ClientWidth = 297 LCLVersion = '1.0.14.0' object B_MsgDlg: TButton Left = 72 Height = 25 Top = 60 Width = 147 Caption = 'Open Message Dialog' OnClick = DoOnClickMsgDlg TabOrder = 0 end end Lazarus 1.0.14 / FPC 2.6.2 / SVN Rev 43446 / i386-win32-win32/win64 Application.Minimize should minimize all visible forms of application. If it doesn't work so it could be the bug, also it could be fixed in trunk. zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] How to minimize application showing modal form(s)
On 12/04/2014 17:06, Frank Poretzky wrote: Is there a way to modify my modal form to get it minimized as well? Create your modal form with the main form as its owner, and give it a unique Name at creation. In your main form's declaration set up two Application handlers, OnMinimize and OnRestore (of type TNotifyEvent), and hook them up in your main form's OnCreate code. In the OnMinimize and OnRestore handler implementations use FindComponent (or some other means) to locate your previously named modal form, and either Hide it or Show it as appropriate. Howard -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus