Preventing non active ViewPort scrolling with MultiColumnComboBoxCellTypes

Posted by: j2associates on 8 September 2017, 1:29 pm EST

  • Posted 8 September 2017, 1:29 pm EST

    Hello all,


    In certain situations, when multiple viewports are defined, clicking a multicolumncombobox will cause the column in viewport(0) to be scrolled into view. This is not desired behavior.


    As a work-around, I want to check all of the viewport left columns in the SubEditorOpening event and reset them. Is there a ViewPorts collection to iterate and if not, how is the best way to accomplish this? Thanks in advance for any ideas and/or suggestions!

  • Replied 8 September 2017, 1:29 pm EST

    Hello all,


    Here is a partial work-around. It works except for one situation. If I click directly on where the DropDown arrow would be, the ViewPort0 column is still scrolled into view.


    1. Declare private class level variable


        Private m_ViewPortInfo As New Dictionary(Of Integer, Integer)


    2. In CellClick event when RowHeader = False and ColumnHeader = False


        m_ViewPortInfo.Clear()
        With Me.FpSpread1
            For index As Integer = 0 To .GetColumnViewportCount - 1
                m_ViewPortInfo.Add(index, .GetViewportLeftColumn(index))
            Next
        End With


    3. In SubEditorOpening event


        For Each pair As KeyValuePair(Of Integer, Integer) In m_ViewPortInfo
            e.View.SetViewportLeftColumn(pair.Key, pair.Value)
        Next


    4. In SubEditorClosed event


        ' Work-around to keep multi column combo boxes in non active view ports from scrolling into view.
        For Each pair As KeyValuePair(Of Integer, Integer) In m_ViewPortInfo
            Me.FpSpread1.SetViewportLeftColumn(pair.Key, pair.Value)
        Next


    Enjoy...

  • Replied 8 September 2017, 1:29 pm EST

    j2 -

    I tried every way I could think of to reproduce this but I never see the MCC scroll into view when selecting it in another viewport.  Do you have a small project you could attach?

  • Replied 8 September 2017, 1:29 pm EST

    Hello BobM,


    Unfortunately, I do not. The project in question is 10,000+ lines and I have no easy way of cutting it down. Thanks for trying to reproduce the error.

Need extra support?

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

Learn More

Forum Channels