Bug in 3.x MultiColumnCellType

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

  • Posted 8 September 2017, 1:15 pm EST

    Hello all,


    1. In the attached sample project, scroll to the last 2 columns which have been set to MultiColumnComboBoxCellTypes. If you select the first item in the list, it is not displayed in the spread cell until you click away from the cell. All other items are displayed when the combo box is closed. It is using 3.0.2007.2005.


    2. I want to set the column width to the width of the longest string in the list plus the DropDownArrow so that the horizontal scroll bar is not displayed. Am I missing something in my GetWidth method?


    Thanks in advance for any ideas and/or suggestions!


    2008/05/CalulatedListWidth.zip
  • Replied 8 September 2017, 1:15 pm EST

    Duh ;-(. Sorry, I attached it to the original post.
  • Replied 8 September 2017, 1:15 pm EST

    j2 -

    You forgot to attach your example.
  • Replied 8 September 2017, 1:15 pm EST

    j2 -

    1)  I am not seeing this issue.  When I click on the button the dropdown list appears and if I select Snake then it is placed in the cell w/o me clicking on another cell.

    2)  Yes, I see the scrollbars but I think that is because you are seeing the gray area of the spread that is used as the dropdown.  I do not see a way to get rid of that.
  • Replied 8 September 2017, 1:15 pm EST

    Hello BobM,


    When I run it and select the first item in the list by clicking it, 1.) the combo box closes but the cell displays empty with just the drop down arrow until I click on another cell and 2.) When the combo box is dropped, horizontal scrollbars are visible at the bottom of the list.

  • Replied 8 September 2017, 1:15 pm EST

    j2 -

    I do not see any issues with the project you attached.  The selected value from the combobox is immediately put in the cell and the width looks correct to me(e.g. Snake is completely shown in the last column).
  • Replied 8 September 2017, 1:15 pm EST

    Hello ScottS,


    Thanks for the response and sample code! I wasn't aware that a maintenance update had been released. Is there an automatic notification list I can join? Thanks!

  • Replied 8 September 2017, 1:15 pm EST

    Hey ScottS,


    As always, thanks for such a practical, though subtle, solution!

  • Replied 8 September 2017, 1:15 pm EST

    Hello,


    The height of the SubEditor is what is changing and requiring the vertical scrollbar to appear. Once this appears, it makes the viewport of the Spread narrower which causes the need for the horizontal scrollbar. If you change your code for hiding the ColumnHeader, then this will work as you expect.


    .ColumnHeader.Rows(0).Height = 0 'Visible = False

  • Replied 8 September 2017, 1:15 pm EST

    I added ScottS' code as above with some addtioonal debugging logic as below:

    Private Sub FpSpread1_SubEditorOpening(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.SubEditorOpeningEventArgs) Handles FpSpread1.SubEditorOpening
    Try
    Debug.WriteLine("")
    Debug.WriteLine("Before: " & Me.FpSpread1.ActiveSheet.Columns(e.Column).Width.ToString)
    With DirectCast(e.SubEditor, Spread.FpSpread).ActiveSheet
    .ColumnHeader.Visible = False
    .Columns(0).Width = Me.FpSpread1.ActiveSheet.Columns(e.Column).Width - 5
    End With
    Debug.WriteLine("After: " & Me.FpSpread1.ActiveSheet.Columns(e.Column).Width.ToString)
    Catch ex As Exception
    Throw
    End Try
    End Sub
    'FpSpread1_SubEditorOpening

    I wanted to get rid of the column headers in the SubEditor when the combo box dropped so I added the line to set ColumnHeader.Visible = False. As soon as I did that, both Vertical and Horizontal ScrollBars appeared in the combo box. If I commented that line out, neither ScrollBars appeared and the combo box displayed correctly. The debugging code demonstrated that the width of the column itself did not change. Attached is a jpeg showing the difference in appearance. Thanks!


    2008/05/WhatISee2.JPG
  • Replied 8 September 2017, 1:15 pm EST

    Hello BobM,


    The first issue only appears if you select the first item in the list (eg A or Dog). If you change the GetWidth method to


    Return Convert.ToInt32(Math.Round(maxWidth)) + SystemInformation.VerticalScrollBarWidth + 100


    then the Face column still displays with the horizontal scroll bars but the Pet column displays without them. I am guessing that this is because the sub editor is displaying with column header word wrap set to False so you get the odd widths that seem to be based on cell type rather than actual data or header text.


    I have attached a jpeg where the first 3 forms represent GetWidth with + 1and the last composite screen shows the latter situation above where GetWidth was changed to + 100.


    2008/05/WhatISee.zip
  • Replied 8 September 2017, 1:15 pm EST

    Hello,


    This was a bug in the previous release that has been fixed in the latest maintenance release (3.0.2008). The second issue has to do with the column width of the first column of the dropdown. You can resize this column to the size you calculated for the parent column to get rid of this scrollbar.

     
      Private Sub FpSpread1_SubEditorOpening(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.SubEditorOpeningEventArgs) Handles FpSpread1.SubEditorOpening
    Dim ss As FarPoint.Win.Spread.FpSpread = CType(e.SubEditor, FarPoint.Win.Spread.FpSpread)
    ss.ActiveSheet.Columns(0).Width = FpSpread1.ActiveSheet.Columns(e.Column).Width - 5
    End Sub
     
Need extra support?

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

Learn More

Forum Channels