Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
UltraTree Cell Edit error with context menu
posted

Hi

i'm using an UltraTree with editing mode enabled but when editing, if the user right clicks and selects 'Add new child’ the Tree throws an exception when I try to end edit mode and add a new row. I also tried just exiting the context menu and not allowing an add new to execute but even doing this the tree disables editing of the cells and in some cases rows cannot be selected again.

        Me.TreeControl.Override.LabelEdit = Infragistics.Win.DefaultableBoolean.True 'enables F2 editing

        Me.TreeControl.Override.Multiline = Infragistics.Win.DefaultableBoolean.False

        Me.TreeControl.Override.LabelEditAppearance.BackColor = Drawing.Color.LightYellow

        Me.TreeControl.Override.UseEditor = Infragistics.Win.DefaultableBoolean.True

        Me.TreeControl.Override.Editor = New Infragistics.Win.EditorWithText()

 

   

    Protected Overridable Sub onTreeAddChildClicked(ByVal Sender As ObjectByVal e As EventArgs)

        Try

 

            ' This kills off editing at the row level. The cell does not highlight when selected and often the blue "selected" background is left in place (even when not selected)

            If _TreeControl.ActiveNode.IsEditing Then

                Exit Sub

            End If

 

            ' Kills the controls and disables it perminately. The control has Red Cross displayed, exception thrown.

            If _TreeControl.ActiveNode.IsEditing Then

                Me.TreeControl.PerformAction(UltraTreeAction.ExitEditMode, FalseFalse)

                Exit Sub

            End If

 

 

            ' CODE TO ADD NEW CHILD ROW

 

        Catch ex As Exception

        End Try

    End Sub

 

Questions:

Apart from disabling the context menu is there any way to get the control out of edit mode and/or reset it?
I get 2 slightly different exceptions depending on what action is taken in the context menu event. If just exitedit mode, the first exception is thrown, if exitedit mode and attempt to insert new row I get 2nd exception (note the key used on the newly inserted row is not a duplicate and is not the key mentioned in the exception)
I would appreciate any help with this.
 

Object reference not set to an instance of an object.

 

       Source Assembly: Infragistics4.Win.v11.2

       Method: OnTextBoxTextChanged

       Stack Trace:

          at Infragistics.Win.EditorWithText.OnTextBoxTextChanged(Boolean fireValueChanged)

          at Infragistics.Win.EditorWithText.Infragistics.Win.IEmbeddableTextBoxListener.OnTextChanged()

          at Infragistics.Win.EmbeddableTextBox.OnTextChanged(EventArgs e)

          at System.Windows.Forms.TextBoxBase.WmReflectCommand(Message& m)

          at System.Windows.Forms.TextBoxBase.WndProc(Message& m)

          at System.Windows.Forms.TextBox.WndProc(Message& m)

          at Infragistics.Win.EmbeddableTextBoxWithUIPermissions.WndProc(Message& m)

          at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

          at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

          at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

          at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)

          at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)

          at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)

          at System.Windows.Forms.Control.WmCommand(Message& m)

          at System.Windows.Forms.Control.WndProc(Message& m)

          at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

          at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

          at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

Item has already been added. Key in dictionary: 'Watch List'  Key being added: 'Watch List'

 

       Source Assembly: mscorlib

       Method: Insert

       Stack Trace:

          at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)

          at System.Collections.Hashtable.Add(Object key, Object value)

          at Infragistics.Win.UltraWinTree.NodeClientAreaUIElement.CacheNodeElements(Hashtable table, UIElementsCollection oldElements, Int32 startIndex)

          at Infragistics.Win.UltraWinTree.NodeClientAreaUIElement.PositionChildElements()

          at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)

          at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)

          at Infragistics.Win.UIElement.VerifyChildElements()

          at Infragistics.Win.UltraWinTree.UltraTreeUIElement.PositionChildElements()

          at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)

          at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)

          at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered)

          at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify)

          at Infragistics.Win.ControlUIElementBase.ProcessMouseMoveHelper(Object sender, MouseEventArgs e)

          at Infragistics.Win.ControlUIElementBase.ProcessMouseMove(Object sender, MouseEventArgs e)

          at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)

          at Infragistics.Win.UltraControlBase.OnMouseMove(MouseEventArgs e)

          at Infragistics.Win.UltraWinTree.UltraTree.OnMouseMove(MouseEventArgs e)

          at System.Windows.Forms.Control.WmMouseMove(Message& m)

          at System.Windows.Forms.Control.WndProc(Message& m)

          at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

          at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

          at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)