Hi, we've noticed misc focus issues including a couple that seem to be due to the InteropFocusTracking.SetIsEnabled workaround itself.
- Ctrl+Tab window navigator popup doesn't handle arrow key input if the active toolwindow is hosting a winforms control via WindowsFormsHost, and it has focus. You can reproduce this via the "window 1" toolwindow in Simple IDE sample when the node is selected after adding the code below and calling in Constructor.
- In the same modified sample, if the winform treeview has LabelEdit set to true, if you select the "A Node" node, then move focus to another toolwindow, then click back on "A Node" (toolwindow will have to have been changed to non-autohide beforehand) it seems to activate the window as well as place the node in edit, with that single click. This does not occur if InteropFocusTracking.SetIsEnabled is not performed.
- Something odd is also affecting a 3rd party winforms grid control of ours when it is hosted in a toolwindow - as soon as a cell is placed into edit via clicking (if edit initiated via keyboard e.g. F2 there is no issue), it seems focus is shifted elsewhere temporarily and the editor control's LostFocus event is raised. If InteropFocusTracking.SetIsEnabled is disabled, then editing is fine and it works as it did under WinForms. At the point when the cell editor control loses focus, MainWindow.IsKeyboardFocusWithin will return false, and System.Windows.Input.Keyboard.FocusedElement returns null. Calling user32 GetFocus returns a hwnd that appears to be an unmanaged control...what exactly does InteropFocusTracking.SetIsEnabled do that might be causing this?
Private Sub DockTest() Me.dockSite.UseHostedPopups = False Me.dockSite.IsLiveSplittingEnabled = False Dim f As New System.Windows.Forms.Form Dim tv As New System.Windows.Forms.TreeView Dim tn As New System.Windows.Forms.TreeNode("A Node") f.FormBorderStyle = Forms.FormBorderStyle.None tv.Location = New Drawing.Point(0, 25) tv.LabelEdit = True tv.Nodes.Add(tn) tv.Dock = Forms.DockStyle.Fill f.Controls.Add(tv) Dim ts As New System.Windows.Forms.ToolStrip Dim tb As New System.Windows.Forms.ToolStripButton tb.Text = "A Button" tb.DisplayStyle = Forms.ToolStripItemDisplayStyle.Text ts.Items.Add(tb) ts.Dock = Forms.DockStyle.Top ts.Location = New Drawing.Point(0, 0) f.Controls.Add(ts) AddHandler tb.Click, Sub(ByVal sender As Object, ByVal e As EventArgs) MessageBox.Show("Hello") End Sub Dim wfh As New System.Windows.Forms.Integration.WindowsFormsHost Dim tw As New ToolWindow(dockSite, "1", "window1", Nothing, wfh) InteropFocusTracking.SetIsEnabled(wfh, True) f.Dock = Forms.DockStyle.Fill f.TopLevel = False wfh.Child = f tw.Activate() tw.Dock(tabbedMdiHost, ActiproSoftware.Windows.Controls.Side.Bottom) tw.AutoHide(ActiproSoftware.Windows.Controls.Side.Bottom) End Sub
[Modified 4 years ago]