System.Type question

Posted by Peter van Dam on 25-Aug-2014 17:07

I have been struggling now with this for several hours and for the life of me I cannot figure out how to translate the following C# code to OpenEdge GUI for .NET:

        private void ultraDayView1_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e)
            appUIElement = e.Element.GetAncestor(typeof(AppointmentUIElement)) as AppointmentUIElement;

This is not working:

oAppointmentUIElement = e:Element:GetAncestor(Progress.Util.TypeHelper:GetType("Infragistics.Win.UltraWinSchedule.DayView.AppointmentUIElement")).

  METHOD PRIVATE VOID ultraDayView_MouseEnterElement( INPUT sender AS System.Object, INPUT e AS Infragistics.Win.UIElementEventArgs ):
    DEF VAR appUIElement AS AppointmentUIElement.
    appUIElement = e:Element:GetAncestor(Progress.Util.TypeHelper:GetType("Infragistics.Win.UltraWinSchedule.DayView.AppointmentUIElement")).

What am I missing?



All Replies

Posted by tbergman on 25-Aug-2014 17:46

You need to cast it to the proper data type. That's what the as statement is doing.

appUIElement = CAST(e:Element:GetAncestor(Progress.Util.TypeHelper:GetType("Infragistics.Win.UltraWinSchedule.DayView.AppointmentUIElement")),AppointmentUIElement).

Posted by Peter van Dam on 26-Aug-2014 03:07

Of course! I was staring at the GetAncestor statement all the time, but the problem was not there.

Thanks a lot.

This thread is closed