in GUI Development by
Using VerticalList.GetViewAtIndex(VerticalList.SelectedItem) on the SlideEnd event, It throw an null exception that show the view selected is null. How can get the current selected view of the verticalList?

2 Answers

0 votes
Best answer


Just another idea (depending your use case):

You can check via "onSlideEnd" the current item's list index via (e.g.):

CurrentIndex = -MainList.ScrollOffset / MainList.ItemHeight;

Lets say you use an array for data storing, now you can access the array's data via this index.


A further approach: If your list items are using something like itemNo (item numbers per item) that are equal to the index. You could also loop through a (e.g.) vertical list to get its views. For example:

method Core::View getListViewItemByItemNo( int32 aItemNo, Core::VerticalList aList )
  var Core::View view = aList.first;

  // Traverse the list ob subviews from bottom to top searching
  while ( view != null )
    var Menu::ListItem handler = (Menu::ListItem) view;

    if( handler != null && handler.No == aItemNo )
      return view;

    // Continue with the next sibling
    view   = view.next;

  // Invalid view no
  return null;


These are just another ideas that lead to new potential possibilities.


THX, I will try it.
It is no problem to access it. I don't know the detailed, but it is really working for my case.
0 votes


the approach with GetViewAtIndex() will not work. The method permits you to enumerate the views existing actually within the list component. The List component, however, can handle with very large contents consisting of thousend of items. To be efficient, the List component manages internally a small cache of those views, which are actually needed (visible). Other views are simply not available until you scroll the list and the affected item becomes visible.

Therefore direct accessing a view through index is not possible - the view may be not available. You can imagine, with the method GetViewAtIndex() you have access to the views currently existing in the internal cache only.

As long as the currently selected item is visible, it can be accessed through the property Focus of the List component. Remember, when you scroll the list so that the item will become invisible, the view may be released automatically and Focus will become null again.

Therefore, it is not the recommended approach to access the views of the List component directly. I assume, you want to do this in order to modify the view. In such case, the prefered aproach is to invalidate the item only. This will cause the List component to reload the item, if it is necessary. During the reload you initialize the view with its new (current) content as you do with all other items. If the affected item is currently not visible, the reload will be omitted automatically.

Hope it helps you further

Best regards

Paul Banach

Thank for you answer. And using the data out of the vertical list, not the vertical-list, I avoid this problem.

But I do think that it is necessary to provide a list that can be more easy to use than current list.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint