Double click row

8 posts, 0 answers
  1. Pasi
    Pasi avatar
    5 posts
    Member since:
    Mar 2017

    Posted 14 Dec 2017 Link to this post

    Hello.

    I am quite new to UI programming (and Telerik components) and thus have a question about double clicking. The problem is as follows.
    We have a need to start some handling when user double clicks on an item. This should happen from either side of the gantt view, from the grid or timeline side.
    My current implementation is such that I subscribe for radGanttView DoubleClick-event. In the event handler I check from radGanttView SelectedItem-property which item was double clicked. The problem here is that if the item is already selected, user can double click anywhere and my code will be run.
    So the question is as follows. Is there a way to receive a double click only if user clicks on the UI element of the task? It seems that GanttGraphicalViewBaseTaskElement has a doubleclick-event but I don't know how to get my hands on such object. Or should this be done somehow differently?

    Thank you!
    br.Pasi

    Using:
    Progress 11.6
    Telerik UI for Winforms R2 2017

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3952 posts

    Posted 15 Dec 2017 Link to this post

    Hello, Pasi,

    Thank you for writing.  

    Here is  a sample code snippet demonstrating how to detect double clicking over GanttViewTaskElement in the graphical view: 
    this.radGanttView1.MouseDoubleClick+=radGanttView1_MouseDoubleClick;


    private void radGanttView1_MouseDoubleClick(object sender, MouseEventArgs e)
    {
        GanttViewTaskElement element = this.radGanttView1.ElementTree.GetElementAtPoint(e.Location) as GanttViewTaskElement;
        if (element !=null)
        {
            Console.WriteLine(element.Text);
        }
    }

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    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. Pasi
    Pasi avatar
    5 posts
    Member since:
    Mar 2017

    Posted 15 Dec 2017 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello Dess and thank you for the quick reply.

    I tried this out but I'm getting the following exception: System.Reflection.AmbiguousMatchException: Ambiguous match found.

    My code is as follows.

    THIS-OBJECT:radGanttView1:MouseDoubleClick:Subscribe(THIS-OBJECT:MouseDoubleClickEventHandler).

     

    METHOD PRIVATE VOID MouseDoubleClickEventHandler(
        INPUT iSender AS System.Object,
        INPUT iArgs   AS System.Windows.Forms.MouseEventArgs ):
     
        DEFINE VARIABLE xLocation    AS System.Drawing.Point                             NO-UNDO.
        DEFINE VARIABLE xElementTree AS Telerik.WinControls.ComponentThemableElementTree NO-UNDO.
        DEFINE VARIABLE xRadElement  AS Telerik.WinControls.RadElement                   NO-UNDO.
         
         
        xLocation = iArgs:Location.     
        MESSAGE "X:" STRING(xLocation:X) " Y:" STRING(xLocation:Y) VIEW-AS ALERT-BOX. /* This is shown */
         
        xElementTree = THIS-OBJECT:radGanttView1:ElementTree.
         
        MESSAGE "Getting element." VIEW-AS ALERT-BOX. /* This is shown */
         
        /* This seems to cause the following error:
          System.Reflection.AmbiguousMatchException: Ambiguous match found. */
        xRadElement = xElementTree:GetElementAtPoint(INPUT xLocation).
                 
        MESSAGE "This does not show up" VIEW-AS ALERT-BOX.
     
    END METHOD.

     

    Any ideas what could cause this and is there something I could do differently?

    Thank you!

     

    b.r. Pasi

     

     

     

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3952 posts

    Posted 15 Dec 2017 Link to this post

    Hello, Pasi, 

    Thank you for writing back. 

    I have attached my sample C# project where everything works as expected. If you are experiencing any difficulties with ABL and the OpenEdge environment feel free to submit your case in Salesforce by using the following link: https://progresslink.progress.com/
    Thus the OpenEdge support will gladly assist you.

    I hope this information helps. If you have any additional questions, please let me know. 

     Regards,
    Dess
    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. Pasi
    Pasi avatar
    5 posts
    Member since:
    Mar 2017

    Posted 15 Dec 2017 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Once again, thank you for the quick reply Dess! I will continue through Salesforce.

    b.r. Pasi

  6. Pasi
    Pasi avatar
    5 posts
    Member since:
    Mar 2017

    Posted 21 Dec 2017 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello again Dess!

    It seems that there is a problem with call to GetElementAtPoint when using the libraries from Progress.

    https://knowledgebase.progress.com/articles/Article/Reflection-error-calling-Telerik-GetElementAtPoint-method

     

    Before we get a fix for this, is there any other way to implement the check for what was double clicked? (And we would need it for both sides, for the grid and timeline.) Or should we just stick to the current implementation until we get the fix?

     

    Thank you again for the help.

    B.r. Pasi

  7. Hristo
    Admin
    Hristo avatar
    1520 posts

    Posted 22 Dec 2017 Link to this post

    Hello Pasi,

    Thank you for writing.

    Indeed OpenEdge has an issue with generic methods and until this gets resolved you will not be able to use the built-in implementation. You can perform the same check this way: 
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
     
            this.radGanttView1.MouseDown += RadGanttView1_MouseDown;
        }
     
        private void RadGanttView1_MouseDown(object sender, MouseEventArgs e)
        {
            RadElement el = this.GetElementAtPoint(this.radGanttView1, this.radGanttView1.RootElement, e.Location, null);
        }
     
        public RadElement GetElementAtPoint(Control control, RadElement parent, Point point, List<RadElement> foundElements)
        {
            if (parent.Visibility != ElementVisibility.Visible)
            {
                return null;
            }
     
            ChildrenListOptions childrenFlags = ChildrenListOptions.ZOrdered | ChildrenListOptions.ReverseOrder | ChildrenListOptions.IncludeOnlyVisible;
     
            Rectangle client = control.ClientRectangle;
     
            foreach (RadElement element in parent.GetChildren(childrenFlags))
            {
                if (element.ElementState != ElementState.Loaded)
                {
                    continue;
                }
     
                if (element.HitTest(point))
                {
                    bool addElement = (foundElements != null) && !(element is BorderPrimitive);
     
                    if (addElement)
                    {
                        foundElements.Add(element);
                    }
     
                    RadElement res = GetElementAtPoint(control, element, point, foundElements);
     
                    if (res != null)
                    {
                        return res;
                    }
     
                    if (element.ShouldHandleMouseInput)
                    {
                        return element;
                    }
                }
            }
     
            return null;
        }
    }

    I hope this helps. Please let me know if you need further assistance.

    Regards,
    Hristo
    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.
  8. Pasi
    Pasi avatar
    5 posts
    Member since:
    Mar 2017

    Posted 03 Jan 2018 in reply to Hristo Link to this post

    Hello Hristo! Thank you for the example and help with the issue! I got this working now as required.

    br. Pasi

Back to Top