Home › Forums › WinForms controls › Xceed Grid for WinForms › TextEditor OnClick event
-
AuthorPosts
-
#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.TextEditorPublic Sub New()
Dim btn as New Xceed.Editors.WinButton(“Click me!”)
AddHandler btn.Click, AddressOf SideButton_OnClick
Me.SideButtons.Add(btn)
End SubPrivate Sub SideButton_OnClick (sender as Object, e as System.EventArgs)
‘ Do Some Actions…
End SubEnd 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)
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.TextEditorPublic Sub New()
Dim btn as New Xceed.Editors.WinButton(“Click me!”)
AddHandler btn.Click, AddressOf SideButton_OnClick
Me.SideButtons.Add(btn)
End SubPrivate 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.ActivatingControlDim winTextBox As Xceed.Editors.WinTextBox = CType(e.Control, Xceed.Editors.WinTextBox)
AddHandler winTextBox.SideButtons(0).Click, AddressOf DropButton_Click
End SubPrivate 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)
-
AuthorPosts
- You must be logged in to reply to this topic.