This code places an Elementary index widget on a window, indexing grid items.
Here's the list of item labels to be used on the grid (in that order):
In the interesting part of the code, here, we first instantiate the grid (more on grids on their examples) and, after creating our index, for each grid item we also create an index one to reference it:
The order in which they'll appear in the index, though, is alphabetical, becase of elm_index_item_sorted_insert() usage together with the comparing function, where we take the letters of each index item to base our ordering on. The parameters on
_index_cmp have to be declared as void pointers because of the
Eina_Compare_Cb prototype requisition, but in this case we know they'll be index item(Elm_Object_Item)'s:
The last interesting bit is the callback in the
"delay,changed" smart event, which will bring the given grid item to the grid's visible area:
Note how the grid will move kind of randomly while you move your mouse pointer held over the index from top to bottom – that's because of the the random order the items have in the grid itself.
This is how the example program's window looks like:
See the full source code for this example.