My ui buttons are not working when implemented on a scroll view

This is how implemented my button
ui::Button * earth = ui::Button::create(“MENU SELECT EARTH ONE.png”, “MENU SELECT EARTH ONE.png”);

then the event listener is as follows

earth->addTouchEventListener(CC_CALLBACK_1(LoadingScene::GoToGameScene, this));

when i use the normal button the callback works just fine i am able to move to the game scene but when i use the ui::button on the scrollview it just fails completely doesnt even give any error or crash. It doesnt respond to the event listener. Is there a way of adding the old MenuItemImage on a scrollview? or how can i make this work with the ui::button?

what is your code for the scrollview? Do you have it swallowing touches?

here is my source code for the scrollview:

ui::ScrollView * scrollview = ui::ScrollView::create();
scrollview->setDirection(ui::ScrollView::Direction::HORIZONTAL);
scrollview->setContentSize(Size(visibleSize.width,visibleSize.height));
scrollview->setInnerContainerSize(Size(visibleSize.width*10,visibleSize.height));
scrollview->setBounceEnabled(true);
scrollview->setAnchorPoint(Vec2(0.5,0.5));
scrollview->setPosition(Vec2(visibleSize.width/2 +origin.x,visibleSize.height/2+origin.y));

i did not set anything like swallow touches am i suposed to?

perhaps try adding:

scrollView->setTouchEnabled(true);
scrollView->setSwallowTouches(false);

use this

earth->addTouchEventListener( CC_CALLBACK_2(LoadingScene::GoToGameScene, this) );
//
//
void LoadingScene::GoToGameScene(Ref* ref, ui::Widget::TouchEventType type)
{
}

Alright let me try that guys I’l get back to you

Doing this helped
scrollView->setTouchEnabled(true);
scrollView->setSwallowTouches(false);

But am not able to scroll now its picking up the touch even if i want to scroll to the left

I actually use 2 scrollviews. One that does horizontal and contains a scrollview that does the vertical. There are a few working examples in cpp-tests

i think i’l have to check up on the cpp tests