1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed focus issue with popup error

This commit is contained in:
Brian Fiete 2020-09-04 08:58:29 -07:00
parent 25f44ae133
commit 7400e7099c

View file

@ -4465,8 +4465,26 @@ namespace IDE
ShowTab(panel, label, false, setFocus);
if (setFocus)
panel.FocusForKeyboard();
if ((!panel.mWidgetWindow.mHasFocus) && (!mRunningTestScript))
panel.mWidgetWindow.SetForeground();
{
bool hasFocus = false;
BFWindow activeWindow = GetActiveWindow(true);
BFWindow checkWindow = activeWindow;
while (checkWindow != null)
{
if (checkWindow == panel.mWidgetWindow)
{
activeWindow.SetForeground();
hasFocus = true;
break;
}
checkWindow = checkWindow.mParent;
}
if (!hasFocus)
panel.mWidgetWindow.SetForeground();
}
#endif
}
@ -5480,13 +5498,13 @@ namespace IDE
return null;
}
public WidgetWindow GetActiveWindow()
public WidgetWindow GetActiveWindow(bool allowModal = false)
{
for (let window in mWindows)
if (window.mHasFocus)
{
var result = window;
while ((result.mWindowFlags.HasFlag(.Modal)) && (result.mParent != null))
while ((result.mWindowFlags.HasFlag(.Modal)) && (result.mParent != null) && (!allowModal))
result = result.mParent;
return result as WidgetWindow;
}