Unplanned
Last Updated: 29 Jul 2020 12:42 by ADMIN
n/a
Created on: 27 Jul 2020 13:45
Category: SyntaxEditor
Type: Bug Report
0
RadSyntaxEditor: changing the OverloadInfoCollection doesn't update the UI
I am using RadSyntaxEditor to achieve functionality such as showing some overloading of function. But I have a problem when I need to change overloadListWindow.Presenter.OverloadListItems with new OverloadInfoCollection, UI part is not changed. I assume that this change doesn't fire INotifyPropertyChanged, and that is a reason why UI is not updated. In a case, we change overloadListWindow.Presenter.OverloadListItems like in a radButton1_Click event handler, there is no change until I use the arrows button on the keyboard (probably that is a time where is INotifyPropertyChanged event is fired). I was trying to do some workaround, and that was a case where I tried to clear this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems but in that case, I got NullReferenceException even if instance is not null.

using System;
using System.Windows.Forms;
using Telerik.WinForms.Controls.SyntaxEditor.UI;
using Telerik.WinForms.Controls.SyntaxEditor.UI.IntelliPrompt.Overloading;
 
namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
 
            OverloadInfoCollection overloadListA = new OverloadInfoCollection { new OverloadInfo("aaa", "aaa description") };
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems = overloadListA;
        }
 
        private void btnClear_Click(object sender, EventArgs e)
        {
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems.Clear();
        }
 
        private void btnChange_Click(object sender, EventArgs e)
        {
            OverloadInfoCollection overloadListB = new OverloadInfoCollection { new OverloadInfo("bbb", "bbb description") };
 
            OverloadListPopup overloadListWindow = this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow;
            overloadListWindow.Presenter.OverloadListItems = overloadListB;
            overloadListWindow.Refresh();
        }
 
        private void radButton1_Click(object sender, EventArgs e)
        {
            OverloadInfoCollection overloadListC = new OverloadInfoCollection { new OverloadInfo("ccc", "ccc description"), new OverloadInfo("ccc 1", "ccc 1 description") };
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems = overloadListC;
        }
 
        private void radSyntaxEditor1_DocumentContentChanged(object sender, Telerik.WinForms.SyntaxEditor.Core.Text.TextContentChangedEventArgs e)
        {
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Show();
        }
    }
}

Attached Files:
1 comment
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 29 Jul 2020 12:42

Hello, Veljko,

Following the provided information, I observed two problems with the OverloadInfoCollection:

1. Calling the SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems.Clear method results in NullReferenceException

        public RadForm1()
        {
            InitializeComponent();
         
            OverloadInfoCollection overloadList1 = new OverloadInfoCollection
            {
                new OverloadInfo("A", "A description."),
                new OverloadInfo("B", "B description."),
                 new OverloadInfo("C", "C description.")
            };
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems = overloadList1;        
        }

 

        private void radButton2_Click(object sender, EventArgs e)
        {
      this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems.Clear();
        }
2. Setting the SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems property to a new collection doesn't refresh the UI and the OverloadListWindow shows the old items until you press the arrow buttons: 
        public RadForm1()
        {
            InitializeComponent();
         
            OverloadInfoCollection overloadList1 = new OverloadInfoCollection
            {
                new OverloadInfo("A", "A description."),
                new OverloadInfo("B", "B description."),
                 new OverloadInfo("C", "C description.")
            };
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems = overloadList1;        
        }
        private void radButton1_Click(object sender, EventArgs e)
        {
           this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Close();
            OverloadInfoCollection overloadList2 = new OverloadInfoCollection {
                 new OverloadInfo("C", "C description"),
                 new OverloadInfo("D", "D description")
             }; 
             this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems = overloadList2;
                      this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Refresh();
          this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Show();  
        }

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to manage the OverloadInfoCollection as follows:

            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Close();
            //take the current count
            int currentCount = this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems.Count;

            //add the new items
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems.Add(new OverloadInfo("D", "D description"));
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems.Add(new OverloadInfo("E", "E description"));

            //delete the old items
            for (int i = 0; i < currentCount; i++)
            {
                this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.OverloadListItems.RemoveAt(0);

            }
            this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.OverloadListWindow.Presenter.DecreaseSelectedIndex();

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik