Multiple ComboCell Selection

Posted by: griswald88 on 8 September 2017, 12:41 pm EST

  • Posted 8 September 2017, 12:41 pm EST

    If I have a combo cell type with choices A,B,C,D. If the user selects "A" from the combo, it places the "A" as the cell's text as expected. What I would like to emulate is if the user clicks in the same cell and selects "B" that the cell would now display both "A,B". If the user selects "B" again then the cell would display just "A". What is the best way to accomplish this effect? Thanks!!

  • Replied 8 September 2017, 12:41 pm EST

    griswald88 -

    Those events should work just fine for you. 
  • Replied 8 September 2017, 12:41 pm EST

    Ok, I have it working pretty much the way I want, but I do have one question. By the time I need to edit the contents of the cell in the ComboCloseUp Event, the new combo selection has already been written to the cell's text property. Is there a way I can get and edit this value before it is written to the cell? I tried the ComboSelChange Event, but that doesn't provide any information about the selected combo item. Essentially I want to prevent the user from seeing the selection written to the cell followed by my "revised" cell contents. If I can set the cell contents as soon as the user selects an item from the combo that would be ideal. Thanks!
  • Replied 8 September 2017, 12:41 pm EST

    griswald88 -

    You can get the item selected from the ComboSelChange event...

    Private Sub FpSpread1_ComboSelChange(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboSelChange
    Dim c As FarPoint.Win.FpCombo

    If TypeOf FpSpread1.EditingControl Is FarPoint.Win.FpCombo Then

    c = CType(FpSpread1.EditingControl, FarPoint.Win.FpCombo)
    Debug.Print(c.SelectedItem.ToString)

    End If
    End Sub
  • Replied 8 September 2017, 12:41 pm EST

    Ah yes, forgot about type conversion. Ok so that's a huge step, but what value would I edit so that my "revised" text is written to the cell? I have tried a few things, but nothing seems to be working, the item selected from the combo always appears in the cell; how do I change the value in the interim?
  • Replied 8 September 2017, 12:41 pm EST

    You would need to develop a custom celltype to handle such a situation.
  • Replied 8 September 2017, 12:41 pm EST

    Well if I am using an editable combo cell type then I can insert whatever I want into the cell text (cell text is not restricted to combo's contents). I am just looking for pointers on what events to use to simulate this behavior.


    For example, on ComboDropDown store the cell's text and then on ComboCloseUp grab the new selection and append/remove from the cell's text appropriately.


    I am just wondering if you have pointers on which events to use if those are not appropriate. Any help would be appreciated. I would actually love to do a custom cell type that allows me to multi-select, but I am not too familiar with that and I have a feeling it would be quite difficult.

  • Replied 8 September 2017, 12:41 pm EST

    I do not see any way to set the text other than in the CloseUp event...

    Private Sub FpSpread1_ComboCloseUp(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboCloseUp

    Dim c As FarPoint.Win.FpCombo

    If TypeOf FpSpread1.EditingControl Is FarPoint.Win.FpCombo Then

    c = CType(FpSpread1.EditingControl, FarPoint.Win.FpCombo)
    c.Text = c.SelectedItem.ToString & " ,B"
    End If
    End Sub
Need extra support?

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

Learn More

Forum Channels