cancel
Showing results for 
Search instead for 
Did you mean: 

How can I handle drag event in custom container?

Yunus ARI
Senior

Hi everyone,

I am trying design a custom container that needs to "handleDragEvent" function. But this function cannot be overridden in a container, as far as I see. This function can be usable when you work in a screen. But when you work in a custom container it's not working.

I tried create a function for drag event in custom container and call this function in a screen's "handleDragEvent" function. Like that;

void testScreenView::handleDragEvent(const touchgfx::DragEvent& evt)
{
    
    if(customContainer.isVisible()) {   
        customContainer.customDragEvent(evt);
    }
    
}

When I do that custom container drag event works very well. But this time screen's scrollable containers not working properly.

What should I do? Anybody have any idea? Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

What you're doing is effectively "stealing" the event from the rest of the components in the view, by only telling your custom container about it.

In the start of your handler, try this to propagate the event:

    View::handleClickEvent(evt);

/Martin

View solution in original post

3 REPLIES 3
Martin KJELDSEN
Chief III

What you're doing is effectively "stealing" the event from the rest of the components in the view, by only telling your custom container about it.

In the start of your handler, try this to propagate the event:

    View::handleClickEvent(evt);

/Martin

Only now I could find time to try this. Its work properly. Thank You for advice. =)

Just one correction;

 View::handleDragEvent(evt);

I think you wrote "Click" instead "Drag". :)

Woops, glad you caught that :D