Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mods to Preview Window #295

Merged
merged 1 commit into from Apr 9, 2018
Merged

Mods to Preview Window #295

merged 1 commit into from Apr 9, 2018

Conversation

doug24
Copy link
Contributor

@doug24 doug24 commented Mar 31, 2018

Select first match in file (#294)
Remove main window activation handler, and replace with call to SetWindowPos to bring preview window to front when a new file or line is selected in the main window.
Increase file size check for previewing files (#293)
Keep preview window open when the options or test window opens (#250)
Add null value check when removing grep engines.

Select first match in file (dnGrep#294)
Remove main window activation handler, and replace with call to SetWindowPos to bring preview window to front when a new file or line is selected in the main window.
Increase file size check for previewing files (dnGrep#293)
Keep preview window open when the options or test window opens (dnGrep#250)
Add null value check when removing grep engines.
@doug24
Copy link
Contributor Author

doug24 commented Mar 31, 2018

May want to wait on a release build until the 'Everything' changes are in.

@JVimes
Copy link
Contributor

JVimes commented Apr 2, 2018

I'll try to review this soon. Thanks!


public static void BringToFront(IntPtr hWnd)
{
SetWindowPos(hWnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is SetWindowPos the right way to bring to front?

Here's how I did it in the past:

    public static void BringToFront(Window window)
    {
        window.Dispatcher.BeginInvoke(
            new Action(() => window.Activate()),
            System.Windows.Threading.DispatcherPriority.ContextIdle, null);
    }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure my way is better, though. Just thought I'd ask your opinion. I wonder if SetWindowPos is going to interfere with x/y position? I use window snapping/positioning tools a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a number of different ways, including Activate. I didn't call it they way you have shown here in a dispatcher action, however. It did something I didn't like, but I don't remember exactly what at the moment. The second argument to SetWindowPos is 'HWND_TOP' - places the window at the top of the Z order, but not TopMost. The SWP_NOMOVE should keep it in the same location. Give it a try and let me know what you think. We can always change it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. Thanks for trying all that out.

@JVimes JVimes merged commit 79d2daf into dnGrep:master Apr 9, 2018
@doug24 doug24 deleted the preview-window branch April 11, 2018 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants