OO structure

Posted by DenDuze on 24-Mar-2016 09:15

I've got a piece of code from the Telerik forum regarding the RadCalendar.

I'm trying to re-code that to the Progress Syntax but I always get stuck.

Maybe some of you know how to do this.

Code from Telerik forum (http://www.telerik.com/forums/doubleclick-event-cf47c4ae1e1a)
The part that I want to use is:
CalendarCellElement cell = (this.radCalendar1.ElementTree.GetElementAtPoint(e.Location) as CalendarCellElement)
But I always get a System.Reflection.AmbiguousMatchException .NET exception.
I think that's because there are 2 methods with the same signature and if I understand correctly Progress doesn't support that

So I tried to re-code another example:

Private Sub radCalendar1_MouseDoubleClick(sender As Object, e As MouseEventArgs)
    Dim table As CalendarTableElement = DirectCast(Me.radCalendar1.CalendarElement.CalendarVisualElement, MonthViewElement).TableElement
    Dim childrenFlags As ChildrenListOptions = ChildrenListOptions.ZOrdered Or ChildrenListOptions.ReverseOrder Or ChildrenListOptions.IncludeOnlyVisible
    Dim children As List(Of RadElement) = table.GetChildren(childrenFlags).ToList()
 
    For Each element As RadElement In children
        If element.ElementState <> ElementState.Loaded OrElse Not (TypeOf element Is CalendarCellElement) Then
            Continue For
        End If
 
        If element.HitTest(e.Location) AndAlso DirectCast(element, CalendarCellElement).[Date] <> Nothing Then
            'Clicked on CalendarCellElement
            Console.WriteLine(element)
            Exit For
        End If
    Next

I've managed to get the first defines working but I got stuck on the line
Dim children As List(Of RadElement) = table.GetChildren(childrenFlags).ToList()

How can I code somthing like that in Progress?
I can't find the List class, how to make that a list of RadElements and how can I do that ToList?


Maybe some of tou have some ideas

Regards

All Replies

Posted by bronco on 24-Mar-2016 09:20

I think what you're looking for is described in:

knowledgebase.progress.com/.../P161812

Posted by Laura Stern on 24-Mar-2016 09:39

Regarding radCalendar1.ElementTree.GetElementAtPoint(e.Location), the only overload of this method that takes a single Point parameter is a generic method (GetElementAtPoint<T>(Point)).  The ABL does not support generic methods.  But since you coded it as the non generic method, there are no overloads with a single Point parameter, so it seems like the compile should have just failed with a parameter mismatch error - not an ambiguous method error.  I'm basing this on the doc found here:

docs.telerik.com/.../T_Telerik_WinControls_ComponentThemableElementTree.htm

Regarding the next part, I am not good at VB .NET.  I think this is a generic type List<RadElement> as bronco above implied, which we do support.  It would help if you could point us at the doc for these types being used.  What is the namespace of List?

Posted by DenDuze on 24-Mar-2016 09:53

Yes it's that generic method where I was talking about!

I do get that ambiguous method error but maybe that's because I'm doeing something wrong.

I'm also no VB .NET programmer so I'm just trying to make this work (and somethings are easy but others ..)

The namespace is also my problem!

The List method I got as an example from Telerik Support but it's not clear to me where that List comes from.

I've seen the KB entry that Bronco mentioned but I have no idea what I have to do with that in my case.

It says: DEFINE VARIABLE myStack AS CLASS "Stack<UndoEngine+UndoUnit>".

but what does that has to be in my case?

DEFINE VARIABLE myElement AS CLASS "Telerik.WinControls.RadElement<Telerik+WinControls+RadElement>".

That's not it - I'm sure about that ;-)

Regards

Posted by DenDuze on 25-Mar-2016 02:08

Thanks Laura and Bronco, I't works

This thread is closed