Hello
The following code is supposed to place an editor control of type UltraNumericEditor on the single node that it has. However, it does not work.
Can you please tell what is wrong?
Thanks a lot.
With Me.UltraTree1 .ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.OutlookExpress With .ColumnSettings .RootColumnSet.Columns.Add("TestColumn") .AutoFitColumns = Infragistics.Win.UltraWinTree.AutoFitColumns.ResizeAllColumns End With With .Override .ShowEditorButtons = Infragistics.Win.UltraWinTree.ShowEditorButtons.Always .EditorControl = UltraNumericEditor1 End With With .Nodes .Add("FirstNode") End With End With
I tried using the Infragistics.Win.DateTimeEditor object instead as follows but when double-clicking the cell editing behaves as if it were a text edit:
UltraTree1.Nodes(0).SetCellValue(objSecondColumn, Now) UltraTree1.Nodes(0).Override.CellClickAction = Infragistics.Win.UltraWinTree.CellClickAction.EditCell UltraTree1.Nodes(0).Override.UseEditor = Infragistics.Win.DefaultableBoolean.True UltraTree1.Nodes(0).Override.SelectionType = Infragistics.Win.UltraWinTree.SelectType.Single UltraTree1.Nodes(0).Override.ShowEditorButtons = Infragistics.Win.UltraWinTree.ShowEditorButtons.Always UltraTree1.Nodes(0).Override.Editor = New Infragistics.Win.DateTimeEditor ' <----
The following line displays "EditorWithText" instead of "DateTimeEditor":
MsgBox(TypeName(UltraTree1.Nodes(0).Cells(objSecondColumn).EditorResolved).ToString)
There is a little tricky solution, but I hope that exist another form to do it. Following your code, place a UltraDateTimeEditor1 in the Form1
In the Form1_Load event Dim objFirstColumn As Infragistics.Win.UltraWinTree.UltraTreeNodeColumn Dim objSecondColumn As Infragistics.Win.UltraWinTree.UltraTreeNodeColumn
UltraTree1.ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.OutlookExpress UltraTree1.Override.UseEditor = Infragistics.Win.DefaultableBoolean.True UltraTree1.Override.LabelEdit = Infragistics.Win.DefaultableBoolean.True UltraTree1.Override.CellClickAction = Infragistics.Win.UltraWinTree.CellClickAction.EditCell
objFirstColumn = UltraTree1.ColumnSettings.RootColumnSet.Columns.Add("Col1") objSecondColumn = UltraTree1.ColumnSettings.RootColumnSet.Columns.Add("Col2")
UltraTree1.Nodes.Add("TestNode") UltraTree1.Nodes(0).SetCellValue(objFirstColumn, "Value11") UltraTree1.Nodes(0).SetCellValue(objSecondColumn, "Value12")
'The Dock property must be Fill *********** UltraTree1.Dock = DockStyle.Fill
objSecondColumn.AllowCellEdit = Infragistics.Win.UltraWinTree.AllowCellEdit.Full With UltraTree1.Nodes(0) .Override.CellClickAction = Infragistics.Win.UltraWinTree.CellClickAction.EditCell .Override.UseEditor = Infragistics.Win.DefaultableBoolean.True .Override.SelectionType = Infragistics.Win.UltraWinTree.SelectType.Single .Cells(objSecondColumn).EditorControl = UltraDateTimeEditor1 .SetCellValue(objSecondColumn, Now) End With
With UltraDateTimeEditor1 .Visible = False .AllowDrop = True .AutoSize = True End With
Me.UltraTree1.ColumnSettings.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Solid Me.UltraTree1.ColumnSettings.CellAppearance.BorderColor = SystemColors.Control
In the UltraTree1 BeforeCellActivate If TypeOf e.Cell.EditorControl Is Infragistics.Win.UltraWinEditors.UltraDateTimeEditor Then With UltraDateTimeEditor1 .Height = e.Cell.UIElement.Rect.Height .Width = e.Cell.UIElement.Rect.Width .Top = e.Cell.UIElement.Rect.Location.Y .Left = e.Cell.UIElement.Rect.Location.X .Enabled = True .Visible = True End With Else UltraDateTimeEditor1.Enabled = False UltraDateTimeEditor1.Visible = False End If
In the UltraTree1 BeforeCellDeactivate If TypeOf e.Cell.EditorControl Is Infragistics.Win.UltraWinEditors.UltraDateTimeEditor Then e.Cell.Value = UltraDateTimeEditor1.Value UltraDateTimeEditor1.Enabled = False UltraDateTimeEditor1.Visible = False End If
Your are right: I can't have the DateTimeEditor to work, yet. I am quite frustrated.
But if you want to place or embeed other editors like DateTimeEditor or UltraNumericEditor in a specific cell, it works like you do? please tell me if it works to you
Thanks
Thanks, I got it working with the following code.
By the way, how can I set an editor for a given cell? (that is, not for the entire column or the whole row).
I placed a new tree control on the form. In the form Load() event I wrote the following code:
Dim objFirstColumn As Infragistics.Win.UltraWinTree.UltraTreeNodeColumn Dim objSecondColumn As Infragistics.Win.UltraWinTree.UltraTreeNodeColumn
objSecondColumn.AllowCellEdit = Infragistics.Win.UltraWinTree.AllowCellEdit.Full
objSecondColumn.Editor = New Infragistics.Win.EditorWithText()