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
When running under the OutlookExpress view style, you must assign the editor provider to the EditorControl property of the column in which you want the editor to display.
Example:
this.tree.ColumnSettings.RootColumnSet.Columns["EditorColumn"].EditorControl = this.ultraNumericEditor;
Thanks. I tried but this exception is raised: "The Owner specified a type to EditorWithMask that is not supported by the editor."
By the way, the code of my previous post implies that a new Tree control is placed on the form with no modifications, and that a NumericEditor is also placed (styled with an Office 2007 look). You can see in the code that a single column and a single node is added.
Any ideas?
You should probably take a look at the 'UltraTree PropertyGrid' sample that ships with the product; the sample was written before the ability to edit cells was added, but to enable cell editing you can set the ColumnSettings.AllowCellEdit property (you might also want to set Override.CellClickAction if you want cells to enter edit mode on a MouseDown).
Regarding the exception you were getting when embedding the UltraNumericEditor: that control only supports the Integer and Double data types, so you can't embed that editor in a column of some other data type.
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
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")
objSecondColumn.AllowCellEdit = Infragistics.Win.UltraWinTree.AllowCellEdit.Full
objSecondColumn.Editor = New Infragistics.Win.EditorWithText()
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
Your are right: I can't have the DateTimeEditor to work, yet. I am quite frustrated.
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
'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
The idea is to use Infragistics.Win.UltraWinEditors, but there is a problem when you try to work with masked ones like Date, DateTime, Time, masked currency. masked double and masked integer, for this I use the Infragistics.Win namespace, for the others (Text, Color, Font, Dropdown, CheckBox, Radio button, etc) I use the Infragistics.Win.UltraWinEditors directly.
For more information on cell UltraWinEditors see the frmCellValueList.vb form example in C:\...\Windows Forms\Samples\WinGrid\Vb\SamplesExplorer
So far, the sample code provided by giochi7 (and I am grateful) is the only one that I made it to work. However, in the scenario that I am working in, I need to create the following controls at runtime (in a number and of a type depending of a custom configuration file):
- A datepicker like control- A combobox- A textbox- A numeric control- A textbox but with a button attached at the right- A Checkbox- A radio button
Now, I do not know if i should be using classes within the Infragistics.Win.UltraWinEditors namespace or classes within the Infragistics.Win namespace.
What I do know is that I cannot get the runtime created editors to work. Any suggestions and advice would be very appreciated.
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)