cancel
Showing results for 
Search instead for 
Did you mean: 

How to setSelectedItem() in ScrollWheel ? There is no such method. getSelectedItem()

Andrew1
Associate II

I can get scroll wheel selected item index:

  /**

   * @fn int ScrollWheelBase::getSelectedItem() const;

   *

   * @brief Gets selected item.

   *

   *    Gets selected item. If an animation is in progress, the item that is being scrolled

   *    to is returned, not the item that happens to be flying by at the time.

   *

   * @return The selected item.

   */

  int getSelectedItem() const;

But I Need programmatically set selected item

2 REPLIES 2
Martin KJELDSEN
Chief III

Please have a look at the code for Scroll Wheel. Notice how something is selected when the user touches or drags - I think you should be able to come up with something to select the item you want.

/Martin

AndrewM
Associate III

I assume you're trying to have a button press invoke the scroll up and scroll down behaviour?

FWIW here's what we did to get that happening.

Having set up interactions in the designer such that soft- and/or hard-buttons invoke eg  ViewBase::scrollDown() and ViewBase::scrollUp() methods, then in the View class have these methods do eg:

virtual void scrollDown()
{
  presenter->incrItemIndex();
  scrollWheel.animateToItem(presenter->getItemIndex(), 0);
}
 
virtual void scrollUp()
{
  presenter->decrItemIndex();
  scrollWheel.animateToItem(presenter->getItemIndex(), 0);
}

Cheers,

Andrew