ComboBoxCellType questions

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

  • Posted 8 September 2017, 1:14 pm EST

    Hello all,


    We have a bound spread and I need to use a ComboBoxCellType on a certain column. What is the best way to accomplish the following:  

    1. Set spread column width = the widest combo box item (which may or may not be present in the underlying data) + width of the combo box drop down arrow
    2. Set spread so combo box drop down arrow is only displayed when user clicks in cell
    3. Clear combo box if user clicks outside of spread with a combo box drop down arrow visible (mimicing behavior if the user clicked on another cell and changed active cell)

    Thanks in advance for any ideas and/or suggestions!

  • Replied 8 September 2017, 1:14 pm EST

    Hello,


    1) There is nothing built into the Spread to automatically resize the column width based on the data in the combobox list. You would need to programatically get the data from the list and use the MeasureString function of the Graphics object to determine the width of the longest text and then you can set that plus the width of the vertical scrollbar (same width as the dropdown arrow) to the width of the Column.


    2) You can set the ButtonDrawMode property as you want the combobo button to draw.

     
    		FpSpread1.ButtonDrawMode = FarPoint.Win.Spread.ButtonDrawModes.CurrentCell

     3) When the Spread control loses focus (you click off the Spread control), the Spread should cancel editmode and cause the editor (in this case a FpCombo control) to go away.

  • Replied 8 September 2017, 1:14 pm EST

    Thanks for the timely response! Are all of the CellType glyphs (eg DropDownArrow or UpDownSpinner) the width of the Vertical ScrollBar? When I click outside the spread on a different windows form control, the ComboBox DropDownArrow is not cleared. Can I clear it programmatically in one of the Spread events and, if so, which one would be best? Thanks in advance for any ideas and/or suggestions!
  • Replied 8 September 2017, 1:14 pm EST

    Hello,


    The width is equal to SystemInformation.VerticalScrollBarWidth.


    You must have ButtonDrawMode set to Current cell. Clicking off of the Spread will keep the active cell, so the button will stay drawn. You can move the active cell when the Spread loses focus if you do not want this behavior.

  • Replied 8 September 2017, 1:14 pm EST

    Can I clear the ActiveCell somehow? I don't necessarily want to move it, just clear it so the DropDownArrow disappears when I click outside of the spread.
  • Replied 8 September 2017, 1:14 pm EST

    Hello,


    There is always an active cell. There is not a way to clear this. You can set the active cell to a hidden cell, so it looks like it is cleared.

Need extra support?

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

Learn More

Forum Channels