unit uROPleaseWaitForm; {----------------------------------------------------------------------------} { RemObjects SDK Library - Delphi IDE Integration } { } { compiler: Delphi 5 and up, Kylix 2 and up } { platform: Win32, Linux } { } { (c)opyright RemObjects Software. all rights reserved. } { } { Using this code requires a valid license of the RemObjects SDK } { which can be obtained at http://www.remobjects.com. } {----------------------------------------------------------------------------} {$I RemObjects.inc} interface uses {$IFDEF MSWINDOWS}Windows,{$ELSE}Libc,{$ENDIF} Messages, SysUtils, Classes, Graphics, Controls, Forms, {$IFDEF FPC} LResources, lmessages,{$ENDIF} Dialogs, StdCtrls, ExtCtrls; type TPleaseWaitForm = class(TForm) lbl_Caption: TLabel; img_Logo: TImage; procedure FormShow(Sender: TObject); procedure FormHide(Sender: TObject); private fWindowList:pointer; public constructor Create(iOwner: TComponent; const iCaption:string=''; const iHeader:string=''; iBitmap:TBitmap=nil; iFreeBitmap:boolean=false); reintroduce; procedure Show(const iCaption:string=''); reintroduce; procedure Hide; reintroduce; end; var PleaseWaitForm: TPleaseWaitForm; implementation {$IFNDEF FPC} {$R *.dfm} {$ENDIF} { TPleaseWaitForm } constructor TPleaseWaitForm.Create(iOwner: TComponent; const iCaption:string=''; const iHeader:string=''; iBitmap:TBitmap=nil; iFreeBitmap:boolean=false); begin inherited Create(iOwner); if iHeader <> '' then Caption := iHeader; lbl_Caption.Caption := iCaption; if Assigned(iBitmap) then begin img_Logo.Picture.Assign(iBitmap); if iFreeBitmap then iBitmap.Free(); end; img_Logo.Top := (ClientHeight-img_Logo.Height) div 2; img_Logo.Left := img_Logo.Top; lbl_Caption.Left := img_Logo.Width+ (img_Logo.Left*2); ClientWidth := lbl_Caption.Left+lbl_Caption.Width+img_Logo.Left; end; procedure TPleaseWaitForm.Show(const iCaption:string=''); begin if iCaption <> '' then begin lbl_Caption.Caption := iCaption; ClientWidth := lbl_Caption.Left+lbl_Caption.Width+8; end; inherited Show(); Application.ProcessMessages(); end; procedure TPleaseWaitForm.Hide; begin inherited Hide(); Application.ProcessMessages(); end; procedure TPleaseWaitForm.FormShow(Sender: TObject); begin {$IFNDEF LINUX} SendMessage(Handle, CM_ACTIVATE, 0, 0); {$ENDIF} {$IFNDEF FPC} fWindowList := DisableTaskWindows(0); {$ENDIF FPC} end; procedure TPleaseWaitForm.FormHide(Sender: TObject); begin {$IFNDEF LINUX} SendMessage(Handle, CM_DEACTIVATE, 0, 0); {$ENDIF} {$IFNDEF FPC} EnableTaskWindows(fWindowList); {$ENDIF FPC} end; initialization {$IFDEF FPC} {$I uROPleaseWaitForm.lrs} {$ENDIF} end.