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
Conversation
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.
May want to wait on a release build until the 'Everything' changes are in. |
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); |
There was a problem hiding this comment.
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);
}
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.