Home Forums WinForms controls Xceed Grid for WinForms TextEditor OnClick event

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

    Hi,

    I think I’ve found a bug in the TextEditor control for the Grids 3.0.
    I’ve created a new control that inherits from Xceed.Grid.Editors.TextEditor. This control has a side button that when it’s clicked does some actions.
    Althought in the control constructor I create the side button and assign the OnClick event handler, it’s never called.

    My code is like the following:
    <color=”Blue”>
    Public Class MyValueCellEditor : Inherits Xceed.Grid.Editors.TextEditor

    Public Sub New()
    Dim btn as New Xceed.Editors.WinButton(“Click me!”)
    AddHandler btn.Click, AddressOf SideButton_OnClick
    Me.SideButtons.Add(btn)
    End Sub

    Private Sub SideButton_OnClick (sender as Object, e as System.EventArgs)
    ‘ Do Some Actions…
    End Sub

    End Class
    </color>
    Althought I can see this control in the grid, the SideButton_OnClick method isn’t never called.

    But, if I inherit it from Xceed.Editors.WinTextBox instead Xceed.Grid.Editors.TextEditor and I use the CellEditorManager to wrap the control in the grid, the event is raised!!!

    Someone knows whats happened with this issue?

    Thanks and sorry for my english… 😉

    Imported from legacy forums. Posted by oarrivi (had 1934 views)

    User (Old forums)
    Member
    Post count: 23064

    Ops!
    Itsn’t a bug… :-$

    The reason for this is that the controls are cloned in the grid so to activate the even I need an intermediate event.

    This is the bugfixed inherited class:
    <color=”Blue”>
    Public Class MyValueCellEditor : Inherits Xceed.Grid.Editors.TextEditor

    Public Sub New()
    Dim btn as New Xceed.Editors.WinButton(“Click me!”)
    AddHandler btn.Click, AddressOf SideButton_OnClick
    Me.SideButtons.Add(btn)
    End Sub

    Private Sub SideButton_OnClick (sender as Object, e as System.EventArgs)
    ‘ Do Some Actions…
    End Sub
    </color><color=”Red”>
    Private Sub ParamValueCellEditor_ActivatingControl(ByVal sender As Object, ByVal e As Xceed.Grid.Editors.CellEditorEventArgs) Handles MyBase.ActivatingControl

    Dim winTextBox As Xceed.Editors.WinTextBox = CType(e.Control, Xceed.Editors.WinTextBox)
    AddHandler winTextBox.SideButtons(0).Click, AddressOf DropButton_Click
    End Sub

    Private Sub ParamValueCellEditor_DeactivatingControl(ByVal sender As Object, ByVal e As Xceed.Grid.Editors.CellEditorEventArgs) Handles MyBase.DeactivatingControl
    Dim winTextBox As Xceed.Editors.WinTextBox = CType(e.Control, Xceed.Editors.WinTextBox)
    RemoveHandler winTextBox.SideButtons(0).Click, AddressOf DropButton_Click
    End Sub
    </color><color=”Blue”>
    End Class
    </color>

    I hope this thread can help you…

    Imported from legacy forums. Posted by oarrivi (had 2949 views)

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