ExpressionEditorFormCreated not invoked outside RadGridView, self opening RadExpressionEditorForm 2018.R1

9 posts, 1 answers
  1. sebastien
    sebastien avatar
    25 posts
    Member since:
    May 2017

    Posted 12 Feb 2018 Link to this post

    Hi,

    I am trying to use the Expression without the initial use of a RadGridView.

    Looked over Expression editor without gridview for the base inheritance.

    The event ExpressionEditorFormCreated is never called.

    I'm registering the hidden radGridView.ExpressionEditorFormCreated in the constructor of the form.

     

    Thanks

     

    Code:

    public partial class FormulaEditor : RadExpressionEditorForm
    {
        private static RadGridView hiddenGrid;
        private static GridViewDataColumn dataColumn;
     
        public FormulaEditor()
            : base(dataColumn)
        {
            InitializeComponent();
     
            hiddenGrid = new RadGridView();
            dataColumn = new GridViewTextBoxColumn();
            hiddenGrid.Columns.Add(dataColumn);
            hiddenGrid.Rows.AddNew();
     
            hiddenGrid.ExpressionEditorFormCreated += HiddenGrid_ExpressionEditorFormCreated;
        }
     
        private void HiddenGrid_ExpressionEditorFormCreated(object sender, ExpressionEditorFormCreatedEventArgs e)
        {
            e.ExpressionEditorForm.FormElement.TitleBar.FillPrimitive.BackColor = Color.Red;
            e.ExpressionEditorForm.ShowIcon = false;
     
            ExpressionItemsList.Clear();
     
            //base.LoadFieldList(null);
     
            if (FieldList != null && !FieldList.Any())
            {
                FieldList.Clear();
            }
     
            if (radTreeViewFunctions.Nodes.Any())
                radTreeViewFunctions.Nodes.Clear();
        }
    }
  2. Dimitar
    Admin
    Dimitar avatar
    2512 posts

    Posted 13 Feb 2018 Link to this post

    Hi Seb,

    This event is raised from the menu item in the grid and it allows you to change the form. It will not be raised when the form is used this way. You can use the Load event of the form instead.

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. sebastien
    sebastien avatar
    25 posts
    Member since:
    May 2017

    Posted 13 Feb 2018 in reply to Dimitar Link to this post

    What I'm trying to do is use the RadExpressionEditorForm for creating and editing formulas easier for our users.

     

    But what I need to accomplish, is :

    1. Getting rid of all the Telerik created default Functions, Operators, Constants and Fields
    2. Create our Functions (only 5)
    3. Create our own Fields
    4. Removing many of the operator buttons (and making the buttons left pretty with spacing)

    I didn't find any examples with self opened RadExpressionEditorForm other than opening one :(

     

    Do you think my ToDo list is possible with the RadExpressionEditor?

    thank

    seb

     

  4. Dimitar
    Admin
    Dimitar avatar
    2512 posts

    Posted 14 Feb 2018 Link to this post

    Hello Sebastien,

    Once the form is inherited you will be able to open it at design time. This will allow you to access the controls and rearrange the buttons. 

    The functions controls are just two TreeViews that are used for displaying the functions and you can easily add/remove any nodes. I have attached a small project that shows a sample implementation.  

    I hope this will be useful.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. sebastien
    sebastien avatar
    25 posts
    Member since:
    May 2017

    Posted 20 Feb 2018 in reply to Dimitar Link to this post

    Hi,

    most of the inherited controls are stuck, can't change the visible property, cannot delete them, move, anything.

     

    Exemple with : radSeparator3

    If I hide a part of buttons, let's say (first, previous, next and last), for sure I want to get rid of radSeparator3.

     

    So is it possible?

  6. Dimitar
    Admin
    Dimitar avatar
    2512 posts

    Posted 21 Feb 2018 Link to this post

    Hello Sebastien,

    When the control is declared private in the base form you do not have a direct access to it. You can examine the control hierarchy in the Document Outline window (see attached) and then access the control via the Controls collection:
    var seprarator = this.Controls[0].Controls[0].Controls[0].Controls[0].Controls[14] as RadSeparator;
    seprarator.Visible = false;

    I hope this will be useful. 

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. sebastien
    sebastien avatar
    25 posts
    Member since:
    May 2017

    Posted 21 Feb 2018 Link to this post

    Thanks Dimitar,

     

    based on you suggestion, I made a safest code I think.

    Here is, if others need it :

    string[] toBeHiddenControlNames = { "radSeparator2", "radSeparator3" };
     
    foreach (var name in toBeHiddenControlNames)
    {
        var foundControls = Controls.Find(name, true);
        if (foundControls.Any())
        {
            foundControls.First().Visible = false;
        }
    }
  8. sebastien
    sebastien avatar
    25 posts
    Member since:
    May 2017

    Posted 21 Feb 2018 in reply to Dimitar Link to this post

    Hi Dimitar,

    talking about your template project (1153051.zip), I would like to add some custom Fields within the XML file

    <?xml version="1.0" encoding="utf-8" ?>
    <ExpressionItemsList>
      <!-- Custom functions -->
      <ExpressionItem Name="IF (Custom Function)" Value="IF()" Syntax="F.IF()" Type="OtherFunc">
        <Description>
          Get the value of Pi. This is a custom added function.
        </Description>
      </ExpressionItem>
     
      <ExpressionItem Name="Test2" Value="Test2()" Syntax="Test2([List(Of Number)])" Type="OtherFunc">
        <Description>
          test2.
        </Description>
      </ExpressionItem>
     
      <ExpressionItem Name="Test" Value="Test()" Syntax="Test([List(Of Number)])" Type="OtherFunc">
        <Description>
          test.
        </Description>
      </ExpressionItem>
     
      <ExpressionItem Name="C.[Field1]" Value="C.[81774bab-0558-4e01-bec4-4c6454ee3481]" Syntax="C.[81774bab-0558-4e01-bec4-4c6454ee3481]" Type="Field">
        <Description>
          Field1
        </Description>
      </ExpressionItem>
    </ExpressionItemsList>

     

    The Type="Field" (Telerik.Data.Expressions.ExpressionItemType.Field) doesn't seem to do anything, I think I have the good name because I have an error if I replace it with another random name (like Fields).

    I tried all others like "DateTimeFunc", "Constant" & "OtherFunc" and are all working and showing under the correct node.

     

    I wouldn't use the radListControlFunctionsList.SelectedNodeChanged for setting the description, since every other part should answeer my needs.

     

    thanks

    seb

  9. Answer
    Dimitar
    Admin
    Dimitar avatar
    2512 posts

    Posted 23 Feb 2018 Link to this post

    Hello Sebastien,

    Yes, the field is not added from the XML, I have logged this issue on our Feedback Portal. You can track its progress, subscribe to status changes and add your comment to it here. I have also updated your Telerik Points.

    To workaround this you can manually add the field: 
    this.LoadFieldList(hiddenGrid.MasterTemplate);
    this.FieldList.Add(new Telerik.Data.Expressions.ExpressionItem()
    { Name = "Test", Description = "Test", Syntax = "Test", Type = Telerik.Data.Expressions.ExpressionItemType.Field, Value = "Test" });

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top