|
From: Peter T. <pe...@us...> - 2004-12-18 12:10:38
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14103/run Modified Files: JvDesktopAlert.pas JvDesktopAlertForm.pas Log Message: - Set focus to last control that had focus isto to the last form/window Index: JvDesktopAlertForm.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvDesktopAlertForm.pas,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** JvDesktopAlertForm.pas 10 Sep 2004 19:26:33 -0000 1.25 --- JvDesktopAlertForm.pas 18 Dec 2004 12:10:26 -0000 1.26 *************** *** 83,86 **** --- 83,87 ---- {$IFDEF VCL} procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST; + procedure WMActivate(var Message: TWMActivate); message WM_ACTIVATE; {$ENDIF VCL} *************** *** 114,117 **** --- 115,119 ---- CaptionColorTo: TColor; FrameColor: TColor; + AllowFocus:boolean; constructor Create(AOwner: TComponent); override; procedure acCloseExecute(Sender: TObject); *************** *** 287,290 **** --- 289,299 ---- inherited; end; + + procedure TJvFormDesktopAlert.WMActivate(var Message: TWMActivate); + begin + if (Message.Active = WA_INACTIVE) or AllowFocus then + inherited; + end; + {$ENDIF VCL} *************** *** 627,630 **** --- 636,640 ---- {$ENDIF UNITVERSIONING} + initialization {$IFDEF UNITVERSIONING} Index: JvDesktopAlert.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvDesktopAlert.pas,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** JvDesktopAlert.pas 18 Dec 2004 07:40:43 -0000 1.31 --- JvDesktopAlert.pas 18 Dec 2004 12:10:26 -0000 1.32 *************** *** 702,706 **** ARect: TRect; I, X, Y: Integer; ! FActiveWindow: HWND; procedure CenterForm(AForm: TForm; ARect: TRect); --- 702,706 ---- ARect: TRect; I, X, Y: Integer; ! FActiveWindow, FActiveFocus: HWND; procedure CenterForm(AForm: TForm; ARect: TRect); *************** *** 812,821 **** Location.Position := GetStacker.Position; if not AutoFocus then ! FActiveWindow := GetActiveWindow else FActiveWindow := NullHandle; FDesktopForm.Show; ! if not AutoFocus and (FActiveWindow <> NullHandle) then ! SetActiveWindow(FActiveWindow); GetStacker.Add(FDesktopForm); end; --- 812,833 ---- Location.Position := GetStacker.Position; if not AutoFocus then ! begin ! FActiveFocus := GetFocus; ! FActiveWindow := GetActiveWindow; ! end else + begin FActiveWindow := NullHandle; + FActiveFocus := NullHandle; + end; + FDesktopForm.AllowFocus := AutoFocus; FDesktopForm.Show; ! if not AutoFocus and (FActiveFocus <> GetFocus) then ! begin ! if (FActiveWindow <> NullHandle) then ! SetActiveWindow(FActiveWindow); ! if (FActiveFocus <> NullHandle) then ! SetFocus(FActiveFocus); ! end; GetStacker.Add(FDesktopForm); end; |