cancel
Showing results for 
Search instead for 
Did you mean: 

Not work function setNumberOfItems() for scrollWheel.

ANapa
Associate III

Hi All.

Not work this code:

In HPP file:

class ScreenMainView : public ScreenMainViewBase

{

public:

  ScreenMainView();

  virtual ~ScreenMainView() {}

  virtual void setupScreen();

  virtual void tearDownScreen();

  void handleTickEvent() override;

protected:

   touchgfx::ScrollWheel sw;

   touchgfx::DrawableListItems<CustomContainerProc, 3> scrollProcListItems;

private:

  /*

   * Callback Declarations

   */

  touchgfx::Callback<ScreenMainView, touchgfx::DrawableListItemsInterface*, int16_t, int16_t> updateItemCallback1;

  /*

   * Callback Handler Declarations

   */

  void updateItemCallbackHandler(touchgfx::DrawableListItemsInterface* items, int16_t containerIndex, int16_t itemIndex);

};

In CPP file:

ScreenMainView::ScreenMainView() :

  updateItemCallback(this, &ScreenMainView::updateItemCallbackHandler)

{

}

void ScreenMainView::setupScreen()

{

  ScreenMainViewBase::setupScreen();

  sw.setPosition(78, 44, 500, 500);

  sw.setHorizontal(true);

  sw.setEasingEquation(touchgfx::EasingEquations::expoEaseOut);

  sw.setCircular(false);

  sw.setSwipeAcceleration(40);

  sw.setDragAcceleration(11);

  sw.setNumberOfItems(2); // ERROR! Not returned!

  sw.setSelectedItemOffset(0);

  sw.setDrawableSize(240, 0);

  sw.setDrawables(scrollProcListItems1, updateItemCallback1);

  sw.animateToItem(0, 0);

  add(sw);

  

}

// The function sw.setNumberOfItems(2); never returned.

2 REPLIES 2
ANapa
Associate III

Addition:

The built-in code for ScrollWheel in the designer works well.

But I need a large array of ScrollWheels.

Doing this in the designer is very bad.

ANapa
Associate III

It seems a memory issue.

I removed many of ScrollWheels made in the designer.

Now all is well.