Prevent Cell Dropdown

Posted by: rene1983 on 8 September 2017, 2:36 pm EST

  • Posted 8 September 2017, 2:36 pm EST

    Can I prevent a ComboBoxCellType cell from performing the drop down until only the [V] (down arrow) button is clicked?

  • Replied 8 September 2017, 2:36 pm EST


    If the combo box is editable (ComboBoxCellType.Editable), then it should not automatically drop down the list, but if it is not editable, it will show the list when clicked (like a regular ComboBox drop-down list works).  The drop down is also shown when the user pressed Alt+[down arrow], so you would need to implement code to suppress that keystroke in the keyboard events if you do not want the user to be able to do it.

  • Replied 8 September 2017, 2:36 pm EST


     Can I make it drop down only when the [V] down arrow button is pressed and not when double-clicked?

  • Replied 8 September 2017, 2:36 pm EST


    You should be able to drop down the combo list when a user clicks on a dropdown button by creating a customcelltype and overriding isReservedLocation() method.The IsReservedLocation method determine the single click behavior over a
    cell. I have passed the drop down button area as the rectangular area.
    This is what all needs to be passed to the method,

    Here is a sample code that may help you in understanding the above mentioned method,

    Public Class customcombo
        Inherits FarPoint.Win.Spread.CellType.ComboBoxCellType
    Public Overrides Function IsReservedLocation(ByVal g As
    System.Drawing.Graphics, ByVal x As Integer, ByVal y As Integer, ByVal
    rc As System.Drawing.Rectangle, ByVal appearance As
    FarPoint.Win.Spread.Appearance, ByVal value As Object, ByVal zoomFactor
    As Single) As Object
            Dim r As New Rectangle(rc.X + rc.Width -
    SystemInformation.VerticalScrollBarWidth, rc.Y,
    SystemInformation.VerticalScrollBarWidth, rc.Height)

            If r.Contains(x, y) Then
                Return Me
                Return Nothing
            End If
        End Function
    End Class




Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels