From 8e542cff6239982c601f45cac0ba20c7dd19ddd9 Mon Sep 17 00:00:00 2001 From: micha Date: Sat, 27 Dec 2003 16:47:18 +0000 Subject: [PATCH] fix dialogs owner handle, fixes focusing issue git-svn-id: trunk@4977 - --- lcl/interfaces/win32/win32int.pp | 6 +++++- lcl/interfaces/win32/win32object.inc | 27 +++++++++++++++++++++++++++ lcl/interfaces/win32/win32proc.inc | 16 +++------------- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/lcl/interfaces/win32/win32int.pp b/lcl/interfaces/win32/win32int.pp index e6103ef1ff..0a23a8fb45 100644 --- a/lcl/interfaces/win32/win32int.pp +++ b/lcl/interfaces/win32/win32int.pp @@ -71,7 +71,8 @@ Type FMessageFont: HFONT; Procedure CreateComponent(Sender: TObject); - Function RecreateWnd(Sender: TWinControl): Integer; virtual; + Function RecreateWnd(Sender: TWinControl): Integer; virtual; + Function GetOwnerHandle(ADialog : TCommonDialog): HWND; Function GetText(Sender: TComponent; Handle: HWND; var Data: String): Boolean; virtual; Procedure SetLabel(Sender: TObject; Data: Pointer); Procedure AddChild(Parent, Child: HWND); @@ -187,6 +188,9 @@ End. { ============================================================================= $Log$ + Revision 1.64 2003/12/27 16:47:18 micha + fix dialogs owner handle, fixes focusing issue + Revision 1.63 2003/12/19 18:18:17 micha fix window activation z-order diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 77a86ec987..89ea4d0f21 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -163,6 +163,30 @@ Begin Assert(False, 'Trace:Win32Object.Init - Exit'); End; +{------------------------------------------------------------------------------ + Method: TWin32Object.GetOwnerHandle + Params: ADialog - dialog to get 'guiding parent' window handle for + Returns: A window handle + + Returns window handle to be used as 'owner handle', ie. so that the user must + finish the dialog before continuing + ------------------------------------------------------------------------------} +function TWin32Object.GetOwnerHandle(ADialog : TCommonDialog): HWND; +begin + with ADialog do + begin + if Owner Is TWinControl then + Result := TWinControl(Owner).Handle +{ + // TODO: fix Application.Handle to be the same as FAppHandle + else if Owner Is TApplication then + Result := TApplication(Owner).Handle +} + else + Result := FAppHandle; + end; +end; + {------------------------------------------------------------------------------ Method: TWin32Object.GetText Params: Sender - The control to retrieve the text from @@ -2883,6 +2907,9 @@ End; { $Log$ + Revision 1.153 2003/12/27 16:47:18 micha + fix dialogs owner handle, fixes focusing issue + Revision 1.152 2003/12/27 16:26:55 micha remove redundant window property "lazarus" (from martin) diff --git a/lcl/interfaces/win32/win32proc.inc b/lcl/interfaces/win32/win32proc.inc index 08901b161d..7cfbf15c37 100644 --- a/lcl/interfaces/win32/win32proc.inc +++ b/lcl/interfaces/win32/win32proc.inc @@ -540,19 +540,6 @@ Begin Assert (False, 'Trace:[ObjectToHWND]****** Warning: handle = 0 *******'); End; -function GetOwnerHandle(ADialog : TCommonDialog): HWND; -begin - with ADialog do - begin - if Owner Is TWinControl then - Result := TWinControl(Owner).Handle - else if Owner Is TApplication then - Result := TApplication(Owner).Handle - else - Result := TWin32Object(InterfaceObject).FAppHandle; - end; -end; - (*********************************************************************** Widget member Functions ************************************************************************) @@ -748,6 +735,9 @@ End; { ============================================================================= $Log$ + Revision 1.34 2003/12/27 16:47:18 micha + fix dialogs owner handle, fixes focusing issue + Revision 1.33 2003/12/27 16:26:55 micha remove redundant window property "lazarus" (from martin)