Skip to content

Commit

Permalink
Also stop activating panes on setting the selection in VB6
Browse files Browse the repository at this point in the history
  • Loading branch information
MDoerner committed Feb 13, 2019
1 parent b01f450 commit eb592a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
33 changes: 1 addition & 32 deletions Rubberduck.VBEditor.VB6/SafeComWrappers/VB/CodePane.cs
@@ -1,6 +1,4 @@
using System;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
using Rubberduck.VBEditor.WindowsApi;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
using VB = Microsoft.Vbe.Interop.VB6;

// ReSharper disable once CheckNamespace - Special dispensation due to conflicting file vs namespace priorities
Expand Down Expand Up @@ -90,35 +88,6 @@ private void SetSelection(int startLine, int startColumn, int endLine, int endCo
return;
}
Target.SetSelection(startLine, startColumn, endLine, endColumn);
ForceFocus();
}

private void ForceFocus()
{
if (IsWrappingNullReference)
{
return;
}

Show();

using (var vbe = VBE)
using (var mainWindow = vbe.MainWindow)
using (var window = Window)
{
var mainWindowHandle = mainWindow.Handle();
var handle = mainWindow.Handle().FindChildWindow(window.Caption);

if (handle != IntPtr.Zero)
{
NativeMethods.ActivateWindow(handle, mainWindowHandle);
}
else
{
_logger.Debug(
"CodePane.ForceFocus() failed to get a handle on the MainWindow.");
}
}
}

public void Show()
Expand Down
4 changes: 1 addition & 3 deletions Rubberduck.VBEditor.VBA/SafeComWrappers/VB/CodePane.cs
@@ -1,6 +1,4 @@
using System;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
using Rubberduck.VBEditor.WindowsApi;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
using VB = Microsoft.Vbe.Interop;

// ReSharper disable once CheckNamespace - Special dispensation due to conflicting file vs namespace priorities
Expand Down

0 comments on commit eb592a1

Please sign in to comment.