From a793b4fa1f1da09ccf2f37024d237fb8952d20a7 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 21 Mar 2012 01:24:02 +0000 Subject: [PATCH] win32: reimplement AppBringToFront - it should take care about MainFormOnTaskBar property and it should set the last active window as a foreground window generally git-svn-id: trunk@36181 - --- lcl/interfaces/win32/win32object.inc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 278d12f86c..b7274d20e3 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -205,9 +205,18 @@ end; Brings the entire application on top of all other non-topmost programs ------------------------------------------------------------------------------} procedure TWin32WidgetSet.AppBringToFront; +var + Window: HWND; begin - if (FAppHandle <> 0) and not (Assigned(Application) and Application.MainFormOnTaskBar) then - Windows.SetForegroundWindow(FAppHandle); + if Assigned(Screen) and Assigned(Screen.ActiveCustomForm) and Screen.ActiveCustomForm.HandleAllocated then + Window := Screen.ActiveCustomForm.Handle + else + if Assigned(Application) and Application.MainFormOnTaskBar then + Window := Application.MainFormHandle + else + Window := FAppHandle; + if (Window <> 0) and IsWindowVisible(Window) and IsWindowEnabled(Window) then + Windows.SetForegroundWindow(Window); end; procedure TWin32WidgetSet.SetDesigning(AComponent: TComponent);