Description:
What is the best way to automatically show the popup window of a drop down editor within an EditorContainer?
Answer:
Updated
You can handle the ~ShownEditor event (e.g. TreeList.ShownEditor, GridView.ShownEditor, VGridControl.ShownEditor etc.) and invoke the ShowPopup method of the ~ActiveEditor (e.g. **GridView.ActiveEditor, TreeList.ActiveEditor, VGridControl.ActiveEditor**etc.) object. Below is code snippet which demonstrates how this event can be handled in general:
C#void ShownEditor(object sender, EventArgs e)
{
GridView view = sender as GridView;
view.GridControl.BeginInvoke(new MethodInvoker(() =>{
PopupBaseEdit edit = view.ActiveEditor as PopupBaseEdit;
if (edit == null) return;
edit.ShowPopup();
}));
}
Visual BasicPrivate Sub ShownEditor(ByVal sender As Object, ByVal e As EventArgs)
Dim view As GridView = TryCast(sender, GridView)
view.GridControl.BeginInvoke(New MethodInvoker(Sub()
Dim edit As PopupBaseEdit = TryCast(view.ActiveEditor, PopupBaseEdit)
If edit Is Nothing Then
Return
End If
edit.ShowPopup()
End Sub))
End Sub
This solution worked greate for me after a few small changes. I left out the exception and I wrapped the code in "if (MouseButtons == System.Windows.Forms.MouseButtons.None)" The popup was showing automatically already when the user clicked the editor, the problem was only when the cell gained focuse via keyboard input or forced by code.
Hi Jim,
Thank you for sharing your idea. Your point will be useful for other users. Thank you for your input regarding our products.
Hello, why it's necesary to Throw New DevExpress.Utils.HideException()?
Hello Laura,
This exception is internally handled by Grid in order to set MouseCaptureOwner to null. However, it's not necessary to throw a HideException exception for this task.
Should you have further questions, let me know.