root / Client / UfrmInitialize.pas @ 0:95bd93c28625
History | View | Annotate | Download (2.3 kB)
| 1 | (*
|
|---|---|
| 2 | * CDDL HEADER START |
| 3 | * |
| 4 | * The contents of this file are subject to the terms of the |
| 5 | * Common Development and Distribution License, Version 1.0 only |
| 6 | * (the "License"). You may not use this file except in compliance |
| 7 | * with the License. |
| 8 | * |
| 9 | * You can obtain a copy of the license at |
| 10 | * http://www.opensource.org/licenses/cddl1.php. |
| 11 | * See the License for the specific language governing permissions |
| 12 | * and limitations under the License. |
| 13 | * |
| 14 | * When distributing Covered Code, include this CDDL HEADER in each |
| 15 | * file and include the License file at |
| 16 | * http://www.opensource.org/licenses/cddl1.php. If applicable, |
| 17 | * add the following below this CDDL HEADER, with the fields enclosed |
| 18 | * by brackets "[]" replaced with your own identifying * information: |
| 19 | * Portions Copyright [yyyy] [name of copyright owner] |
| 20 | * |
| 21 | * CDDL HEADER END |
| 22 | * |
| 23 | * |
| 24 | * Portions Copyright 2007 Andreas Schneider |
| 25 | *) |
| 26 | unit UfrmInitialize;
|
| 27 | |
| 28 | {$mode objfpc}{$H+} |
| 29 | |
| 30 | interface
|
| 31 | |
| 32 | uses
|
| 33 | Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls, |
| 34 | StdCtrls, LCLIntf, LCLType, WSForms; |
| 35 | |
| 36 | type
|
| 37 | |
| 38 | { TfrmInitialize }
|
| 39 | |
| 40 | TfrmInitialize = class(TForm)
|
| 41 | lblStatus: TLabel; |
| 42 | pnlMain: TPanel; |
| 43 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
| 44 | procedure FormCreate(Sender: TObject);
|
| 45 | protected
|
| 46 | FActiveWindow: HWND; |
| 47 | FModal: Boolean; |
| 48 | public
|
| 49 | procedure SetModal;
|
| 50 | procedure UnsetModal;
|
| 51 | end;
|
| 52 | |
| 53 | var
|
| 54 | frmInitialize: TfrmInitialize; |
| 55 | |
| 56 | implementation
|
| 57 | |
| 58 | { TfrmInitialize }
|
| 59 | |
| 60 | procedure TfrmInitialize.FormClose(Sender: TObject;
|
| 61 | var CloseAction: TCloseAction);
|
| 62 | begin
|
| 63 | CloseAction := caNone; |
| 64 | end;
|
| 65 | |
| 66 | procedure TfrmInitialize.FormCreate(Sender: TObject);
|
| 67 | begin
|
| 68 | FModal := False; |
| 69 | end;
|
| 70 | |
| 71 | procedure TfrmInitialize.SetModal;
|
| 72 | begin
|
| 73 | if FModal then Exit; |
| 74 | FActiveWindow := GetActiveWindow; |
| 75 | TWSCustomFormClass(WidgetSetClass).ShowModal(Self); |
| 76 | {FormStyle := fsStayOnTop;
|
| 77 | Screen.MoveFormToFocusFront(Self); |
| 78 | Screen.MoveFormToZFront(Self);} |
| 79 | FModal := True; |
| 80 | end;
|
| 81 | |
| 82 | procedure TfrmInitialize.UnsetModal;
|
| 83 | begin
|
| 84 | if not FModal then Exit; |
| 85 | TWSCustomFormClass(WidgetSetClass).CloseModal(Self); |
| 86 | if FActiveWindow <> 0 then SetActiveWindow(FActiveWindow); |
| 87 | FActiveWindow := 0;
|
| 88 | //FormStyle := fsNormal;
|
| 89 | FModal := False; |
| 90 | end;
|
| 91 | |
| 92 | initialization
|
| 93 | {$I UfrmInitialize.lrs}
|
| 94 | |
| 95 | end.
|
| 96 |