How to implement an intellisense style popup window?
-
hi all, In Visual studio's code editor, when the intellisense window pops up, the focus always remains on the editor window (instead of jumping to the popup window, I think this could have been handled by a SetWindowPos call with SWP_NOACTIVATE), what has puzzled me so much is that if you mouse-click an item or even drag the vertical scroll bar on the popup window, the focus still remains, the cursor flashes at the last character you have typed. How is that possibly done?
-
hi all, In Visual studio's code editor, when the intellisense window pops up, the focus always remains on the editor window (instead of jumping to the popup window, I think this could have been handled by a SetWindowPos call with SWP_NOACTIVATE), what has puzzled me so much is that if you mouse-click an item or even drag the vertical scroll bar on the popup window, the focus still remains, the cursor flashes at the last character you have typed. How is that possibly done?
The trick is to set the focus back to the text control after the code completion window is shown and after scroll bar value changes.
//Code Completion Form
Control _parent = null;
void Show(Control parent) {
this.Show();
_parent = parent;
_parent.Focus();
}void ScrollValueChanged(.....) {
_parent.Focus();
} -
The trick is to set the focus back to the text control after the code completion window is shown and after scroll bar value changes.
//Code Completion Form
Control _parent = null;
void Show(Control parent) {
this.Show();
_parent = parent;
_parent.Focus();
}void ScrollValueChanged(.....) {
_parent.Focus();
}thank you Shameel. I think this is a good solution, but not a perfect one. And i don't think Microsoft Visual Studio team has done this by this means. Seems the popup window can never be activated, by that I mean either the window is of WS_EX_NOACTIVATE style or it responds WM_MOUSEACTIVATE by MA_NOACTIVATE. I made some test code on this using Winform. The popup window was made by a Form window hosting a ListBox window, I overrided the CreateParam to append the WS_EX_NOACTIVATE style for both two windows, I also overrided WndProc to make them respond WM_MOUSEACTIVATE by MA_NOACTIVATE. But all these didn't work:^^( Maybe I have misunderstood WS_EX_NOACTIVATE or WM_MOUSEACTIVATE?