Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
How to drop a Text Editor dropdown button in a Grid
posted

I have a grid where one column is tied to an UltraTextEditor control and that control has a DropDownEditorButton which shows a small grid of data for the user to pick from. This all works fine but I want the dropdown to respond to the standard F4 key and I can't get this to work. If the Dropdown is dropped I can make it close up by calling the DropDownManager directly. However, if it is not dropped, I can't make it drop. It refuses saying the edit control must be in edit mode. I have tried to force the control into edit mode but without success.

Can anyone suggest a fix for this?

----------------------------------------------

Private Sub ugQuoteLines_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ugQuoteLines.KeyUp 

    If e.KeyCode = Keys.F4 AndAlso ugQuoteLines.ActiveCell.Column.Key = "ProductCode" Then
        Dim objTextEditor As UltraTextEditor = _
              CType(ugQuoteLines.ActiveCell.EditorComponentResolved, UltraTextEditor)
        Dim objButton As DropDownEditorButton = _
              CType(objTextEditor.ButtonsRight("Find"), DropDownEditorButton)

        If objButton.IsDroppedDown Then
            DropDownManager.CloseDropDown(Nothing)
        Else
            ' TODO: Won't drop down if editor is not in edit mode
            'objButton.DropDown()
        End If

     End If

End Sub

Parents
No Data
Reply
  • 71886
    Offline posted

    Hello SLJones,

    Could you please try the following code sample, which is a modified version of yours and is working fine for me:

     

            If e.KeyCode = Keys.F4 AndAlso ugQuoteLines.ActiveCell.Column.Key = "ProductCode" Then
    
                Dim objTextEditor As EmbeddableEditorButtonBase = DirectCast(ugQuoteLines.ActiveCell.EditorResolved, EmbeddableEditorButtonBase)
    
                Dim objButton As DropDownEditorButton = _
                      CType(objTextEditor.ButtonsRight("Find"), DropDownEditorButton)
    
                If objButton.IsDroppedDown Then
                    DropDownManager.CloseDropDown(Nothing)
                Else
                    objButton.DropDown()
                End If
    
            End If
    

     

    Please do not hesitate to ask if something comes up.

Children
No Data