Home Forums WinForms controls Xceed Grid for WinForms Checkbox Event does not start second time

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13278 |

    Hello all,

    I have an unbound checkbox column in my unbound grid 2.2 (VB.NET). Now I want to start some actions when the user clicks the checkbox. The first time everything works fine, but when I click the same checkbox a second time the event does not start…? Regardless of whether user left or right click. But it works fine when I change the focus. I also tried it with EnterEdit into a dffferent cell but then the event is fired endlessly until I move the mousepointer to another cell.

    Example working fine:
    Click Checkbox in Row 1
    Click Checkbox in Row 2
    Click Checkbox in Row 1
    Click Checkbox in Row 2
    Click Checkbox in Row 1

    Example not working:
    Click Checkbox in Row 1
    Click Checkbox in Row 1

    In second example the event is only started the first time. How could I retrieve the second click?

    Thanks
    Kai

    <hr>
    Here is my code:

    ‘Subscribe to all datacells
    Private Sub gridSubscribeCells()
    ‘ Subscribe to the necessary events to handle the copy/paste
    ‘ and drag and drop operations. In this loop, we will also
    ‘ set each cell’s AllowDrop property to true.
    Dim cell As Xceed.Grid.DataCell
    gridMain.SelectionMode = SelectionMode.None
    For Each cell In GridMain.DataRowTemplate.Cells
    If cell.FieldName = gridGeneral.sColumnCheckBox Then
    cell.AllowDrop = True
    AddHandler cell.MouseDown, AddressOf Me.EditCellMouse_Down
    Else
    cell.AllowDrop = True
    AddHandler cell.MouseDown, AddressOf Me.DataCellMouse_Down
    AddHandler cell.MouseUp, AddressOf Me.DataCellMouse_Up
    AddHandler cell.MouseEnter, AddressOf Me.DataCellMouse_Enter
    End If

    Next cell
    End Sub

    i Counter is only used to display if an event is started
    Private Sub EditCellMouse_Down(ByVal sender As Object, ByVal e As MouseEventArgs)
    Dim pos As System.Drawing.Point
    Dim cell As Xceed.Grid.DataCell

    Select Case e.Button
    Case MouseButtons.Left
    i += 1
    mainStatusBar.Text = i.ToString
    cell = CType(sender, Xceed.Grid.DataCell)
    If gridSalesPlan.CheckBoxEditMode(cell, True) Then
    ‘Enable context menu
    Dim row As Xceed.Grid.DataRow
    row = CType(cell.ParentRow, Xceed.Grid.DataRow)
    ACL.SetOptions(row, MainForm.cmnuEdit, MainForm.btnAction)
    gridSalesPlan.EditRow(row)

    ‘row.Cells(“ID”).EnterEdit()

    End If

    Case MouseButtons.Right
    i += 100
    mainStatusBar.Text = i.ToString
    pos.X = Me.MousePosition.X – Me.Location.X
    pos.Y = Me.MousePosition.Y – Me.Location.Y – 100
    cmnuEdit.Show(GridMain, New Point(pos.X, pos.Y))
    End Select
    End Sub

    ”'<summary>
    ”’Updates EditMode of current cell and returns the new value
    ”'</summary>
    ”'<param name=’cell’>Xceed Grid DataCell</param>
    ”'<param name=’Switch’>Boolean. If true current value will be switched</param>
    ”'<returns>
    ”’Boolean. New EditMode value of Checkbox.
    ”'</returns>
    Public Function CheckBoxEditMode(ByVal cell_ As Xceed.Grid.DataCell, ByVal bSwitch_ As Boolean) As Boolean
    If CType(cell_.Value, Boolean) Then ‘neuen Wert setzen
    If bSwitch_ Then
    cell_.Value = False
    Return False
    Else
    Return True
    End If
    Else
    If bSwitch_ Then
    cell_.Value = True
    Return True
    Else
    Return False
    End If
    End If
    End Function

    Imported from legacy forums. Posted by Kai (had 5033 views)

    User (Old forums)
    Member
    Post count: 23064

    I too have experienced the same problem and cannot seem to find a suitable fix…

    Anyone find a work around to the issue with the checkbox?

    Imported from legacy forums. Posted by DBAJAM (had 342 views)

    User (Old forums)
    Member
    Post count: 23064

    I think this is not really a bug: at first, the grid control has focus, and no editors are active. But when you click the cell with the checkbox, the checkbox editor becomes active and covers the cell. That means that all the mouse events will now go to the checkbox control, and not to the cell it covers.

    Imported from legacy forums. Posted by Tommy (had 310 views)

    User (Old forums)
    Member
    Post count: 23064

    That’s what I was thinking, however, I’m not sure what event to add a handler to capture the changes to the checkbox object. I tried subscribing to the CellEditorChanged event, but, this event never fires for me. Is there another event that you had in mind?

    Thanks.

    John

    Imported from legacy forums. Posted by DBAJAM (had 289 views)

    User (Old forums)
    Member
    Post count: 23064

    Try adding a handler, not to the cell, but to the checkbox editor.

    Imported from legacy forums. Posted by Tommy (had 198 views)

    User (Old forums)
    Member
    Post count: 23064

    I am having this exact same problem with the GridComboBox editor. Sometimes it gets the first click event and then I click on another column that also uses a GridComboBox editor and it never gets the click. This causes a recursive flashing. If I use the keyboard it seems to work fine. Using 2.5 with 2.2 license.

    Greg

    Imported from legacy forums. Posted by HHGClark (had 351 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    Please make sure that the support team knows about this, so we can fix it in upcoming releases. For the moment, these forums are not monitored for any support questions, so if you haven’t reported it, it won’t be fixed.

    Imported from legacy forums. Posted by Odi [Xceed] (had 5785 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.