Search code examples
winformsms-worddevexpressoffice-interop

WinForms control not getting clicks until tried 5 - 15 times


This is really difficult because any simple example works. In addition, our complex dialog works fine if not called during a drag/drop. So it's only in the large complex use case that we have this problem.

We have a dialog that has a DevExpress GridView in it (shown below). This is part of our Office AddIn (COM API, not VSTO). If we bring up the dialog when a user clicks a menu button - it works fine. But our use case is the user performs a drag/drop from a form in our AddIn to drop in the Word document.

We then pop up the dialog (form) for the user to select what columns they want to drop. So we're in the middle of a drag/drop in this case.

The bug: For Word 365 on Windows 10 (is fine on Excel & PowerPoint; is fine on older versions of Office), you need to click around in the dialog 5 - 10 times before clicking on a check box works. In addition, making programatic calls to select cells in the grid doesn't help.

I don't think the issue is DevExpress as this dialog works fine outside of the drag-drop use case. And works fine in it once it's been clicked enough. On the first click the little pencil appears on the left. Once a click works, the pencil goes away and the row is then marked as selected.

I think something needs to be done to get the message queue working right, going to the right control, etc. I've tried programatic calls to select controls, cells in the grid view, checking & unchecking the checkbox, etc. None of those have worked.

I'm posting here in the hope that someone else has hit something similar and found a sequence of calls to get the message pump working right.

We asked DevExpress - but it doesn't look like it's their issue.

We call this inside our IDataObject.GetData() method. In the method the code to call the dialog is:

using (DataBinSelectCols dlg = new DataBinSelectCols(root.Children))
{
    if (dlg.ShowDialog() == DialogResult.Cancel)
        return null;
    nodesToUse = dlg.SelectedNodes;
}

enter image description here


Solution

  • And the answer is it's a setting in Word. In the options select as shown here:

    enter image description here