Infragistics UltraLiveTileView

Posted by Roger Blanchard on 16-Nov-2015 09:08

Does anyone know how to get the code below to work in the ABL? I am trying to loop through the GroupsCollection but it does not appear you can retrieve the group using the index like you can in C##. 

TileGroup myGroup = this.ultraLiveTileView1.Groups.Add("MyGroupKey", "My Group Text");

The above works in the ABL;

DEFINE VARIABLE oNewGroup AS TileGroup NO-UNDO.

oNewGroup = THIS-OBJECT:ultraLiveTileView1:Groups:Add("MyGroupKey","MyGroupText").

 

// Get TileGroup by index

int index = myGroup.Index;

TileGroup myGroupRefByIndex = this.ultraLiveTileView1.Groups[index];

The above does NOT work in the ABL.

oTileGroup = THIS-OBJECT:ultraLiveTileView1:Groups[iIndex]. 

The above displays error "The specified indexer type does not match any type required by this object (13811)

// Get TileGroup by key

string key = myGroup.Key;

TileGroup myGroupRefByKey = this.ultraLiveTileView1.Groups[key];

The above works in the abl;

cKey = oNewGroup:Key.

oTileGroup = THIS-OBJECT:ultraLiveTileView1:Groups[cKey].

Can what is below be converted to ABL?

If you need to get the indexes of all the TileGroups you may use code like this:

// Get all TileGroups keys and indexes

Dictionary<int, TileGroup> indexes = new Dictionary<int, TileGroup>();

foreach (TileGroup group in this.ultraLiveTileView1.Groups)

{

    indexes[group.Index] = group;

}

All Replies

Posted by Laura Stern on 16-Nov-2015 09:33

When you access the indexed property on the Groups collection it is really indexing into the "items" property.  So you could also say "this.ultraLiveTileView1.Groups.item[index];  From the doc I found on this, it looks like the items property can only be indexed by a string.  It does seem rather unusual for that to be the only way, but that's certainly matches the error message you are getting and the fact that using cKey as the index works fine.  But then I don't know why the integer index would work in C#, which I think is what you're saying.  You should look at the object browser for the object and see what it says.

The code you are showing at the bottom is not getting a list of all the indexes for a TileGroup.  It is simply creating a mapping between the group index and the group object in a lookup table (Dictionary).  The "foreach" is just giving you another way to interate through the groups rather than by using the indexed property.

Posted by Roger Blanchard on 16-Nov-2015 09:42

What we have done elsewhere when looping through collections is something similar to the following;

DO iGroup = 0 TO THIS-OBJECT:ultraLiveTileView1:Groups:Count - 1:

   oTileGroup = CAST (THIS-OBJECT:ultraLiveTileView1:Groups:Item[iGroup], TileGroup) NO-ERROR.

   IF NOT VALID-OBJECT (oTileGroup) THEN NEXT.

END.

But it does not like the indexer. The class browser shows the following with the only way to retrieve using the key which is a string...and useless to me.

PUBLIC PROPERTY Item AS Infragistics.Win.UltraWinLiveTileView.TileGroup [key AS character]

   GET.

Member of Infragistics.Win.UltraWinLiveTileView.KeyedCollectionBase<Infragistics.Win.UltraWinLiveTileView.TileGroup>

Summary:

Note:

This is an indexed property.

Posted by Simon L. Prinsloo on 16-Nov-2015 09:53

Following the inheritance hierarchy backward, I see that:

Groups is of type TileGroupsCollection, which inherits  Infragistics.Win.UltraWinLiveTileView.KeyedCollectionBase<T> , which in turn inherits from KeyedCollectionBase<T>. The latter implements the indexer as a string, but it also inherits from IndexedCollectionBase<T> , which implements the indexer as an integer.

For that reason, I would expect both integer and string values to work when passed to the indexer, as is the case with the C# code.

There is also a "Count" on the collection, but no enumerator. Thus the only way to loop through the collection would seem to be using:

DO iIndex = 0 TO oGroups:Count:

  oGroup = oGroups[iIndex].

But that does not seem to work in the ABL. Since there is no enumerator, I cannot figure out any other way that could be employed by the C#  foreach....

Posted by Laura Stern on 16-Nov-2015 09:54

As I said - I agree that this is odd.  I don't see a reason not to allow an integer index.  But the AVM is basing its behavior on the information in the object browser cache, which as I said, DOES match the doc.  

Can you look at it in an object browser via Visual Studio?  If that has an integer index, then maybe there is a bug - or maybe that is relying on some special Microsoft sauce that the AVM does not support.  Worth logging a bug though.

Posted by Laura Stern on 16-Nov-2015 10:08

Simon is correct.  The integer index should be inherited from IndexedCollectionBase<T>.  Could you please log a bug.  

Posted by Roger Blanchard on 16-Nov-2015 12:00

Case opened.

Thanks.

This thread is closed